jithin ks
jithin ks

Reputation: 1

maven tomcat deployment producing error

I wanted to deploy my java webapp into my tomcat server using tomcat7:deploy goal. But i am getting following error

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

the following line i tried on my browser manually and was producing error

FAIL - Invalid parameters supplied for command [/deploy]

http://localhost:8080/manager/text/deploy?path=%2FCounterWebApp

but when i specify along with war file as below it successfully works in browser.

http://localhost:8080/manager/text/deploy?path=%2FCounterWebApp&war=file:F:\documents\repositories\webcounter\target\CounterWebApp.war

so is it be like tomcat7-maven-plugin making a mistake? if it is how will i fix it or is there a mistake i made somewhere?

below is the plugin tag i gave in pom file

<plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <path>/${project.build.finalName}</path>
                </configuration>
            </plugin>

below is the xml file users i created for tomcat-users.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"/>

below is the one i included in maven settings.xml

<server>
<id>mytomcat</id>
<username>test</username>
<password>test</password>
</server>

Upvotes: 0

Views: 2522

Answers (2)

DrHopfen
DrHopfen

Reputation: 847

It might be an issue that there is already a deployment under that context as pointed out in this answer.

Upvotes: 0

mirindar
mirindar

Reputation: 11

in ${TOMCAT_HOME}/conf/Catalina/localhost/manager.xml

Remove the comment markers from around the Valve

<!--
    <Valve className="org.apache.catalina.valves.RemoteAddrValve"
    allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
    -->
to

 <Valve className="org.apache.catalina.valves.RemoteAddrValve"
    allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />

then access http://127.0.0.1/manager/html, you will look manager page

Upvotes: 1

Related Questions