2
votes

I got this error while try to do auto-deploy to our tomcat server.

ERROR: Publisher hudson.plugins.deploy.DeployPublisher aborted due to exception org.codehaus.cargo.container.ContainerException: Failed to redeploy [/home/affiza/workspace/mimos-test-deploy/dist/met-server.war] at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:195) at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:64) at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:90) at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:77) at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2309) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:326) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:722) Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: http://test.mest.my:8080//manager/text/list at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1625) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:504) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.list(TomcatManager.java:622) at org.codehaus.cargo.container.tomcat.internal.TomcatManager.getStatus(TomcatManager.java:635) at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:176) ... 13 more

What i need to do?

5

5 Answers

3
votes

I think this is the key:

...
java.lang.Thread.run(Thread.java:722) Caused by: java.io.IOException: 
Server returned HTTP response code: 403 for URL: 
http://test.mest.my:8080//manager/text/list at 
...

403 means Forbidden:

The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, it SHOULD describe the reason for the refusal in the entity. If the server does not wish to make this information available to the client, the status code 404 (Not Found) can be used instead.

So you probably have wrong deployment configuration in Jenkins job (wrong place where you try to deploy, where it's not allowed), or then your Tomcat is not configured right and does not allow deployment (at least not the way Jenkins job is trying to do it).

3
votes

add roles "manager-script" to the user,

Note that for Tomcat 7 onwards, the roles required to use the manager application were changed from the single manager role to the following four roles. You will need to assign the role(s) required for the functionality you wish to access.

manager-gui - allows access to the HTML GUI and the status pages
manager-script - allows access to the text interface and the status
manager-jmx - allows access to the JMX proxy and the status
manager-status - allows access to the status pages only
2
votes

Add following roles to your tomcat-users.xml

  1. manager-gui - allows access to the HTML GUI and the status pages - which gives access in your gui interface of tomcat

  2. manager-script - allows access to the text interface and the status - which provides access to your external script, that is run by the Jenkins.

     <tomcat-users><role rolename="manager-gui"/><role rolename="manager-script"/><user username="deployer" password="deployer" roles="manager-gui"/>
    

    I didnt know about below two

    • manager-jmx - allows access to the JMX proxy and the status
    • manager-status - allows access to the status pages only
0
votes

You should restart tomcat after changing anything in conf folder

-2
votes

Above exception is saying - you have already deployed same artifact in your remote server & failed to redeploy it, Just remove already deployed artiface and this will work but if you want to redeploye the same artifact you need to change configuration in plugin..