- Joined
- Apr 22, 2008
- Messages
- 3
- Reaction score
- 0
Hi,
I have been working in a project where I have to write a web application custom class loader which will load the jar file from tomcat/webapps/<app_name>/module/<module_name>/lib/ directory.I would like to know how to write a custom web application class loader that would help me to load the jars from the above mentioned path well with loading the jar files from
tomcat/webapps/<app_name>/WEB-INF/lib directory.
I will not be able to keep my module related jars in WEB-INF/lib as there may be same jar files(say, jdom.jar) with different versions(say 0.9 and 1.1) and I need to load them dynamically.
I am getting the following error,
java.lang.NoClassDefFoundError: org/jdom/filter/AbstractFilter
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1634)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:860)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1307)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2395)
at java.lang.Class.getMethod0(Class.java:2642)
at java.lang.Class.getMethod(Class.java:1579)
Please guide me on how to write a custom class loader for web application.Is there any setting I need to do?I am using Tomcat 5 with JDK 5.
Any comment will help me to go to a right direction.
:-(
Thanks,
-Tapas
I have been working in a project where I have to write a web application custom class loader which will load the jar file from tomcat/webapps/<app_name>/module/<module_name>/lib/ directory.I would like to know how to write a custom web application class loader that would help me to load the jars from the above mentioned path well with loading the jar files from
tomcat/webapps/<app_name>/WEB-INF/lib directory.
I will not be able to keep my module related jars in WEB-INF/lib as there may be same jar files(say, jdom.jar) with different versions(say 0.9 and 1.1) and I need to load them dynamically.
I am getting the following error,
java.lang.NoClassDefFoundError: org/jdom/filter/AbstractFilter
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1634)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:860)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1307)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2395)
at java.lang.Class.getMethod0(Class.java:2642)
at java.lang.Class.getMethod(Class.java:1579)
Please guide me on how to write a custom class loader for web application.Is there any setting I need to do?I am using Tomcat 5 with JDK 5.
Any comment will help me to go to a right direction.
:-(
Thanks,
-Tapas