Maven tomcat部署失败(由对等方重置连接)

时间:2017-07-31 15:34:38

标签: maven tomcat maven-tomcat-plugin

我能够使用webapp将我的WAR文件部署到tomcat管理器,但是当我尝试使用maven插件(tomcat7:deploy)时,上传在几秒钟(~3兆字节)后出现此错误:

  

[错误]无法执行目标   org.apache.tomcat.maven:tomcat7-maven-plugin:2.0:deploy(default-cli)   在项目edgemagic-ws上:无法调用Tomcat管理器:Connection   由peer重置:套接字写错误 - > [帮助1]

     

org.apache.maven.lifecycle.LifecycleExecutionException:失败   执行目标org.apache.tomcat.maven:tomcat7-maven-plugin:2.0:deploy   项目edgemagic-ws上的(default-cli):无法调用Tomcat管理器     在   org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)     在   org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)     在   org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)     在   org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)     在   org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)     在   org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)     在   org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)     在org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)at at   org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)at at   org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)at   org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)at at   org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)at at   org.apache.maven.cli.MavenCli.main(MavenCli.java:199)at at   sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     在   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     在java.lang.reflect.Method.invoke(Method.java:497)at   org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)     在   org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)     在   org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)     在   org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

     

引起:org.apache.maven.plugin.MojoExecutionException:不能   调用Tomcat经理   org.apache.tomcat.maven.plugin.tomcat7.AbstractCatalinaMojo.execute(AbstractCatalinaMojo.java:141)     在   org.apache.tomcat.maven.plugin.tomcat7.AbstractWarCatalinaMojo.execute(AbstractWarCatalinaMojo.java:68)     在   org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)     在   org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)     ... 20更多引起:java.net.SocketException:连接重置   peer:socket写入错误   java.net.SocketOutputStream.socketWrite0(Native Method)at   java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)     在java.net.SocketOutputStream.write(SocketOutputStream.java:153)at   org.apache.http.impl.io.AbstractSessionOutputBuffer.write(AbstractSessionOutputBuffer.java:163)     在   org.apache.http.impl.io.ContentLengthOutputStream.write(ContentLengthOutputStream.java:119)     在   org.apache.tomcat.maven.common.deployer.TomcatManager $ RequestEntityImplementation.writeTo(TomcatManager.java:856)     在   org.apache.http.entity.HttpEntityWrapper.writeTo(HttpEntityWrapper.java:98)     在   org.apache.http.impl.client.EntityEnclosingRequestWrapper $ EntityWrapper.writeTo(EntityEnclosingRequestWrapper.java:108)     在   org.apache.http.impl.entity.EntitySerializer.serialize(EntitySerializer.java:122)     在   org.apache.http.impl.AbstractHttpClientConnection.sendRequestEntity(AbstractHttpClientConnection.java:266)     在   org.apache.http.impl.conn.ManagedClientConnectionImpl.sendRequestEntity(ManagedClientConnectionImpl.java:197)     在   org.apache.http.protocol.HttpRequestExecutor.doSendRequest(HttpRequestExecutor.java:257)     在   org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)     在   org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:708)     在   org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:515)     在   org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:923)     在   org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:822)     在   org.apache.tomcat.maven.common.deployer.TomcatManager.invoke(TomcatManager.java:721)     在   org.apache.tomcat.maven.common.deployer.TomcatManager.deployImpl(TomcatManager.java:684)     在   org.apache.tomcat.maven.common.deployer.TomcatManager.deploy(TomcatManager.java:367)     在   org.apache.tomcat.maven.plugin.tomcat7.deploy.AbstractDeployWarMojo.deployWar(AbstractDeployWarMojo.java:85)     在   org.apache.tomcat.maven.plugin.tomcat7.deploy.AbstractDeployMojo.invokeManager(AbstractDeployMojo.java:81)     在   org.apache.tomcat.maven.plugin.tomcat7.AbstractCatalinaMojo.execute(AbstractCatalinaMojo.java:132)     ......还有23个

POM的相关位如下:

                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <configuration>
                    <url>http://localhost:8080/manager/text</url>
                    <server>TomcatServer</server>
                    <update>true</update>
                </configuration>

将TomcatServer在maven conf / settings.xml中定义为:

    <server>
        <id>TomcatServer</id>
        <username>admin</username>
        <password>password</password>
    </server>

可能导致连接重置的原因是什么?我增加了conf / server.xml中的超时,这没有任何帮助。

1 个答案:

答案 0 :(得分:0)

maven设置首选项指向错误的位置(它们可以在eclipse中更改:window - &gt; preferences - &gt; maven - &gt; User Settings)。我的默认值为/.m2/settings.xml,但并不存在。使用重新部署目标而不是部署也有助于澄清上传实际上是否立即失败。