Tomca7热部署问题:Connection reset by peer: socket write error

1 篇文章 0 订阅
1 篇文章 0 订阅

问题描述:

最近学习热部署问题时,遇到如下问题,搞了大半天。后来因为拼写错误。不过还是有必要提醒此处有个坑。报错:
[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset by peer: socket write error

错误代码如下:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building ProjectName-rest 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> tomcat7-maven-plugin:2.2:redeploy (default-cli) > package @ ProjectName-rest >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ ProjectName-rest ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 9 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ ProjectName-rest ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.7:testResources (default-testResources) @ ProjectName-rest ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.2:testCompile (default-testCompile) @ ProjectName-rest ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ ProjectName-rest ---
[INFO] Tests are skipped.
[INFO] 
[INFO] --- maven-war-plugin:2.2:war (default-war) @ ProjectName-rest ---
[INFO] Packaging webapp
[INFO] Assembling webapp [ProjectName-rest] in [D:\Temp\template\ProjectName-rest\target\ProjectName-rest]
[INFO] Processing war project
[INFO] Copying webapp resources [D:\Temp\template\ProjectName-rest\src\main\webapp]
[INFO] Webapp assembled in [219 msecs]
[INFO] Building war: D:\Temp\template\ProjectName-rest\target\ProjectName-rest.war
[INFO] WEB-INF\web.xml already added, skipping
[INFO] 
[INFO] <<< tomcat7-maven-plugin:2.2:redeploy (default-cli) < package @ ProjectName-rest <<<
[INFO] 
[INFO] --- tomcat7-maven-plugin:2.2:redeploy (default-cli) @ ProjectName-rest ---
[INFO] Deploying war to http://192.168.15.133:8080/  
Uploading: http://192.168.15.133:8080/manager/test//deploy?path=%2F&update=true

[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset by peer: socket write error
[INFO] Retrying request
Uploading: http://192.168.15.133:8080/manager/test//deploy?path=%2F&update=true

[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset by peer: socket write error
[INFO] Retrying request
Uploading: http://192.168.15.133:8080/manager/test//deploy?path=%2F&update=true

[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset by peer: socket write error
[INFO] Retrying request
Uploading: http://192.168.15.133:8080/manager/test//deploy?path=%2F&update=true

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.245 s
[INFO] Finished at: 2017-09-23T14:11:13+08:00
[INFO] Final Memory: 13M/32M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:redeploy (default-cli) on project ProjectName-rest: Cannot invoke Tomcat manager: Connection reset by peer: socket write error -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Tomcat7插件URL中应该加上/text/

如下所示:

部署命令:tomcat7:deploy for rdeploying:tomcat7:redeploy

  • 配置Tomcat7插件 在 pom.xml
       <plugin>
            <!-- tomcat deploy plugin -->
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <url>http://localhost:8080/manager/text</url>
                <server>TomcatServer</server>
                <username>XXXX</username>
                <password>XXXX</password>
                <path>/XXXX</path>
            </configuration>
        </plugin>
  • tomcat-user.xml 配置
   <role rolename="tomcat" />
   <role rolename="manager-gui" />
   <role rolename="manager-script" />
   <user username="tomcat" password="tomcatuser"
    roles="tomcat,manager-gui,manager-script" />

注意:我也测试了与Tomcat 8相同的设置。所以这个设置可以适用于这两个版本。

已知的限制

tomcat7 mojo还没有一些目标。这些容器目标可以与tomcat6 mojo一起使用,您只需要更新您的pom中的管理器URL。
使用http: //localhost:8080/manager/text而不是默认的tomcat6 url。


相关资料:

StackOverflow
Apache Tomcat Maven Plugin

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值