Tomcat 7: Connection reset by peer or Software caused connection abort

I have a problem when I'm trying to deploy Java-application.

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.xml I have this:

<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.xml I have this:

 <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.xml I have:

<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:

403 Access Denied
You are not authorized to view this page.

But I typed in tomcat-users.xml that 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

Answers


In my case settings looked ok, but I already had the same webapp uploaded to tomcat and hadn't specified

<update>true</update>

in tomcat plugin in pom.xml, thus maven couldn't upload new webapp on top of existing and running webapp.

So consider this.


I added

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

in user/.m2/settings.xml

Also I didn't change pom.xml, tomcat-users.xml and Maven/conf/settings.xml and now all works fine.


        <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

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 )

Some of the steps were taken from here:- http://kosalads.blogspot.de/2014/03/maven-deploy-war-in-tomcat-7.html


Users with the manager-gui role should not be granted either the manager-script or manager-jmx roles.

so,user admin should remove the role "manager-gui"


mvn tomcat7:redeploy

try this as documentation suggests:

(Alias for the deploy goal with its update parameter set to true.)


Need Your Help

Updating Commit Message in Mercurial MQ extension

version-control mercurial mercurial-queue

After using hg qnew and hg qrefresh to create and update a patch that I want to apply to my repository, but the commit message that I wrote when I did hg qnew was not very good, it did not referenc...