I am trying to deploy WAR from Jenkins to tomcat6.0.39 server using shell command but it is unable to deploy and throwing Authorization error:
401 Unauthorized
You are not authorized to view this page. If you have not changed any configuration files, please examine the file conf/tomcat-users.xml in your installation. That file must contain the credentials to let you use this webapp.
Following is my shell command:
curl -T $WORKSPACE/target/myapp-1.0-RC1.war 'http://serverIP:8080/manager/deploy?update=true&path=/myapp'-u username:password
However the above command works fine with my tomcat 6.0.24. I did define tomcat user role as manager-gui and manager-script and manager-jmx as per tomcat documentation that Tomcat 6.0.30 onwards, the roles required to use the manager application were changed from the single manager role to the following four roles.
- manager-gui
- manager-script
- manager-jmx
- manager-status
Following is my tomcat-users.xml content:
<tomcat-users>
<user username="managergui" password="tomcatManager" roles="manager-gui"/>
<user username="manager" password="tomcatManager" roles="manager-script"/>
Whats wrong I am doing in tomcat-users.xml or in my shell command which is leading to Authorization exception.
Don't "copy" the war with a curl command. Deploy the application with Jenkins Deploy plugin it will simplify your process.