I have a Grails application that works in Glassfish, but when I deploy it, it gets
Class invariant violation
Quick view of stacktrace and search in web reports that this is a problem with Log4j
I use the last log4j during log4j-1.2.16.jar
Any suggestions to fix 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)
[Change 1]
I just found this in the original spring forum, which is interesting:
To prevent this problem, the following is recommended:
- Set the system property org.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES to false.
- Apply the fix for error 40212 or upgrade the version in which this patch is applied.
- Update your log4j 1.2.16 or later file to better defend against the class loader attack or provide a better diagnostic message when it occurs.
[Solution] Setting the property
org.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES = false
in domain.xml in Glassfish resolves the issue
grails glassfish log4j
Shawn vader
source share