-
1. Re: Classloader problem
weliwarmer May 6, 2003 8:57 AM (in response to weliwarmer)p.s. an example stack track is
java.lang.ClassNotFoundException: net.tqweb.actions.openProject
at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at org.jboss.mx.loading.UnifiedClassLoader.findClass(UnifiedClassLoader.java:401)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at org.jboss.mx.loading.UnifiedClassLoader.loadClassLocally(UnifiedClassLoader.java:242)
at org.jboss.mx.loading.ClassLoadingTask$ThreadTask.run(ClassLoadingTask.java:114)
at org.jboss.mx.loading.LoadMgr.nextTask(LoadMgr.java:281)
at org.jboss.mx.loading.UnifiedClassLoader3.loadClass(UnifiedClassLoader3.java:181)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at net.truetrue.util.servlets.actions.ActionFactory.getAction(Unknown Source)
at net.truetrue.util.servlets.actions.ActionServlet.service(Unknown Source) -
2. Re: Classloader problem
ben2 May 6, 2003 9:02 AM (in response to weliwarmer)you want to put all common files in a separate jar file and put that in your ear. Then create a MANIFEST.MF file and put it in each war file, like so
SomeApp.ear
+app1.war
-WEB-INF\MANIFEST.MF
Class-Path: commonfiles.jar
+app2.war
-WEB-INF\MANIFEST.MF
Class-Path: commonfiles.jar
+commonfiles.jar
+application.xml -
3. Re: Classloader problem
weliwarmer May 6, 2003 1:57 PM (in response to weliwarmer)Thanks Ben. Forgot about the manifest. Would you mind having a look at the following and see why it's not picking up the classpath from the new MAINIFEST.MF?
maintbook.ear
--META-INF/MANIFEST.MF
--admin.war
----META-INF/MANIFEST.MF
--project.war
----META-INF/MANIFEST.MF
--ejb.jar
----META-INF/MANIFEST.MF
--maintbook-common.jar
--utils.jar
Is the current structure of the ear file. All MANIFEST.MF's have the same content:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.5.3
Created-By: 1.4.1_01-b01 (Sun Microsystems Inc.)
Name: Maintbook
Class-Path: maintbook-common.jar utils.jar
I have taken the maintbook-common.jar out of the external path to make the ear closed. Now the ejb's will not deploy because the class loader does not load the maintbook-common.jar. It seems the same for the wars (but I can't test them properly without the EJB's)
Thanks for your help, Tim. -
4. Re: Classloader problem
raja05 May 6, 2003 2:57 PM (in response to weliwarmer)I would try removing the MANIFEST.MF from all the web archives and have the MANIFEST.MF in your ejb archive alone. If you look at the classloader hierarchy, your ejb will be loaded first and then the wars within an ear(Thats how ive seen in weblogic). So your EJBs shud hve access to maintbook-common.jar and your wars can pick it from there.
-Raj -
5. Re: Classloader problem
weliwarmer May 6, 2003 3:59 PM (in response to weliwarmer)Thanks Raj
I've tried that but the common classes are not loaded by the web apps if the MANIFEST.MF file for each war has the correct class-path.
Which brings me round to the original problem.....
The jars are definitly being loaded by the classloader, the problem occurs only on accessing a second war from the same ear.
It does not matter which web app I access first, that one allways loads it's classes correctly. On visiting the second web app, the classes that I have seen loaded on previous occasions are not found. ????
It's bound to be something really simple that I've missed over these last 5 hours....