Solved: Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory

A missing Java class may cause the issue below when you try to compile your project in Eclipse.

A Java Exception has occured
Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
at org.apache.catalina.util.LifecycleBase.<clinit>(LifecycleBase.java:37)
Caused by: java.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
… 1 more

a2

a2

Solution

Follow the steps below to fix this issue.

  1. Find tomcat-juli.jar file in Tomcat installation folder (C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.0\bin)
  2. Unzip it and check if there is LogFactory class
  3. If the class doesn’t exist, download it from Apache website
  4. If it exists, copy tomcat-juli.jar file to Tomcat “lib” and JRE “lib” folders:
    C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.0\lib
    C:\Program Files (x86)\Java\jre1.8.0_101\lib

Solved: Eclipse error “Target runtime Apache Tomcat v7.0 is not defined”

You may run into this issue when you try to compile your JSP project:

Target runtime Apache Tomcat v7.0 is not defined
Faceted Project Problem

capture

capture

Solution

Make sure to install correct Apache Tomcat version. For the easiest installation, you can download and run “32-bit/64-bit Windows Service Installer” for any version (In my case, it is Tomcat 8.0.37).

http://tomcat.apache.org/download-80.cgi

After installing Apache Tomcat, follow the steps below.

  1. Install JST Server Adapters (Help -> Eclipse Marketplace)
    capture4
  2. Right click on your project. Choose “Properties
  3. Go to “Targeted Runtime
  4. Choose or Add the Tomcat version you prefer
    capture3

If this doesn’t solve the issue, try changing the target runtime in the configuration file  (org.eclipse.wst.common.project.facet.core.xml).

capture2