【问题标题】:Deployment error on Apache Tomcat/6.0.24Apache Tomcat/6.0.24 上的部署错误
【发布时间】: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 修复,因此解决的速度并不快

标签: java spring tomcat war


【解决方案1】:

我在 Tomcat 5.5.34 上遇到了同样的问题。我使用 Ant 构建 WAR,WAR 目标包含以下任务:

该前缀导致war包中出现名为“/”的jar条目,并且从Tomcat 5.5.26开始,该条目在Tomcat容器启动期间导致异常。

将war命令的prefix属性值改为 解决了我所有的问题。

最好的问候, 克里斯

【讨论】:

  • 你说的是哪个前缀属性?
  • 问题已修复。原因是前缀 /WEB-INF/classes。删除了 WEB-INF 前面的“/”。经过多年终于解决了这个问题。
【解决方案2】:

请避免同时使用 out 和 getOutputStream !

【讨论】:

  • 您能说得更具体些吗?您是否正在考虑在 jsp 中使用 out.print ?我在这个项目中没有jsp页面。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-01-07
  • 2012-01-04
  • 2011-12-28
  • 2014-09-06
相关资源
最近更新 更多