The username you provided is not allowed to use text Tomcat Manager (error 403) when deploying to a remote Tomcat8 using Jenkins

I am trying to deploy WAR on a remote Tomcat (remote machine) using Jenkins deploy to container Plugin. I did the following configuration in tomcat-users.xml

<user username="deployer" password="deployer" roles="manager-gui,manager-script,admin" /> 

I set the correct user password and port in the Jenkins deployment container plugin. Setup works fine for local Tomcat. But for remote Tomcat, I keep getting the following error:

 Caused by: org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: The username you provided is not allowed to use the text-based Tomcat Manager (error 403) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:555) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.list(TomcatManager.java:686) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.getStatus(TomcatManager.java:699) at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:174) ... 16 more Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: http://1.203.190.5:8080/manager/text/list at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:544) ... 19 more 

Please, help.

+12
maven tomcat jenkins web-deployment
Jan 16 '17 at 11:52
source share
4 answers

This seems to be a Jenkins bug, but I ran into a problem installing the following configuration in Tomcat:

Edit the file / webapps / manager / META -INF / context.xml:

Previous:

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

Modify this file to comment on the value:

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

This solved the problem. Hope this helps someone :)

+20
Jan 17 '17 at 7:21
source share

I encountered the same problem when deploying an artifact to tomcat with jenkins via the container plugin. Solution: - I added the managers - script and manager-gui as a user and granted full access to the webapps / * directory. This helps me successfully deploy the artifact and view it using the application manager.

+5
May 16 '17 at 18:55
source share

If nothing works, just create another user in the tomcat-users.xml file with the magnager script role assigned and set this user identity to jenkins.

In the tomcat-users.xml file

 <tomcat-users> <user username="deployuser" password="deployuser" roles="manager-script" /> <user username="admin" password="admin" roles="manager-gui" /> </tomcat-users> 

deploying to tomcat from jenkins

+1
Jan 23 '19 at 5:57
source share

In Tomcat 9, you do not need to add any manager-XXX roles. All you have to do is add users and assign manager-gui (for access to the GUI) and manager-script (for access, such as Jenkins deployment). Also, be sure to edit the /webapps/manager/META-INF/context.xml file to either comment out the valve or define the appropriate reg ex for the allow attribute

0
Apr 30 '19 at 13:01
source share



All Articles