java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [org.jvnet.hk2.internal.ServiceLocatorImpl$7]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.

Java.net JIRA | pfoermer | 10 months ago
  1. 0

    jersey-client:2.22.1 is used in webapps deployed on Tomcat 8/JDK 8. The REST proxy client is created via {code:java}org.glassfish.jersey.client.proxy.WebResourceFactory.newResource(Class<T> resourceInterface, WebTarget target){code}. If the garbage collector runs after such a webapp is undeployed, the following exception is raised: {noformat} Illegal access: this web application instance has been stopped already. Could not load [org.jvnet.hk2.internal.ServiceLocatorImpl$7]. 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 [org.jvnet.hk2.internal.ServiceLocatorImpl$7]. 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) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1206) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167) at org.jvnet.hk2.internal.ServiceLocatorImpl.shutdown(ServiceLocatorImpl.java:889) at org.glassfish.jersey.internal.inject.Injections.shutdownLocator(Injections.java:290) at org.glassfish.jersey.client.ClientRuntime.close(ClientRuntime.java:322) at org.glassfish.jersey.client.ClientRuntime.finalize(ClientRuntime.java:297) at java.lang.System$2.invokeFinalize(System.java:1270) at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:98) at java.lang.ref.Finalizer.access$100(Finalizer.java:34) at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:210) {noformat}

    Java.net JIRA | 10 months ago | pfoermer
    java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [org.jvnet.hk2.internal.ServiceLocatorImpl$7]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
  2. 0

    Memory leak. HystrixMetricsPoller.pause throws exception on app shutdown. Poller keeps running.

    GitHub | 9 months ago | vinshar
    java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [java.util.concurrent.ScheduledFutur e]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
  3. 0

    This error happens on shutdown, and if the user uses the shutdown.bat/sh command (which is also what our CI uses), then the tomcat JVM hangs. This issue also is not OS-specific and can be reproduced in linux and windows (tested using Tomcat 8.0.30). *Steps to reproduce:* # Start Liferay # Shut down Liferay using shutdown.bat / shutdown.sh (Note that if you use ctrl + c, you will get the illegalStateException but the shutdown process will not hang). #* The tomcat JVM will hang. #* Immediately on shutdown, an illegalStateException appears: {code}13-Jan-2016 03:01:53.178 INFO [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading Illegal access: this web application instance has been stopped already. Could not load [org.springframework.web.context.ContextCleanupListener]. 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 [org.springframework.web.context.ContextCleanupListener]. 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) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1206) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167) at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:145) at com.liferay.portal.spring.context.PortalContextLoaderListener.contextDestroyed(PortalContextLoaderListener.java:168) at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4859) at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5478) at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232) at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1424) at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1413) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) 13-Jan-2016 03:01:53.181 SEVERE [localhost-startStop-2] org.apache.catalina.core.StandardContext.listenerStop Exception sending context destroyed event to listener instance of class com.liferay.portal.spring.context.PortalContextLoaderListener java.lang.NoClassDefFoundError: org/springframework/web/context/ContextCleanupListener at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:145) at com.liferay.portal.spring.context.PortalContextLoaderListener.contextDestroyed(PortalContextLoaderListener.java:168) at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4859) at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5478) at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232) at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1424) at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1413) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 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.springframework.web.context.ContextCleanupListener]. 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) ... 11 more Caused by: java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [org.springframework.web.context.ContextCleanupListener]. 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) ... 13 more{code} #* Eventually, the following out of memory errors will appear: {code}12-Jan-2016 23:17:51.834 INFO [Statistics Thread-MULTI_VM_PORTAL_CACHE_MANAGER-1] org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading Illegal access: this web application instance has been stopped already. Could not load [java.lang.OutOfMemoryError]. 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 [java.lang.OutOfMemoryError]. 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) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1206) at java.lang.ClassLoader.loadClass(ClassLoader.java:412) at com.liferay.portal.module.framework.ModuleFrameworkClassLoader.loadClass(ModuleFrameworkClassLoader.java:98) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:356) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:349) at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at net.sf.ehcache.util.concurrent.ConcurrentHashMap.values(ConcurrentHashMap.java:2718) at net.sf.ehcache.util.concurrent.ConcurrentHashMap.values(ConcurrentHashMap.java:220) at net.sf.ehcache.statistics.extended.ExtendedStatisticsImpl$1.run(ExtendedStatisticsImpl.java:104) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745){code}

    Liferay Issues | 11 months ago | Albert Lee
    java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [org.springframework.web.context.ContextCleanupListener]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    [LPS-61760] Tomcat 8 Shutdown error - IllegalStateException logging info, the web application instance has been stopped already - Liferay Issues

    liferay.com | 7 months ago
    java.lang.IllegalStateException: Illegal access: web application instance has been stopped already. Could not load [org.springframework.web.context.ContextCleanupListener]. The following stack trace is thrown debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
  6. 0

    [LPS-61760] Tomcat 8 Shutdown error - IllegalStateException logging info, the web application instance has been stopped already - Liferay Issues

    liferay.com | 6 months ago
    java.lang.IllegalStateException: Illegal access: web application instance has been stopped already. Could not load [org.springframework.web.context.ContextCleanupListener]. The following stack trace is thrown debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
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

    Illegal access: this web application instance has been stopped already. Could not load [org.jvnet.hk2.internal.ServiceLocatorImpl$7]. 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()
  2. Glassfish Core
    WebappClassLoaderBase.loadClass
    1. org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1353)
    2. org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1341)
    3. org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1206)
    4. org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
    4 frames
  3. ServiceLocator Default Implementation
    ServiceLocatorImpl.shutdown
    1. org.jvnet.hk2.internal.ServiceLocatorImpl.shutdown(ServiceLocatorImpl.java:889)
    1 frame
  4. Jersey Core
    Injections.shutdownLocator
    1. org.glassfish.jersey.internal.inject.Injections.shutdownLocator(Injections.java:290)
    1 frame
  5. jersey-core-client
    ClientRuntime.finalize
    1. org.glassfish.jersey.client.ClientRuntime.close(ClientRuntime.java:322)
    2. org.glassfish.jersey.client.ClientRuntime.finalize(ClientRuntime.java:297)
    2 frames
  6. Java RT
    Finalizer$FinalizerThread.run
    1. java.lang.System$2.invokeFinalize(System.java:1270)
    2. java.lang.ref.Finalizer.runFinalizer(Finalizer.java:98)
    3. java.lang.ref.Finalizer.access$100(Finalizer.java:34)
    4. java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:210)
    4 frames