In the deployment process of Maven and Tomcat, the most common errors are three, tossing for half a day, finally found the cause of three kinds of errors, and the corresponding perfect solution
1. Connection refused error
The error message is as follows:
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.0-snapshot:deploy (default-cli) on Pro Ject Helloworld:cannot invoke Tomcat manager:connection refused:connect [Help 1]
Cause: The tomcat server is not started
Workaround: First start the Tomcat server and select Run
2.401 Error
The error message is as follows:
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.0-snapshot:deploy (defaultfor url:http://Localhost:8080/manager/text/deploy?path=%2fhelloworld [Help 1]
Cause: Permission Issues
Solution in $catalina_base/conf/tomcat-users.xml,
Add permissions like the D:\apache-tomcat-7.0.34\conf\tomcat-users.xml file
<rolename= "Manager"/><user usernamepassword roles= "Manager"/>
Modify the Pom.xml file and add it in <configuration> </configuration>
< username >admin</username> <password> Admin</password>
3.403 Error
The error message is as follows:
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.0-snapshot:deploy (defaultfor url:http://Localhost:8080/manager/html/deploy?path=%2fhelloworld [Help 1]
Cause: The problem is likely to occur for two reasons, see the solution specifically
Workaround:
1) If you are using Tomcat 7, you need to modify the URL address of the deployment in Pom.xml, and change <url>http://localhost:8080/manager</url> to <url>http:// Localhost:8080/manager/text</url>
2) to the Tomcat user rights assignment, need to have both Manager-gui and Manager-script permissions, I encountered this problem, is to forget to assign Manager-script permissions.
The correct conf/tomcat-users.xml configuration should be:
<tomcat-users><rolerolename= "Manager-gui"/><rolerolename= "Manager-script"/><Userusername= "Admin" password= "Admin "Roles= "Manager-gui, manager-script"/></tomcat-users>
MAVEN Automatic deployment Tomcat error exclusions