On 23/03/2015 02:11, Austin Jones wrote:
> After a bit of debugging, I found the issue.  The stack traces below are on
> 8.0.12-src.
> 
> The bug occurs at this stack:
> 
>> StandardContext.reload() line: 3779
>> HostConfig.reload(HostConfig$DeployedApplication) line: 1306
>> HostConfig.checkResources(HostConfig$DeployedApplication) line: 1238
>> HostConfig.check(String) line: 1493
> 
> 
> HostConfig.checkResources(DeployedApplication) runs through the branch:
> 
>> if (app.hasDescriptor && resource.getName().toLowerCase(
>> Locale.ENGLISH).endsWith(".war")) { ... }
> 
> 
> It calls ExpandWar.delete( docBaseFile ), which is the unpacked webapp
> directory.
> 
> Then, checkResources calls reload(app) - which invokes the context
> listener.
> 
> The ClassLoader eventually gets down to this stack:
> 
>> DirResourceSet.getResource(String) line: 100
> 
> StandardRoot.getResourceInternal(String, boolean) line: 280
>> Cache.getResource(String, boolean) line: 65
>> StandardRoot.getResource(String, boolean, boolean) line: 216
>> StandardRoot.getClassLoaderResource(String) line: 225
>> WebappClassLoader.findResourceInternal(String, String) line: 2556
>> WebappClassLoader.findClassInternal(String) line: 2410
>> WebappClassLoader.findClass(String) line: 880
>> WebappClassLoader.loadClass(String, boolean) line: 1290
>> WebappClassLoader.loadClass(String) line: 1173
>> TestcaseContextListener.contextDestroyed(ServletContextEvent) line: 23
>> StandardContext.listenerStop() line: 4792
>> StandardContext.stopInternal() line: 5392
>> StandardContext(LifecycleBase).stop() line: 232
>> StandardContext.reload() line: 3768
>> HostConfig.reload(HostConfig$DeployedApplication) line: 1306
>> HostConfig.checkResources(HostConfig$DeployedApplication) line: 1238
>> HostConfig.check(String) line: 1493
> 
> 
> Unfortunately, checkResources just deleted the base directory.  The
> ClassLoader is looking for
> /WEB-INF/classes/com/avadyne/ThisClassNotFound.class, but that path no
> longer exists.  Most of the functions in the stack return null,
> and findClassInternal(String) throws the ClassNotFoundError at line 906.
> 
> OK, how should this be fixed?

It isn't clear (yet) that there is a problem.

> Should the ClassLoader fall back to the
> compressed WAR?  Should the DocBase be deleted after the context is stopped?

The subject uses "unload". That concept is not one used in the Tomcat
docs or code.

You stated in your first message that autoDeploy was disabled.

It isn't clear what the "unload" is, what is triggering it and what
changes (if any) you have made to either the WAR or the exploded
directory. Some details on what is triggering this issue would go a long
way to helping figuring out what is going on and if there is a bug here
or not.

Mark

> 
> On Sun, Mar 22, 2015 at 2:26 PM, Austin Jones <a...@avadynehealth.com> wrote:
> 
>> I was able to reproduce the issue in a simple testcase application:
>> https://github.com/austinjones/ClassNotFoundGenerator/
>>
>> On Sun, Mar 22, 2015 at 1:45 PM, Austin Jones <a...@avadynehealth.com>
>> wrote:
>>
>>> I put 8.0.20 on a testing machine, and saw the same issue.
>>>
>>> On Sun, Mar 22, 2015 at 12:15 PM, Christopher Schultz <
>>> ch...@christopherschultz.net> wrote:
>>>
> Austin,
> 
> On 3/21/15 6:19 PM, Austin Jones wrote:
>>>>>> I'm having an issue with Tomcat 8.0.12 when undeploying contexts.
>>>>>> I have autoDeploy turned off, and am pushing WARs+context.xmls
>>>>>> through the Tomcat manager's deploy command.
>>>>>>
>>>>>> I have several ServletContextListeners that handle proper context
>>>>>> shutdown.  The ones that cause the issue look like this:
>>>>>>
>>>>>> @Override public synchronized void contextInitialized(
>>>>>> ServletContextEvent event ) { if( enabled ) {
>>>>>> MyClass.initialize(); } }
>>>>>>
>>>>>> @Override public synchronized void contextDestroyed(
>>>>>> ServletContextEvent event ) { MyClass.release(); }
>>>>>>
>>>>>> If the 'enabled' flag is not set, and MyClass was not loaded
>>>>>> anywhere else in the app, the webapp ClassLoader tries to load the
>>>>>> class while the context is shutting down.  It throws this
>>>>>> exception: java.lang.NoClassDefFoundError: some/package/MyClass at
>>>>>> some.package.MyListener.contextDestroyed(SingletonCleaner.java:na)
>>>>>> at
>>>>>>
> org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4792)
>>>>>>
>>>>>>
> at
>>>>>>
> org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5392)
>>>>>>
>>>>>>
> at
>>>>>> org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
>>>>>>
>>>>>>
> at
>>>>>>
> org.apache.catalina.core.StandardContext.reload(StandardContext.java:3768)
>>>>>>
>>>>>>
> at
>>>>>> org.apache.catalina.startup.HostConfig.reload(HostConfig.java:1306)
>>>>>>
>>>>>>
> at
>>>>>>
> org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1238)
>>>>>>
>>>>>>
> at
>>>>>> org.apache.catalina.startup.HostConfig.check(HostConfig.java:1493)
>>>>>> at sun.reflect.GeneratedMethodAccessor574.invoke(Unknown Source)
>>>>>> at
>>>>>>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>>>
>>>>>>
> at java.lang.reflect.Method.invoke(Method.java:483)
>>>>>> at
>>>>>>
> org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
>>>>>>
>>>>>>
> at
>>>>>>
> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
>>>>>>
>>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>>>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>>>
>>>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to