Following answers don't cover all possible reasons but probably they will hep you.
Server returned HTTP response code: 403
I don't know when it happens but Tomcat change format of manager url. At least in my 7.0 it should be not http://localhost:8080/managerbut
http://localhost:8080/manager/textPlease review documentation for your tomcat manager. In my case it was described at http://localhost:8080/docs/manager-howto.html#Supported_Manager_Commands
My file pom.xml is:
<project...> ... <build> ... <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>tomcat-maven-plugin</artifactId> <configuration> <server>myTomcatServer</server> <url>http://localhost:8080/manager/text</url> </configuration> </plugin> </plugins> </build> </project>
Server returned HTTP response code: 401
The same as above there are some changes in Tomcat 7.0. For grant access to manager user we should not write in $CATALINA_BASE/conf/tomcat-users.xml<role rolename="manager"/> <user username="username1" password="password1" roles="manager"/>how it was before, but
<user name="username1" password="password1" roles="standard,manager-script,manager-gui" />Please review your tomcat manager documentation (http://localhost:8080/docs/manager-howto.html#Configuring_Manager_Application_Access in my case). Roles are predefined. You need to grant "manager-script" for use manager with maven and "manager-gui" for GUI interface.
We also have to copy user name and password in our maven settings file (~/.m2/settings.xml by default):
<settings...> ... <servers> <server> <id>myTomcatServer</id> <username>username1</username> <password>password1</password> </server> </servers> </settings>please note "server" element should be child of "servers". In some articles it is not clear enough. id is the same as in pom.xml.
This is all. For test we can start list command:
$mvn tomcat:list .... [INFO] Listing applications at http://localhost:8080/manager/text [INFO] OK - Listed applications for virtual host localhost [INFO] /:running:0:ROOT [INFO] /manager:running:8:manager [INFO] /docs:running:0:docs [INFO] /examples:running:0:examples [INFO] /host-manager:running:0:host-manager [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ ....Other goals can be found in "tomcat:help". I left here only most interesting.
$mvn tomcat:help .... This plugin has 19 goals: tomcat:deploy Deploy a WAR to Tomcat. .... tomcat:redeploy Redeploy a WAR in Tomcat. Deploy with forcing update flag to true .... tomcat:run Runs the current project as a dynamic web application using an embedded Tomcat server. ....
No comments:
Post a Comment