I have a Grails application that runs in Glassfish but when I undeploy it gets a
Class invariant violation
A quick look at the stacktrace and search on the web reports that this is a problem with Log4j
I am using the latest log4j at the time log4j-1.2.16.jar
Any suggestions how to overcome this error.
[Mon, 22-Aug-2011 @ 09:23:32.494] [admin-thread-pool-4848(64)] ERROR javax.enterprise.system.std.com.sun.enterprise.server.logging - java.lang.IllegalStateException: Class invariant violation
at org.apache.log4j.LogManager.getLoggerRepository(LogManager.java:199)
at org.apache.log4j.LogManager.getLogger(LogManager.java:228)
at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:73)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:243)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:255)
[Edit 1]
I have just found this on the spring source forum which is interesting:
The following are recommended to avoid this problem:
- Set the org.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES system property to false.
- Apply the patch from bug 40212 or upgrade to a version that has t开发者_JAVA百科hat patch applied.
- Upgrade to log4j 1.2.16 or later to better defend against class loader attack or provide a better diagnostic message when it does occur.
[Solution] Setting the property
org.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES = false
in the domain.xml file in Glassfish resolves the issue
精彩评论