Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory [duplicate]

Tags:

eclipse

tomcat

Seem to have a problem starting my Java app:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory at org.apache.catalina.util.LifecycleBase.(LifecycleBase.java:37) Caused by: java.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ... 1 more

Tried the solution here: java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory

But I see tomcat-juli.jar already. Also I'm using Tomcat 7. What might be wrong?

like image 539
Michael Avatar asked Oct 31 '11 14:10

Michael


2 Answers

Your vm does not find the class org/apache/juli/logging/LogFactory check if this class is present in the tomcat-juli.jar that you use (unzip it and search the file), if it's not present download the library from apache web site else if it's present put the tomcat-juli.jar in a path (the lib directory) that Tomcat use to load classes. If your Tomcat does not find it you can copy the jar in the lib directory of the JRE that you are using.

like image 153
Massimo Zerbini Avatar answered Oct 14 '22 10:10

Massimo Zerbini


I ran into this problem when using tomcat-embed-core::7.0.47, from Maven. I'm not sure why they didn't add tomcat-util as a runtime dependency, so I added my own runtime dependency to my own project.

<dependency>   <groupId>org.apache.tomcat</groupId>   <artifactId>tomcat-util</artifactId>   <version><!-- version from tomcat-embed-core --></version>   <scope>runtime</scope> </dependency> 
like image 41
Kyle Krull Avatar answered Oct 14 '22 10:10

Kyle Krull