Tomcat 7 - java.lang.NoClassDefFoundError: org/apa

2019-01-17 22:20发布

I'm facing the following Exception:

Mar 26, 2012 1:20:34 PM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already.  
Could not   load org.apache.log4j.spi.ThrowableInformation.  
The eventual following stack trace is caused by an error thrown for debugging purposes 
as well as to attempt to terminate the thread which caused the illegal access, and has  
no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1562)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
at org.apache.log4j.spi.LoggingEvent.<init>(LoggingEvent.java:165)
at org.apache.log4j.Category.forcedLog(Category.java:391)
at org.apache.log4j.Category.error(Category.java:322)
at com.abc.supervisionmanager.Monitoring.run(Monitoring.java:205)
at java.lang.Thread.run(Thread.java:662)
Exception in thread "Thread_Monitoring" java.lang.NoClassDefFoundError: org/apache/log4j/spi/ThrowableInformation
at org.apache.log4j.spi.LoggingEvent.<init>(LoggingEvent.java:165)
at org.apache.log4j.Category.forcedLog(Category.java:391)
at org.apache.log4j.Category.error(Category.java:322)
at com.abc.supervisionmanager.Monitoring.run(Monitoring.java:205)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.spi.ThrowableInformation
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
... 5 more

I googled about this exception and found that most answers points that it is bug in tomcat 5.5 and it will be solved in version 5.5.28.

However I'm currently using tomcat 7.11 with log4j-1.2.16.jar I'm still facing the same issue.

4条回答
\"骚年 ilove
2楼-- · 2019-01-17 22:28

How to solve it . For me:

  1. try {} catch() log4j exception throw.
  2. run tomcat again to find the real problem
  3. solve the real problem and delete try{} catch()

It is not problem for log4j and tomcat. It will throw exception because some of your code run error in webapp init. Maybe xml or config is error.

查看更多
乱世女痞
3楼-- · 2019-01-17 22:31

Sounds like it is a problem with your libraries. Are you sure that you have the Log4J jar-file in the WEB-INF/lib folder of your webapp?

查看更多
我命由我不由天
4楼-- · 2019-01-17 22:33

For me, the solution for this issue (tested with Openbravo 3.0MP11 and Tomcat 7.0.21) was:

  1. Remove the log4j-1.2.16.jar from WEB-INF/lib.
  2. Put the log4j jar inside Tomcat's lib directory. In Ubuntu 11.10 this would be /usr/share/tomcat7/lib

Note for my specific use case of Openbravo: This does solve the log4j issue, but then I ran into other issues.

查看更多
乱世女痞
5楼-- · 2019-01-17 22:39

I had this problem with a portlet (liferay 6.2 Tomcat bundle). I fixed it by deleting the deployment that caused the exception (in the tomcat webapps folder), cleaning and redeploying (with maven -- liferay:deploy) the portlet.

查看更多
登录 后发表回答