[jbosscache-issues] [JBoss JIRA] Commented: (JBCACHE-1416) Allow to put jboss cache and log4j libs in the WEB-INF/lib dir. The Cache#shutdown and Cache#stop methods are not blocking an provok errors when undeploying a webapp.

Laurent Mimoun (JIRA) jira-events at lists.jboss.org
Mon Sep 29 13:33:22 EDT 2008


    [ https://jira.jboss.org/jira/browse/JBCACHE-1416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12431635#action_12431635 ] 

Laurent Mimoun commented on JBCACHE-1416:
-----------------------------------------

Hello,

I don't know but it is easy to test it if the api is about the same :

For example you can just launch the cache#stop and cache#destroy method in a separate thread that will starts after the webapp is undeployed (5s in this code).

For example :

public void destroy() {
		new Thread() {
			@Override
			public void run() {
				try {
					Thread.sleep(5000);
				} catch (InterruptedException e) {
                                        e.printStackTrace();
				}
				cache.stop();
				cache.destroy();
			}
		}.start();
}

generate this stacktrace in the log each time :

Exception in thread "Thread-11" java.lang.NullPointerException
	at fr.arkhineo.ntp.controller.ApplicationLifeCycle$1.run(ApplicationLifeCycle.java:90)
29 sept. 2008 19:28:21 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:1273)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
	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)




> Allow to put jboss cache and log4j libs in the WEB-INF/lib dir. The Cache#shutdown and Cache#stop methods are not blocking an provok errors when undeploying a webapp.
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: JBCACHE-1416
>                 URL: https://jira.jboss.org/jira/browse/JBCACHE-1416
>             Project: JBoss Cache
>          Issue Type: Feature Request
>      Security Level: Public(Everyone can see) 
>          Components: Clustering
>    Affects Versions: 2.2.0.GA
>         Environment: tomcat6
>            Reporter: Laurent Mimoun
>            Assignee: Manik Surtani
>            Priority: Critical
>             Fix For: 2.X
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jbosscache-issues mailing list