Java Tomcat 7:对等方或软件重置连接导致连接中止
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26356477/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Tomcat 7: Connection reset by peer or Software caused connection abort
提问by bin-bin
I have a problem when I'm trying to deploy Java-application.
我在尝试部署 Java 应用程序时遇到问题。
Cannot invoke Tomcat manager: Connection reset by peer: socket write error
or
或者
Cannot invoke Tomcat manager: Software caused connection abort: socket write error
In pom.xmlI have this:
在pom.xml我有这个:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://localhost:8085/manager/html</url>
<server>tomcat7</server>
<path>/java_web</path>
<username>admin</username>
<password>admin</password>
</configuration>
</plugin>
In tomcat-users.xmlI have this:
在tomcat-users.xml我有这个:
<tomcat-users>
<role rolename="admin"/>
<role rolename="manager-script"/>
<role rolename="manager-gui"/>
<role rolename="manager-jmx"/>
<user username="admin" password="admin" roles="manager-gui,admin,manager-jmx,manager-script" />
</tomcat-users>
Also in Maven/conf/settings.xmlI have:
同样在Maven/conf/settings.xml我有:
<server>
<id>tomcat7</id>
<username>admin</username>
<password>admin</password>
</server>
When I'm trying to go to
当我试图去
http://localhost:8085/manager/html/deploy?path=%2Fjava_web&update=true
and input username and password (admin admin) I have error:
并输入用户名和密码(admin admin)我有错误:
403 Access Denied
You are not authorized to view this page.
But I typed in tomcat-users.xmlthat user admin has manager-gui role. I'm using Tomcat 7.0.56 and Jenkins. Also use commands: clean and tomcat7-redeploy. Need help to understand what is wrong:C
但是我在tomcat-users.xml中输入了用户 admin 具有 manager-gui 角色。我正在使用 Tomcat 7.0.56 和 Jenkins。还可以使用命令:clean 和 tomcat7-redeploy。需要帮助来理解什么是错的:C
采纳答案by Alexey Lagunov
In my case settings looked ok, but I already had the same webapp uploaded to tomcat and hadn't specified
在我的情况下,设置看起来不错,但我已经将相同的 webapp 上传到了 tomcat 并且没有指定
<update>true</update>
in tomcat plugin in pom.xml
在 pom.xml 中的 tomcat 插件中
回答by tiger
Users with the manager-gui role should not be granted either the manager-script or manager-jmx roles.
不应授予具有 manager-gui 角色的用户 manager-script 或 manager-jmx 角色。
so,user admin should remove the role "manager-gui"
所以,用户管理员应该删除角色“manager-gui”
回答by bin-bin
I added
我加了
<server>
<id>tomcat7</id>
<username>admin</username>
<password>admin</password>
</server>
in user/.m2/settings.xml
在用户/.m2/settings.xml
Also I didn't change pom.xml, tomcat-users.xml and Maven/conf/settings.xml and now all works fine.
此外,我没有更改 pom.xml、tomcat-users.xml 和 Maven/conf/settings.xml,现在一切正常。
回答by jbdundas
<plugin>
<!-- tomcat deploy plugin -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>TomcatServer</server>
<username>XXXX</username>
<password>XXXX</password>
<path>/XXXX</path>
</configuration>
</plugin>
This works for me :)
这对我有用:)
Environment -> Windowd 8.1 + Maven 3 + Tomcat 8.1.15 + JDK 1.8 Also, I had to use tomcat:redeploy
环境 -> Windowd 8.1 + Maven 3 + Tomcat 8.1.15 + JDK 1.8 另外,我不得不使用 tomcat:redeploy
ALso, update your maven settings via -> Preferences->Maven->User Settings to point to your maven settings.xml file. Add the values of the server in the maven settings.xml ( servers section and add the tomcat server details there). Use that here( for me the id is TomcatServer )
此外,通过 -> Preferences->Maven->User Settings 更新您的 maven 设置以指向您的 maven settings.xml 文件。在 maven settings.xml(服务器部分并在那里添加 tomcat 服务器详细信息)中添加服务器的值。在这里使用它(对我来说,id 是 TomcatServer )
Some of the steps were taken from here:- http://kosalads.blogspot.de/2014/03/maven-deploy-war-in-tomcat-7.html
一些步骤是从这里采取的:- http://kosalads.blogspot.de/2014/03/maven-deploy-war-in-tomcat-7.html
回答by Melody Feng
mvn tomcat7:redeploy
try this as documentationsuggests:
按照文档建议尝试此操作:
(Alias for the deploy goal with its update parameter set to true.)
(部署目标的别名,其更新参数设置为 true。)