jekins自动部署tomcat注意事项、连接tomcat报错

jekins自动部署tomcat注意事项

千万不要用下面插件推送,报错很多, 要用脚本,一篇博客说的:“我们都是用的脚本,插件报错太多,也不完善”

Deploy to container Plugin”,







连接tomcat报错解决

Jenkins部署:The username and password you provided are not correct (error 401)


解决:

https://blog.csdn.net/nxw_tsp/article/details/77326244


build成功后会抱一个401的错误

点击报错里面的链接会跳出页面,让输入tomcat的用户名和密码,这时候点击取消

点击取消后会有提示

意思大概是:“您没有权限查看此页。如果你没有更改任何配置文件,请检查您的安装文件conf/tomcat-users.xml。该文件必须包含证书让你使用这个程序。


例如,添加manager-gui作用一个用户名为tomcat的密码的s3cret,添加以下上面列出的配置文件。” 


那么我们就按照提示去Tomcat文件夹找到相应的文件conf/tomcat-users.xml然后修改它。 


我们可以看到,当我们第一次打开tomcat-users.xml这个文件的时候它的标签中间部分是被注释掉的,我们需要做的就是把注释打开并添加manager-gui 


添加如下内容,密码必须是tomcat  账号随便,把注释去掉

[root@kube-node1 ~]# vi /usr/local/apache-tomcat-8.5.31/conf/tomcat-users.xml

  <role rolename="manager-gui"/>
  <role rolename="manager-script"/>
  <role rolename="manager-jmx"/>
  <role rolename="manager-status"/>
  <user username="zihao" password="tomcat" roles="manager-gui,manager-script,manager-jmx,manager-status"/>



注释去掉后如下

[root@kube-node1 ~]# cat /usr/local/apache-tomcat-8.5.31/conf/tomcat-users.xml

<!--
  NOTE:  The sample user and role entries below are intended for use with the
  examples web application. They are wrapped in a comment and thus are ignored
  when reading this file. If you wish to configure these users for use with the
  examples web application, do not forget to remove the <!.. ..> that surrounds
  them. You will also need to set the passwords to something appropriate.
-->
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>

  <role rolename="manager-gui"/>
  <role rolename="manager-script"/>
  <role rolename="manager-jmx"/>
  <role rolename="manager-status"/>
  <user username="zihao" password="tomcat" roles="manager-gui,manager-script,manager-jmx,manager-status"/>
</tomcat-users>

猜你喜欢

转载自www.cnblogs.com/effortsing/p/10013397.html