Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying web application in tomcat on Jenkins

I am using Jenkins to deploy web application on Tomcat7.
Tomcat installed as windows service and it has SWebServer name(installation path: C:\Program Files (x86)\SWebServer). Jenkins also installed as windows service. Application war file location is:C:\Program Files (x86)\Jenkins\jobs\test4\workspace\target\prj.war

This is my configuration:enter image description here

But I am getting the following exception

Deploying C:\Program Files (x86)\Jenkins\jobs\test4\workspace\target\prj.war to container Tomcat 7.x Remote
ERROR: Build step failed with exception
org.codehaus.cargo.container.ContainerException: Failed to redeploy [C:\Program Files (x86)\Jenkins\jobs\test4\workspace\target\prj.war]
       at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:193)
       at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:73)
       at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:116)
       at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:103)
       at hudson.FilePath.act(FilePath.java:989)
       at hudson.FilePath.act(FilePath.java:967)
       at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:103)
       at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:61)
       at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
       at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:761)
       at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:721)
       at hudson.model.Build$BuildExecution.post2(Build.java:183)
       at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:670)
       at hudson.model.Run.execute(Run.java:1743)
       at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
       at hudson.model.ResourceController.execute(ResourceController.java:89)
       at hudson.model.Executor.run(Executor.java:240)
Caused by: java.net.ConnectException: Connection refused: connect
       at java.net.DualStackPlainSocketImpl.connect0(Native Method)
       at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
       at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
       at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
       at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
       at java.net.PlainSocketImpl.connect(Unknown Source)
       at java.net.SocksSocketImpl.connect(Unknown Source)
       at java.net.Socket.connect(Unknown Source)
       at java.net.Socket.connect(Unknown Source)
       at sun.net.NetworkClient.doConnect(Unknown Source)
       at sun.net.www.http.HttpClient.openServer(Unknown Source)
       at sun.net.www.http.HttpClient.openServer(Unknown Source)
       at sun.net.www.http.HttpClient.<init>(Unknown Source)
       at sun.net.www.http.HttpClient.New(Unknown Source)
       at sun.net.www.http.HttpClient.New(Unknown Source)
       at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
       at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
       at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
       at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:534)
       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
java.net.ConnectException: Connection refused: connect
       at java.net.DualStackPlainSocketImpl.connect0(Native Method)
       at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
       at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
       at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
       at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
       at java.net.PlainSocketImpl.connect(Unknown Source)
       at java.net.SocksSocketImpl.connect(Unknown Source)
       at java.net.Socket.connect(Unknown Source)
       at java.net.Socket.connect(Unknown Source)
       at sun.net.NetworkClient.doConnect(Unknown Source)
       at sun.net.www.http.HttpClient.openServer(Unknown Source)
       at sun.net.www.http.HttpClient.openServer(Unknown Source)
       at sun.net.www.http.HttpClient.<init>(Unknown Source)
       at sun.net.www.http.HttpClient.New(Unknown Source)
       at sun.net.www.http.HttpClient.New(Unknown Source)
       at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
       at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
       at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
       at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:534)
       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)
       at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:73)
       at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:116)
       at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:103)
       at hudson.FilePath.act(FilePath.java:989)
       at hudson.FilePath.act(FilePath.java:967)
       at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:103)
       at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:61)
       at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
       at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:761)
       at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:721)
       at hudson.model.Build$BuildExecution.post2(Build.java:183)
       at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:670)
       at hudson.model.Run.execute(Run.java:1743)
       at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
       at hudson.model.ResourceController.execute(ResourceController.java:89)
       at hudson.model.Executor.run(Executor.java:240)



What is the problem ?

like image 572
Lusi Avatar asked Oct 20 '22 16:10

Lusi


1 Answers

change the follow;

In the conf/tomcat-user add :

<user username="test" password="passTest" roles="manager-script"/>

In Jenkins,

EAR/WAR file: **/*.war
context path: prj
Tomcat URL : http://localhost:8080
like image 71
Nicolas Moraes Avatar answered Oct 23 '22 05:10

Nicolas Moraes