what is the correct way to add a jar-file (like utils.jar) to the ejb3-file?
At the moment I put it in the root of the ejb3...by that the classes in there work. But when I want to transfer simple Pojos between ejb3 and war layer it won't work anymore.
(A java.lang.NoSuchMethodError exception is raised, when I try to invoke a bean by the initialcontext).
Thanks in advance,
Since I'm also in classloading nightmare hell I'll try to help (or share the pain).
IS your EJB3 jar part of an EAR? If so, is EAR isolation turned on or off?
Now your WAR wants to reference the interface to your EJB3s. So where does that interface exist? In the WAR or the EJB3 jar or both?
if you want ejbA.jar to have access to classes in A.jar and B.jar then add this line to the manifest of ejbA.jar:
Class-Path: a.jar b.jar
Then put A.jar and B.jar in the same directory as ejbA.jar in your ear file.
oops that should have been:
Class-Path: A.jar B.jar
YEEESS! I made it :)
You were right with the manfiest.mf-file:
I did the following thing:
In my class e.g. utils.jar I put complex parameters and functions, that all bean-levels (ejb, par, war) shall be able to use. I put it in a /lib directory of the root in the ear-file.
Then I insert the following class-path in the MANIFEST.MF:
And by that, the utils are a loaded by the unified classloader(?right?) and all levels can share even object-parameters.
Remark: I have read, that even, if you load objects from the same jar-file but through different classloaders, the objects cannot be passed as parametes from layer to layer (although the have the serializable interface implemented). To be able to share objects in different layers, they have to be loaded by the same classloader or by children of the same classloader.