1.Jenkins安装、Git安装、GitHub注册过程略过
2.Jenkins相关插件安装 maven插件
错误1
The username you provided is not allowed to use the text-based Tomcat Manager (error 403)
The username you provided is not allowed to use the text-based Tomcat Manager (error 403)
1、背景及现象
今天在配置Jenkins的自动部署功能,手动构建时报“The username you provided is not allowed to use the text-based Tomcat Manager (error 403)”错误,如图
2、原因
用于tomcat7自动部署的管理用户必须具有manager-script角色,manager-gui角色是不够的,不然会有错误出现:
The username you provided is not allowed to use the text-based Tomcat Manager (error 403)
在/etc/tomcat7/tomcat-users.xml文件中为管理用户添加manager-script角色即可。
3、解决方法
进入到tomcat的conf目录下,编辑tomcat-users.xml配置文件
添加manager-script角色,并赋予角色给admin
打开tomcat目录下 /conf/tomcat-users.xml
在</tomcat-users>前面添加以下设置:
<role rolename="manager"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-status"/>
<user username="tomcat" password="admin123" roles="manager,manager-gui,manager-script,manager-status" />
4、结果
Jenkins再次手动构建则构建成功。
5.如果还不行
/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>