Bug 50737 - Error on .war deploy - archive malformed (on recent Tomcat releases) on IBM iSeries System i
Summary: Error on .war deploy - archive malformed (on recent Tomcat releases) on IBM i...
Status: RESOLVED INVALID
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 6.0.32
Hardware: Other other
: P2 normal (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-08 17:59 UTC by Jon E.
Modified: 2011-02-17 19:04 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jon E. 2011-02-08 17:59:01 UTC
On Tomcat 6.0.20 a .war file can be deployed just fine on an IBM iSeries (System i) at V6R1 of the OS.

After installing Tomcat 6.0.29 (and 6.0.30 and 6.0.32), .war files no longer deploy.  See the stack trace at the bottom of this post.

On a Windows/7 machine this error does not occur with these Tomcat releases.  On OS400 (i5/OS) this does not happen at 6.0.20.  This error only occurs on the iSeries at Tomcat version 6.0.29+ (it may have started to occur between 6.0.20 and 6.0.29).  Note that it is the same .war file that is being deployed to each of these environments.

              ---- Tomcat ----
              6.0.20    6.0.32
            +--------+---------+
IBM iSeries |  OK    |  ERROR  |
            +--------+---------|
Windows/7   |  OK    |   OK    |
            +------------------+

In troubleshooting, to make sure this is not an installation/configuration error the Tomcat 6.0.20 zip file was downloaded from the Apache site and re-installed on the iSeries.  The deploy works as before.  At 6.0.29, 6.0.30, and 6.0.32, the deploy produces the following error:


Feb 8, 2011 2:52:07 PM org.apache.juli.logging.DirectJDKLog error
SEVERE: ContainerBase.addChild: start: 
LifecycleException:  Error initializaing :  java.lang.IllegalArgumentException: The archive [jar:file:/apache/apache-tomcat-6.0.32/webapps/shopatron.war!/] is malformed and will be ignored: an entry contains an illegal path [META-INF/]
	at java.lang.Throwable.<init>(Throwable.java:181)
	at java.lang.Exception.<init>(Exception.java:29)
	at org.apache.catalina.LifecycleException.<init>(LifecycleException.java:80)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4450)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
	at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:943)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:563)
	at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1397)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:575)
	at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
	at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1500)
	at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:252)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:186)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
	at java.lang.Thread.run(Thread.java:619)
Feb 8, 2011 2:52:07 PM org.apache.juli.logging.DirectJDKLog error
SEVERE: Error deploying web application archive shopatron.war
java.lang.IllegalStateException: ContainerBase.addChild: start: LifecycleException:  Error initializaing :  java.lang.IllegalArgumentException: The archive [jar:file:/apache/apache-tomcat-6.0.32/webapps/shopatron.war!/] is malformed and will be ignored: an entry contains an illegal path [META-INF/]
	at java.lang.Throwable.<init>(Throwable.java:196)
	at java.lang.Exception.<init>(Exception.java:41)
	at java.lang.RuntimeException.<init>(RuntimeException.java:43)
	at java.lang.IllegalStateException.<init>(IllegalStateException.java:38)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:803)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
	at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:943)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:563)
	at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1397)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:575)
	at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
	at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1500)
	at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:252)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:186)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
	at java.lang.Thread.run(Thread.java:619)

=====

Let me know if I can do anything to help support this fix.
- Jon
Comment 1 Konstantin Kolinko 2011-02-09 01:16:00 UTC
That message is "expandWar.illegalPath" in org.apache.catalina.startup.ExpandWar. 

There are two places where it is checked there. Basically, it is 
if (!expandedFile.getCanonicalPath().startsWith( ))
check.

You will have to test what getCanonicalPath() returns for those paths on that server and why the test fails.
Comment 2 Mark Thomas 2011-02-11 10:43:31 UTC
This looks like a JVM bug at this point. I think the best we can do is add some debug logging to help track this down. If I add the looging to Tomcat 7, can you build Tomcat 7.0.x from svn and test?
Comment 3 Jon E. 2011-02-11 11:24:22 UTC
I modified the ExpandWar class to spit out the failed comparison values in the validate method right before the exception is thrown.  After stuffing the modified class back into the Catalina.jar and testing the deployment again, I could see  the problem appears to be with with case of the value of the root folder being returned by the getCononicalPath() method.

I am currently working with IBM support on this issue, and will post back once we have a definitive answer.  There is a theory as to the cause and we are in the process of verifying it.  I will definitely post back here when we have a solid answer.

btw - Konstantin's comment about the ExpandWar class really helped put me on the right track - thank you!
Comment 4 Jon E. 2011-02-11 14:51:27 UTC
The problem occurs when Tomcat (on the iSeries / System i / AS400) is started with a command line that has different case values than where the file system resides.

We configured the IBM System i to start Tomcat with the following QShell command:

qsh cmd('/Apache/apache-tomcat-6.0.32/bin/startup.sh')

Yet the real name where Tomcat resides is:

/apache/apache-tocmat-6.0.32/bin/startup.sh

Deployment fails when they are not equal, even though Tomcat is running.

In ExpandWar, when it compares the canonical paths, the expandedFile.getCononicalPath() value is the value that was used to start Tomcat, and the canonicalDocBasePrefix is set to the value of where the .jar file entries reside on the file system.

/Apache/apache-tomcat-6.0.32/bin/startup.sh != 
/apache/apache-tomcat-6.0.32/bin/startup.sh

Previously we were using Tomcat 6.0.20, which did not have this validation in class ExpandWar.  On hosts that do not have case sensitive file systems, should the path names all be resolved to lower case before this check?

WORK AROUND:  On our system, we changed the command string that starts Tomcat to be exactly the same, case-for-case, as the directory in which it resides.  When this is done, deployment works fine.

Thank you for your help.

- Jon
Comment 5 Mark Thomas 2011-02-17 19:04:58 UTC
That looks like a JVM bug. The canonical path should be be using the 'real' (lower case in your case) path.