-
1. Re: how to package ear and lib, classloader issue
peterj Feb 25, 2008 11:45 AM (in response to javatwo)Class defined in war files are in a different scope from classes defined elsewhere. Thus any attempt to instantiate class in a war from anywhere other than inside the war will fail.
P.S. Use the code tags when posting XML content - select the content and click the Code button. -
2. Re: how to package ear and lib, classloader issue
javatwo Feb 25, 2008 11:03 PM (in response to javatwo)Hi Peter,
thanks for your help.
If I move the class package.Foo to foo.par entity module, the common.jar under server/default/lib can instantiate the class.
But the package.Foo class needs to access classes defined in the web module, and throws
java.lang.NoClassDefFoundError.
Is there a way for entity module to access war module? or can I configure some classloader to make it work?
Thanks
Dave -
3. Re: how to package ear and lib, classloader issue
javatwo Feb 25, 2008 11:19 PM (in response to javatwo)Another question:
how to package a lib jar into enitty par module and session ejb3 module?
Thanks
Dave -
4. Re: how to package ear and lib, classloader issue
peterj Feb 26, 2008 11:11 AM (in response to javatwo)The class scoping is according to the spec - as far as I know there is no way around it (though the scoping does appear to be broken in 5.0 beta4, but I would not rely on that - it should be fixed by GA).
In general the scoping is such that all classes in server/xxx/lib and server/xxx/deploy (other than those in war files) can see each other, but all classes within war files are in their own scopes (though they can see the classes in lib and deploy, but not in other war files). There is an option to limit the scope of classes within containers within the deploy directory (for example, limit the scope of the classes within an ear, specifically so that you can package in the ear different versions of classes that appear elsewhere).