Bug 55958 - Tomcat tries to deploy dir as zip archive even when it is a directory if the name ends with .war
Tomcat tries to deploy dir as zip archive even when it is a directory if the ...
Status: RESOLVED FIXED
Product: Tomcat 7
Classification: Unclassified
Component: Catalina
7.0.47
PC Linux
: P2 normal (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2014-01-06 09:28 UTC by Radim Hatlapatka
Modified: 2014-01-09 14:15 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Radim Hatlapatka 2014-01-06 09:28:12 UTC
Webapp deployment fails if the dirname ends with .war because it is automatically considered as zip archive.
Comment 1 Christopher Schultz 2014-01-06 22:25:24 UTC
Stack trace? It looks like ContextConfig:627 in trunk might allow a directory to be treated as if it were a file.
Comment 2 Radim Hatlapatka 2014-01-07 08:20:58 UTC
This is the relevant output in catalina.out including the stacktrace

INFO: Deploying web application directory /home/rhatlapa/projects/redhat_projects/eap/eap63-development/apache-tomcat-7.0.47/webapps/byteslounge.war
Jan 06, 2014 10:08:48 AM org.apache.catalina.startup.ContextConfig init
SEVERE: Exception fixing docBase for context [/byteslounge]
java.io.FileNotFoundException: /home/rhatlapa/projects/redhat_projects/eap/eap63-development/apache-tomcat-7.0.47/webapps/byteslounge.war (Is a directory)
  at java.util.zip.ZipFile.open(Native Method)
  at java.util.zip.ZipFile.<init>(ZipFile.java:215)
  at java.util.zip.ZipFile.<init>(ZipFile.java:145)
  at java.util.jar.JarFile.<init>(JarFile.java:153)
  at java.util.jar.JarFile.<init>(JarFile.java:90)
  at sun.net.www.protocol.jar.URLJarFile.<init>(URLJarFile.java:93)
  at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:69)
  at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:99)
  at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:122)
  at sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:89)
  at org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:113)
  at org.apache.catalina.startup.ContextConfig.fixDocBase(ContextConfig.java:741)
  at org.apache.catalina.startup.ContextConfig.init(ContextConfig.java:843)
  at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:387)
  at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
  at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
  at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402)
  at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:110)
  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
  at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
  at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
  at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
  at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1120)
  at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1678)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
  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:744)

Jan 06, 2014 10:08:48 AM org.apache.catalina.core.StandardContext resourcesStart
SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Document base /home/rhatlapa/projects/redhat_projects/eap/eap63-development/apache-tomcat-7.0.47/webapps/byteslounge does not exist or is not a readable directory
  at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:138)
  at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:5055)
  at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5235)
  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
  at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
  at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
  at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1120)
  at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1678)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
  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:744)
Comment 3 Christopher Schultz 2014-01-07 18:18:30 UTC
So you have a directory named "/home/rhatlapa/projects/redhat_projects/eap/eap63-development/apache-tomcat-7.0.47/webapps/byteslounge.war"? What else is in your "/home/rhatlapa/projects/redhat_projects/eap/eap63-development/apache-tomcat-7.0.47/webapps/" directory before you try to start Tomcat?
Comment 4 Radim Hatlapatka 2014-01-07 18:35:21 UTC
Yes, that is right, I have the directory named byteslounge.war, if I remove .war from the name => by renaming it to byteslounge it works just fine.

The rest of webapps in the webapps directory are only the default ones which are in clean tomact installation.

The only issue is that if you decide to name the webapp with suffix .war it is automatically treated as zip file instead of being treated as directory.
Comment 5 Mark Thomas 2014-01-09 14:15:19 UTC
I don't recommend doing it but Tomcat 8 as of 8.0.0 and Tomcat 7 as of 7.0.51 will let you deploy a directory named foo.war which will have a context path of /foo.war