1
votes

I am trying to deploy a WAR on the mentioned tomcat application server. However following is the error that I get when I try to use the tomcat manager / ant script for deployment.

java.lang.IllegalStateException: ContainerBase.addChild: start: LifecycleException:  Error initializaing :  java.lang.IllegalArgumentException: The archive [jar:file:/var/lib/tomcat6/webapps/afgretail.war!/] is malformed and will be ignored: an entry contains an illegal path [/]

The WAR contains spring beans, HTML pages, js, images, css etc. We are currently deploying the project by coping the unzipped project directly into the webapps folder on the tomcat server which works fine. However we would like to deploy using the ant script developed to deploy war file to a remote tomcat.

The development was done on windows platform but the tomcat server resides on Linux (Oracle Enterprise Linux)

Snippet that does deployment as follows:

<!-- Configure the folder and context path for this application -->
<property name="webapp" value="walton" />
<property name="path" value="/walton" />

<!-- Configure properties to access the Manager application -->
<property name="url" value="http://localhost:8080/manager/html" />
<!-- <property name="url" value="http://osm4.afgonline.com.au:8080/manager/html" />-->
<property name="username" value="tomcat" />
<property name="password" value="s3cret" />

<property name="dist.dir" value="dist" />

<property name="webapp.path" value="${dist.dir}/${webapp}" />

<property name="project.path" value="C:/java/workspace/afghl_walton"/>

<path id="deployer.classpath">
    <!--fileset dir="${basedir}/lib"-->
    <fileset dir="C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\">
        <include name="*.jar" />
    </fileset>
</path>

<!-- Configure the custom Ant tasks for the Manager application -->
<taskdef resource="org/apache/catalina/ant/catalina.tasks"
    classpathref="deployer.classpath" />

<target name="deploy" description="Deploy web application">
    <deploy url="${url}" username="${username}" password="${password}"
        path="${path}" war="${project.path}/${webapp.path}.war" update="true" />
</target>

Any help will be apprrciated. If there is more information required please let me know.

Thanks,

Khush

2
there is a mistake in the ant script, can you post that snippet of the target doing the actual dpeloyment. - shinynewbike
@shinynewbike I have updated my post with the snippet. - Khush
nope this seems to be the JVM bug as in your previous question - shinynewbike
@shinynewbike : when you say JVM issue? How do we resolve this? Upgrade to another versiom? How do we solve this issue. Please provide me with some detail. - Khush
you could try moving up to Tomcat 7 - JVM bugs have to be fixed by Oracle, so not much quick resolution there - shinynewbike

2 Answers

1
votes

I had the same problem with Tomcat 5.5.34. I build the WAR with Ant and the WAR target contained the following task:

The prefix caused an jar entry named "/" in the war package and since Tomcat 5.5.26 that entry causes an exception during startup of the Tomcat container.

Changing the prefix attribute value of the war command to removed all my problems.

Best regards, Chris

0
votes

Just avoid using out and getOutputStream at the same time!