Hi,
I am using JSP and EJB's and DAO. In DAO i have used log4j-1.2.8.jar. Initially i deployed and tested with EAR(which includes both JAR and WAR) and was working fine. But when i run the same application after deploying JAR and WAR seperately i am getting java.lang.NoClassDefFoundError: org/apache/log4j/Priority while running my application. This is thrown from the DAO which i used. I checked in the manifest file class path and the jar is fine. Can anybody please guide me why this 3rd party jar is not being picked up.
This is how i am creating the jar
jar cvfm test.jar Manifest.mf META-INF commons-beanutils-1.6.1.jar commons-beanutils.jar commons-collections-2.1.jar commons-collections.jar commons-digester-1.5.jar commons-digester.jar commons-fileupload.jar commons-lang-2.0.jar commons-lang.jar commons-logging-1.0.3.jar commons-logging.jar commons-validator.jar displaytag-1.0-b3.jar jakarta-oro.jar jdom.jar jstl.jar jta.jar log4j-1.2.8.jar menu.jar ojdbc14.jar oscache.jar standard-1.0.4.jar standard.jar struts-1.1.jar Struts-Layout.jar struts-legacy.jar struts-menu-2.1.jar struts.jar velocity-1.4-rc1.jar velocity-tools-view-1.0.jar xerces-2.4.0.jar xmlParserAPIs.jar com
Discussions
EJB programming & troubleshooting: Error while running application using JAR and WAR instead of EAR
-
Error while running application using JAR and WAR instead of EAR (2 messages)
- Posted by: Muthu N
- Posted on: June 23 2004 01:40 EDT
Threaded Messages (2)
- Maven could build your war... by Matthew Wilson on June 23 2004 07:07 EDT
- Error while running application using JAR and WAR instead of EAR by Amit L on June 24 2004 02:51 EDT
-
Maven could build your war...[ Go to top ]
- Posted by: Matthew Wilson
- Posted on: June 23 2004 07:07 EDT
- in response to Muthu N
The war should be build as:
WEB-INF
classes (your classes expanded)
lib (all 3rd party jars)
Using maven or ant will assist you in building a war in the correct format.
If you are already doing this then try to move the logging jar to the application level classpath. -
Error while running application using JAR and WAR instead of EAR[ Go to top ]
- Posted by: Amit L
- Posted on: June 24 2004 02:51 EDT
- in response to Muthu N
Hi
First try to understand why the java.lang.NoClassDefFoundError error is coming.This error will come when the classA using classB wont find the ClassB at runtime.Everything must have got compiled at the compile time.
The classloader which loads the classA is not able to find the classB. This may happen because.
1. classA is been loaded by enterprise application class loader. and classB is being loaded by webapplication class loader.In this case classA wont be able to locate the classB. So if ur classA is being loaded by application classloader you will have to keep the classB in your enterprise application directory,so that application classloader will load classB and error will go.
2. If classA and classB is present in webapplication and still the error is coming then as previous mail said keep the classB/JAR in WEB-INF\classes or WEB-INF\lib directory.
Hope this solves u r problem
Amit