Ant:" IOException:将请求主体写入服务器"部署到tomcat

时间:2015-06-24 08:48:17

标签: java tomcat deployment ant bamboo

我是StackExchange的新手,所以请忍受我最终的错误......

我一直在寻找答案,但似乎没有一个适用于我的情况,即构建和部署实际上有效,但结果是在部署调用结束时出现IOException。

我正在使用ant构建一个部署脚本。部署部分正在使用此taskdef:

<taskdef name="tomcatdeploy" classname="org.apache.catalina.ant.DeployTask" />
<target name="-tomcatdeploy" description="deploy to tomcat">
    <echo>deploying from client</echo>
    <tomcatdeploy
            url="http://32.0.26.146:8080/manager/text"
            username="<veryHardToGuessUsername>"
            password="<veryHardToGuessPassword>"
            path="/avlsweb"
            war="/mnt/s/Web/Avlsweb/BambooBuilds/TEST/${nt-server.dir.test}_Tc${version}/avlsweb##${version}.war"
            version="${version}"
            />   

我们使用Bamboo作为构建服务器。这适用于许多构建。但是最近我遇到了这个构建错误:

/mnt/data/bamboo_home/xml-data/build-dir/AVTST-TEST15-JOB1/AvlswebScripts/Ant/build.xml:286: java.io.IOException: Error writing request body to server
at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:3192)
at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:3175)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:122)
at org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.java:242)
at org.apache.catalina.ant.DeployTask.execute(DeployTask.java:195)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:440)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

奇怪的是构建工作并且它也可以很好地部署到tomcat。但是,由于某种原因,部署后发生IOException导致&#34; red&#34; Bamboo中的构建消息失败。另外几条评论:

  • Tomcat经理脚本用户已设置
  • 使用ant的Bamboo构建服务器与目标tomcat应用程序服务器在同一服务器上运行,但是竹子和目标tomcat在不同的端口上作为单独的服务器运行。
  • 构建服务器:Atlassian Bamboo 5.9.0
  • Ant版本:1.9.2
  • Tomcat版本:8.0.15
  • Java版本:1.7.0_67

有什么想法吗?

2 个答案:

答案 0 :(得分:3)

我认为我很慢,我遇到了同样的问题

tomcatdeploy任务中

而不是war使其成为localWar

答案 1 :(得分:2)

如果已将实例部署到Tomcat服务器,则会出现此错误。您可以在var allCards = [[String]]() var exp1 = [String]() if !allCards.contains( { $0 == exp1 } ) { allCards.append(exp1) }

中设置update="true"
tomcatdeploy

另一种选择是显式取消部署然后重新部署,或使用<tomcatdeploy url="http://32.0.26.146:8080/manager/text" username="<veryHardToGuessUsername>" password="<veryHardToGuessPassword>" path="/avlsweb" war="/mnt/s/Web/Avlsweb/BambooBuilds/TEST/${nt-server.dir.test}_Tc${version}/avlsweb##${version}.war" version="${version}" update="true" /> 标记而不是部署标记。