Francois Francois I think you might be a bit puzzled by class loading in EAR (no wonder, who isn't, right?). In fact I wasn't sure either so I went ahead and checked the EE spec.
Assume that in EAR you have WAR files, EJB modules and finally JAR files located under EAR/lib. Now here is a breakdown of "who can see who", please note that this is not exhaustive list and you should consult Java EE 6 spec doc for complete information:
-
WAR file
-
can see any other WAR files, required libraries from EAR/lib and also EJB modules
-
therefore can see pretty much anything
-
Relevant spec section: EE.8.3.1 Web Container Class Loading Requirements
-
EJB module
-
can see required libraries from EAR/lib, other EJB modules
-
cannot see WAR files
-
Relevant spec section: EE.8.3.2 EJB Container Class Loading Requirements
-
JAR file in EAR/lib
-
cannot see WAR files, EJB modules and probably even other files in library as long as it doesn't have a direct dependence on them
All the above applied to your case means that if you place your ocelot-core.jar in EAR/lib, it will not see anything but the classes withing the jar itself. If you place ocelot-core.jar as a library into your ocelot.web.war, it should be able to see everything you need (from your last comment I think it is what you did, right?) And yes, it is expected that from EJB module you cannot access the bean in WAR.
Hope I shed some light on this for you. As this is not a bug, I'll close the issue. If you feel differently about it, feel free to reopen with additional information/reproducer.
|