Reputation:
My project structure is the following. Server is Glassfish 4. IDE - netbeans 7.4. Project temp is used by project a.
EAR
+ lib/temp.jar
+ a.war
Temp.jar
contains core classes. They are used by war. Temp.jar
doesn't import any files from war, and it must know about war nothing. But, temp.jar
has classes that creates instances of war classes by reflection (according to xml file). Here I get ClassNotFoundException
. How can it be fixed? Is it possible to fix or I have wrong project structure?
Note: I didn't put temp.jar in a.war as there can be different war files that can use this jar.
Upvotes: 3
Views: 3932
Reputation: 21
Add jar file to the you lib folder. Change MANIFEST.MF and add the particular jar path to Bundle-ClassPath.
That worked for me.
Upvotes: 2
Reputation:
I found the answer.
If we put jar into ear/lib folder then the classes in it can be accessed but they can't access the classes out of lib (in this case there is no need to add something to manifest file of war).
If we put jar in root of ear or in any other folder ear/bum than the classes of these jar can access war classes.
So I conclude, that /lib is monodirectional, any other are bidirectional.
Hope it will save someone a lot of time.
Upvotes: 3