Bug 49978 - WebappLoader throws exception if workDir already exists (when unpackWARs=false)
Summary: WebappLoader throws exception if workDir already exists (when unpackWARs=false)
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: trunk
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-22 14:11 UTC by Jim Frederic
Modified: 2011-01-28 19:01 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jim Frederic 2010-09-22 14:11:28 UTC
In WebappLoader.setRepositories(), if the war is not unpacked, it tries to create a directory /WEB-INF/classes inside the workDir.  If that directory already exists, an error is thrown and the webapp does not start.

This is a change from 5.5, which didn't check the return value of classRepository.mkdirs().  mkdirs() returns false if the directories already exist.  I doubt it was the intention here.  Probably the intention was to throw an exception if the directory could not be created, rather than if it already existed.
Comment 1 Mark Thomas 2010-10-07 10:22:32 UTC
Fixed in trunk and will be in 7.0.4 onwards.
Comment 2 kristof batizy 2011-01-28 18:05:22 UTC
I am seeing this, or similar, on Windows XP (32 bit) 7.0.6 under the same conditions (unpackWars=false)

SEVERE: LifecycleException
java.io.IOException: Failed to copy resources
        at org.apache.catalina.loader.WebappLoader.setRepositories(WebappLoader.java:890)
        at org.apache.catalina.loader.WebappLoader.startInternal(WebappLoader.java:601)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4857)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:812)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:787)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:583)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:917)
        at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:715)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:469)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1294)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
        at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:343)
        at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:323)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1043)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:750)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1035)
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
        at org.apache.catalina.core.StandardService.startInternal(StandardService.java:442)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:674)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:600)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:303)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)
Comment 3 Mark Thomas 2011-01-28 19:01:31 UTC
Yep, there was another similar issue in the same area. Fixed in 7.0.x and will be in 7.0.7 onwards.