【发布时间】:2011-11-17 00:50:48
【问题描述】:
我正在尝试在提到的 tomcat 应用服务器上部署 WAR。但是,以下是我尝试使用 tomcat 管理器/ant 脚本进行部署时遇到的错误。
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 [/]
WAR 包含 spring beans、HTML 页面、js、图像、css 等。我们目前正在通过将解压缩的项目直接复制到 tomcat 服务器上的 webapps 文件夹中来部署项目,这可以正常工作。但是,我们想使用开发的 ant 脚本来部署 war 文件到远程 tomcat。
开发是在windows平台上完成的,但是tomcat服务器驻留在Linux(Oracle Enterprise Linux)上
按如下方式进行部署的代码段:
<!-- 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>
我们将不胜感激。如果需要更多信息,请告诉我。
谢谢,
嘘
【问题讨论】:
-
ant 脚本有错误,你能把目标的 sn-p 贴出来做实际部署吗?
-
@shinynewbike 我已经用 sn-p 更新了我的帖子。
-
不,这似乎是您之前问题中的 JVM 错误
-
@shinynewbike:当你说 JVM 问题时?我们如何解决这个问题?升级到另一个版本?我们如何解决这个问题。请提供一些细节。
-
您可以尝试升级到 Tomcat 7 - JVM 错误必须由 Oracle 修复,因此解决的速度并不快