NoClassDefFoundError org apache juli logging LogFactory
Unable to start embedded container; nested exception is java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
- If you see below exception while running application then please follow below steps to fix it:
org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:124) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:476) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691) at org.springframework.boot.SpringApplication.run(SpringApplication.java:320) at org.springframework.boot.SpringApplication.run(SpringApplication.java:952) at org.springframework.boot.SpringApplication.run(SpringApplication.java:941) at com.javahonk.Application.main(Application.java:17) Caused by: java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory at org.apache.catalina.util.LifecycleBase.<clinit>(LifecycleBase.java:37) at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:140) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:148) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:121) ... 7 common frames omitted
Solution: This happens if tomcat-juli.jar is missing from your classpath. If you are working on eclipse please see steps below:
- Click to open your server tab
- Double click tomcat server in your eclipse server view to open its configuration
- Click “Open launch configuration”
- Click classpath tab –> Add external jar –> select location of jar (TOMCAT_HOME/bin/tomcat-juli.jar)
- Click OK
- Run tomcat from eclipse
- This should fix the issue