我想使用tomcat7:deploy目标将我的java webapp部署到我的tomcat服务器中。但我得到以下错误
enter code[INFO] Deploying war to http://localhost:8080/CounterWebApp
Uploading: http://localhost:8080/manager/text/deploy?path=%2FCounterWebApp
2500/5423 KB
[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset by peer: socket write error
[INFO] Retrying request
Uploading: http://localhost:8080/manager/text/deploy?path=%2FCounterWebApp
2436/5423 KB
[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset by peer: socket write error
[INFO] Retrying request
Uploading: http://localhost:8080/manager/text/deploy?path=%2FCounterWebApp
2500/5423 KB
[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset by peer: socket write error
[INFO] Retrying request
Uploading: http://localhost:8080/manager/text/deploy?path=%2FCounterWebApp
2436/5423 KB
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.588 s
[INFO] Finished at: 2016-12-21T10:42:39+05:30
[INFO] Final Memory: 18M/158M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project CounterWebApp: 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 here
以下这一行我在我的浏览器上手动尝试并产生错误
FAIL - 为命令[/ deploy]
提供的参数无效
http://localhost:8080/manager/text/deploy?path=%2FCounterWebApp
但是当我指定war文件时,如下所示它在浏览器中成功运行。
http://localhost:8080/manager/text/deploy?path=%2FCounterWebApp&war=file:F:\documents\repositories\webcounter\target\CounterWebApp.war
这就像是tomcat7-maven-plugin犯了错误?如果它是我将如何解决它或我在某处犯了错误?
下面是我在pom文件中提供的插件标签
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<path>/${project.build.finalName}</path>
</configuration>
</plugin>
下面是我为tomcat-users.xml创建的xml文件用户
role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<user username="test" password="test" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-gui,admin-script"/>
下面的是我在maven settings.xml中包含的那个
<server>
<id>mytomcat</id>
<username>test</username>
<password>test</password>
</server>
答案 0 :(得分:1)
in $ {TOMCAT_HOME} /conf/Catalina/localhost/manager.xml
从Valve周围删除注释标记
<!--
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
-->
&#13;
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
&#13;
然后访问http://127.0.0.1/manager/html,您将看到经理页面
答案 1 :(得分:0)
可能存在一个问题,就是在这个背景下已经有了一个部署,如本答案所指出:https://stackoverflow.com/a/35830351/6825678
很抱歉发布这个作为答案,但我的声誉不允许我作为评论夸耀......