gpt4 book ai didi

maven - 无法调用 Tomcat 管理器 : Software caused connection abort

转载 作者:行者123 更新时间:2023-11-28 21:50:17 29 4
gpt4 key购买 nike

我在多个位置看到了除我以外的人尝试过 this link 中提供的所有解决方案的地方,在浏览了 Google 上的每一页结果后,我都没有找到结果。我正在尝试将 Maven 项目部署到 Tomcat,但我得到以下打印输出:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.178 s
[INFO] Finished at: 2016-08-03T15:01:17-04:00
[INFO] Final Memory: 15M/105M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project Project_2: Cannot invoke Tomcat manager: Software caused connection abort: 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

两者

mvn tomcat7:deploy

mvn tomcat7:redeploy

导致同样的错误。

pom.xml

<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<server>tomcat7</server>
<path>/Project_2</path>
<port>8085</port>
<url>http://localhost:8085/manager/text</url>
<update>true</update>
<username>manager</username>
<password>xxxx</password>
</configuration>
</plugin>

tomcat-用户.xml

<role rolename="manager-script"/>
<role rolename="manager-gui"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="admin-gui"/>
<user username="admin1" password="xxxx" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-gui" />
<user username="manager" password="xxxx" roles="manager-script,admin-script" />

settings.xml(在 maven home 和 .m2 文件夹中)

<server>
<id>tomcat7</id>
<username>manager</username>
<password>xxxx</password>
</server>

我知道我的 Tomcat 版本是 8,但是,根据 Borgy Manotoy ,Tomcat7 插件将适用于 Tomcat 8。

最佳答案

同样的问题,通过 Maven settings.xml 中的正确凭证解决。是的,此错误消息具有误导性:

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project projectXXX: Cannot invoke Tomcat manager
...
Caused by: org.apache.maven.plugin.MojoExecutionException: Cannot invoke Tomcat manager
...
Caused by: java.net.SocketException: Connection reset by peer: socket write error

我们在 pom.xml 中使用配置文件,因此:

<profile>
<id>stage_server</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<tomcat-server>stage-server</tomcat-server>
<tomcat-url>http://stage.server.com/manager/text</tomcat-url>
</properties>
</profile>

并设置maven“Tomcat插件”:

<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>${tomcat-url}</url>
<server>${tomcat-server}</server>
<update>true</update>
</configuration>
</plugin>

最后是 Maven/conf 中的 settings.xml:

<server>
<id>stage-server</id>
<username>admin</username>
<password>xxxxx</password>
</server>

部署:

   mvn tomcat7:deploy -Pstage_server

关于maven - 无法调用 Tomcat 管理器 : Software caused connection abort,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38752373/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com