java.lang.IllegalStateException

apache.org | 2 weeks ago
  1. 0

    When undeploying the webapp, here is the errors in the logs : Sep 25, 2008 7:50:36 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive ROOT.war Sep 25, 2008 7:55:33 PM org.apache.catalina.startup.HostConfig checkResources INFO: Undeploying context [] Sep 25, 2008 7:55:33 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive ROOT.war Sep 25, 2008 7:55:34 PM org.apache.catalina.loader.WebappClassLoader loadClass INFO: Illegal access: this web application instance has been stopped already. Could not load java.io.PrintWriter. 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:1246) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at org.apache.log4j.spi.LoggingEvent.<init>(LoggingEvent.java:154) at org.apache.log4j.Category.forcedLog(Category.java:388) at org.apache.log4j.Category.log(Category.java:853) at org.apache.commons.logging.impl.Log4JLogger.error(Log4JLogger.java:193) at org.jgroups.protocols.MPING.run(MPING.java:362) at java.lang.Thread.run(Thread.java:619) Sep 25, 2008 7:55: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.VectorWriter. 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:1246) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at org.apache.log4j.spi.LoggingEvent.<init>(LoggingEvent.java:154) at org.apache.log4j.Category.forcedLog(Category.java:388) at org.apache.log4j.Category.log(Category.java:853) at org.apache.commons.logging.impl.Log4JLogger.error(Log4JLogger.java:193) at org.jgroups.protocols.MPING.run(MPING.java:362) at java.lang.Thread.run(Thread.java:619) Sep 25, 2008 7:55: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.VectorWriter. 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:1246) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at org.apache.log4j.spi.LoggingEvent.<init>(LoggingEvent.java:154) at org.apache.log4j.Category.forcedLog(Category.java:388) at org.apache.log4j.Category.log(Category.java:853) at org.apache.commons.logging.impl.Log4JLogger.error(Log4JLogger.java:193) at org.jgroups.protocols.Discovery$PingSenderTask$1.run(Discovery.java:389) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) at java.lang.Thread.run(Thread.java:619) Sep 25, 2008 7:55:36 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.VectorWriter. 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. After a closer analysis, the reason is quite simple, in the destroy method of the servlet of my webapp, the method Cache#stop is called but this method doesn't wait that the jgroups thread to finish. So the destroy method returns but there are still jgroups thread in the jvm. These threads sometimes use the log4j api (that is in the war too) to log message but the classloader of the webapp is no more avalaible to load the log4j classes because the webapp has been undeployed, that's why an "could not load class ...log4j" happens. To fix the problem, I think the lifecycle methods of jboss cache must be blocking is the case of using jgroups threads. This way the jboss cache and log4j will be able to be packaged in a single war file that is very a good thing in terms of maintenance developpement and so on.

    JBoss Issue Tracker | 8 years ago | Laurent Mimoun
    java.lang.IllegalStateException
  2. Speed up your debug routine!

    Automated exception search integrated into your IDE

Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.IllegalStateException

    No message provided

    at org.apache.catalina.loader.WebappClassLoader.loadClass()
  2. Glassfish Core
    WebappClassLoader.loadClass
    1. org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1238)
    2. org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
    2 frames
  3. Java RT
    ClassLoader.loadClassInternal
    1. java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    1 frame
  4. Apache Log4j
    Category.log
    1. org.apache.log4j.spi.LoggingEvent.<init>(LoggingEvent.java:154)
    2. org.apache.log4j.Category.forcedLog(Category.java:388)
    3. org.apache.log4j.Category.log(Category.java:853)
    3 frames
  5. Apache Commons Logging
    Log4JLogger.error
    1. org.apache.commons.logging.impl.Log4JLogger.error(Log4JLogger.java:193)
    1 frame
  6. org.apache.catalina
    DeltaManager.start
    1. org.apache.catalina.cluster.session.DeltaManager.start(DeltaManager.java:989)
    1 frame
  7. Glassfish Core
    StandardContext.reload
    1. org.apache.catalina.core.StandardContext.start(StandardContext.java:4137)
    2. org.apache.catalina.core.StandardContext.reload(StandardContext.java:2990)
    2 frames
  8. org.apache.catalina
    HTMLManagerServlet.doGet
    1. org.apache.catalina.manager.ManagerServlet.reload(ManagerServlet.java:906)
    2. org.apache.catalina.manager.HTMLManagerServlet.reload(HTMLManagerServlet.java:473)
    3. org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:98)
    3 frames
  9. JavaServlet
    HttpServlet.service
    1. javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
    2. javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    2 frames
  10. Glassfish Core
    StandardHostValve.invoke
    1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    3. org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    4. org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    5. org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
    6. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    6 frames
  11. org.apache.catalina
    ReplicationValve.invoke
    1. org.apache.catalina.cluster.tcp.ReplicationValve.invoke(ReplicationValve.java:346)
    1 frame
  12. Glassfish Core
    CoyoteAdapter.service
    1. org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    2. org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    3. org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    3 frames
  13. Grizzly HTTP
    AprEndpoint$Worker.run
    1. org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:833)
    2. org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:639)
    3. org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1285)
    3 frames
  14. Java RT
    Thread.run
    1. java.lang.Thread.run(Thread.java:595)
    1 frame