Menu ▾ ▴

#37 shutdown tomcat - Could not load [patterntesting.runtime.io.ExtendedFile]

v1.7
closed-fixed
nobody
shutdown (1)
4
2017-08-12
2017-07-10
No

When tomcat is shut down you can see the following stacktrace:

INFO: Illegal access: this web application instance has been stopped already. Could not load [patterntesting.runtime.io.ExtendedFile]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [patterntesting.runtime.io.ExtendedFile]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
        at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1327)
        at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1313)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1196)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1157)
        at patterntesting.runtime.monitor.AbstractMonitor.dumpMe(AbstractMonitor.java:160)
        at patterntesting.runtime.monitor.AbstractMonitor.run(AbstractMonitor.java:92)

Discussion

  • Oliver Boehm

    Oliver Boehm - 2017-07-15

    Can be reproduced with samples-jfs2010 and Tomcat 8. The complete stack trace is:

    Exception in thread "Thread-4" java.lang.NoClassDefFoundError: org/apache/commons/io/FileUtils
        at patterntesting.runtime.io.ExtendedFile.getTmpdir(ExtendedFile.java:191)
        at patterntesting.runtime.io.ExtendedFile.createTmpdir(ExtendedFile.java:177)
        at patterntesting.runtime.monitor.AbstractMonitor.dumpMe(AbstractMonitor.java:163)
        at patterntesting.runtime.monitor.AbstractMonitor.run(AbstractMonitor.java:95)
    Caused by: java.lang.ClassNotFoundException: Illegal access: this web application instance has been stopped already. Could not load [org.apache.commons.io.FileUtils]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
        at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1343)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1206)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
        ... 4 more
    Caused by: java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [org.apache.commons.io.FileUtils]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
        at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1353)
        at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1341)
        ... 6 more
    Exception in thread "pool-1-thread-1" java.lang.NoClassDefFoundError: org/apache/logging/log4j/message/ParameterizedNoReferenceMessageFactory$StatusMessage
        at org.apache.logging.log4j.message.ParameterizedNoReferenceMessageFactory.newMessage(ParameterizedNoReferenceMessageFactory.java:105)
        at org.apache.logging.log4j.message.AbstractMessageFactory.newMessage(AbstractMessageFactory.java:75)
        at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:2010)
        at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1884)
        at org.apache.logging.log4j.spi.AbstractLogger.error(AbstractLogger.java:793)
        at org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry.run(DefaultShutdownCallbackRegistry.java:76)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: java.lang.ClassNotFoundException: Illegal access: this web application instance has been stopped already. Could not load [org.apache.logging.log4j.message.ParameterizedNoReferenceMessageFactory$StatusMessage]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
        at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1343)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1206)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
        ... 7 more
    Caused by: java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [org.apache.logging.log4j.message.ParameterizedNoReferenceMessageFactory$StatusMessage]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
        at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1353)
        at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1341)
        ... 9 more
    
     

    Last edit: Oliver Boehm 2017-07-15
  • Oliver Boehm

    Oliver Boehm - 2017-07-16
    • status: open --> pending
     
  • Oliver Boehm

    Oliver Boehm - 2017-07-16

    It makes no sense to register the ClasspathMonitor (or any other Monitor class) as shutdown hook inside Tomcat (or other application server), because Tomcat itself stops the application at shutdown. So the ClasspathMonitor cannot be run from shutdown thread because application is already stopped).

    For this reason the registration as shutdown hook is ignored now if the classloader of an application server is detected. If you want to dump the ClasspathMonitor before shutdown do it manually (via MBean / jconsole) or try to trigger it automatically via JMX before Tomcat is shut down.

     
  • Oliver Boehm

    Oliver Boehm - 2017-08-12
    • status: pending --> closed
     
  • Oliver Boehm

    Oliver Boehm - 2017-08-12
    • status: closed --> closed-fixed