Tomcat 7 - . lang。NoClassDefFoundError:org/apache/log4j/spi/ThrowableInformation

时间:2022-12-16 15:36:42

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.

我在google上搜索了这个异常,发现大多数的答案都指向了tomcat 5.5中的bug,它将在5.5.28版本中得到解决。

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

不过,我现在使用的是tomcat 7.11和log4j-1.2.16。我仍然面临同样的问题。

4 个解决方案

#1


8  

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

对于我来说,这个问题的解决方案(Openbravo 3.0MP11和Tomcat 7.0.21测试)是:

  1. Remove the log4j-1.2.16.jar from WEB-INF/lib.
  2. 删除log4j-1.2.16。从web - inf / lib jar。
  3. Put the log4j jar inside Tomcat's lib directory. In Ubuntu 11.10 this would be /usr/share/tomcat7/lib
  4. 将log4j jar放在Tomcat的lib目录中。在Ubuntu 11.10中,这将是/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.

请注意Openbravo的具体用例:这确实解决了log4j问题,但随后又遇到了其他问题。

#2


2  

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?

听起来好像是你的图书馆出了问题。您确定您的webapp的WEB-INF/lib文件夹中有Log4J jar文件吗?

#3


0  

How to solve it . For me:

如何解决它。对我来说:

  1. try {} catch() log4j exception throw.
  2. try {} catch() log4j异常抛出。
  3. run tomcat again to find the real problem
  4. 再次运行tomcat以找到真正的问题。
  5. solve the real problem and delete try{} catch()
  6. 解决实际问题和删除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.

对于log4j和tomcat来说,这不是问题。它会抛出异常,因为在webapp init中有一些代码运行错误。也许xml或config是错误的。

#4


-1  

I got the same error in catalina.out, but find error at the beginning:

我在卡特琳娜也犯了同样的错误。但在开始时发现错误:

2016-3-18 16:44:59 org.apache.catalina.core.StandardServer await
StandardServer.await: create[localhost:8291]: 
java.net.BindException: Address already in use

Finally the real reason is the port.

最后真正的原因是港口。

#1


8  

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

对于我来说,这个问题的解决方案(Openbravo 3.0MP11和Tomcat 7.0.21测试)是:

  1. Remove the log4j-1.2.16.jar from WEB-INF/lib.
  2. 删除log4j-1.2.16。从web - inf / lib jar。
  3. Put the log4j jar inside Tomcat's lib directory. In Ubuntu 11.10 this would be /usr/share/tomcat7/lib
  4. 将log4j jar放在Tomcat的lib目录中。在Ubuntu 11.10中,这将是/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.

请注意Openbravo的具体用例:这确实解决了log4j问题,但随后又遇到了其他问题。

#2


2  

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?

听起来好像是你的图书馆出了问题。您确定您的webapp的WEB-INF/lib文件夹中有Log4J jar文件吗?

#3


0  

How to solve it . For me:

如何解决它。对我来说:

  1. try {} catch() log4j exception throw.
  2. try {} catch() log4j异常抛出。
  3. run tomcat again to find the real problem
  4. 再次运行tomcat以找到真正的问题。
  5. solve the real problem and delete try{} catch()
  6. 解决实际问题和删除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.

对于log4j和tomcat来说,这不是问题。它会抛出异常,因为在webapp init中有一些代码运行错误。也许xml或config是错误的。

#4


-1  

I got the same error in catalina.out, but find error at the beginning:

我在卡特琳娜也犯了同样的错误。但在开始时发现错误:

2016-3-18 16:44:59 org.apache.catalina.core.StandardServer await
StandardServer.await: create[localhost:8291]: 
java.net.BindException: Address already in use

Finally the real reason is the port.

最后真正的原因是港口。