unable to access tomcat manager

问题1:

在使用Jenkins自动化构建工具,自动部署maven工程的时候。配置了要部署的容器,提示必须有tomcat用户名密码验证。

ERROR: Build step failed with exception
org.codehaus.cargo.container.ContainerException: The [cargo.remote.username] and [cargo.remote.password] properties are mandatory and need to be defined in your configuration.
    at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.createManager(AbstractTomcatManagerDeployer.java:318)
    at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.getTomcatManager(AbstractTomcatManagerDeployer.java:83)
    at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:173)
    at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:77)
    at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:147)
    at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:117)
    at hudson.FilePath.act(FilePath.java:1074)
    at hudson.FilePath.act(FilePath.java:1057)
    at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:114)
    at hudson.plugins.deploy.PasswordProtectedAdapterCargo.redeploy(PasswordProtectedAdapterCargo.java:93)
    at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:64)
    at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
    at hudson.model.Build$BuildExecution.post2(Build.java:186)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
    at hudson.model.Run.execute(Run.java:1843)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)

于是谷歌了一下,在"${tomcat}/conf/tomcat-users.xml"中配置了以下:


  
  
  
  

注意:这个role和不是自己随意定义的,每个版本的配置rolename也是不一样的,具体自行查看文档。

但是又出现了新问题。

问题2:

tomcat的用户名密码配置好后,访问"http://${tomcat_ip}:${tomcat_port}/manager/html",提示报错:

unable to access tomcat manager_第1张图片
tomcat manager 403

其中提到说"By default the Manager is only accessible from a browser running on the same machine as Tomcat. If you wish to modify this restriction, you'll need to edit the Manager's context.xml file。"

(???????只说要修改context.xml,要怎么修改啊?)

然后谷歌后得到答案,链接在最下方,只要把"${tomcat}/webapps/manager/META-INF"下的context.xml配置文件中,注释掉以下代码即可:



  

最后一步,重启。


参考链接:

你可能感兴趣的:(unable to access tomcat manager)