使用Jenkins在远程Tomcat8上部署时,您提供的用户名不允许使用基于文本的Tomcat管理器(错误403) [英] The username you provided is not allowed to use the text-based Tomcat Manager (error 403) when deploying on remote Tomcat8 using Jenkins

查看:559
本文介绍了使用Jenkins在远程Tomcat8上部署时,您提供的用户名不允许使用基于文本的Tomcat管理器(错误403)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Jenkins部署到容器插件在远程Tomcat(远程计算机)上部署WAR. 我已经在tomcat-users.xml

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

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

我在Jenkins部署程序容器插件中设置了正确的用户名密码和端口.该设置对于本地Tomcat运行正常. 但是对于远程Tomcat,我一直收到以下错误:

I have setup the proper username password and port in Jenkins deployer container plugin. The setup is working fine for the 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

请帮助.

推荐答案

这似乎是Jenkins的错误,但是我通过在Tomcat中设置以下配置解决了这个问题:

This seems to be a Jenkins bug but I got around the problem by setting up following configuration in Tomcat:

编辑文件/webapps/manager/META-INF/context.xml:

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

上一个:

<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>

更改此文件以注释值:

<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 resolved the issue. Hope this helps someone :)

这篇关于使用Jenkins在远程Tomcat8上部署时,您提供的用户名不允许使用基于文本的Tomcat管理器(错误403)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆