jenkins deploying .war file to tomcat - TomcatManagerException - jenkins

Artifacts are being copied, but while deploying it to tomcat, the following exception is being thrown
org.codehaus.cargo.container.ContainerException: Failed to deploy
[/home/sherlock/.jenkins/workspace/My_Staging/MyApi.war] at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.deploy(AbstractTomcatManagerDeployer.java:106)
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:184)
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:1047)
at hudson.FilePath.act(FilePath.java:1025)
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:744)
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:1819)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Caused by:
org.codehaus.cargo.container.tomcat.internal.TomcatManagerException:
The Tomcat Manager responded "FAIL - Deployed application at context
path [/MyGubbiApi] but context failed to start " instead of the
expected "OK" message

The error indicates your war was deployed, but failed to start. Check your tomcat logs for more detailed errors.
Also to verify this issue is not related to your Jenkins job configuration, could you verify whether manually deploying the war works? If manually deploying works, then the issue is likely in the Jenkins job configuration. If manual deployment fails (with same error), the problem can be found in the tomcat logs.

Related

unable to deploy war file in tomcat9 using jenkins

I am trying to deploy war file in tomcat but unable to do so. I am using tomcat9. I have configure tomcat9 and its up and active on port 9090 as I am using port 8080 for jenkins. I am running jenkins and tomcat9 in my local Ubuntu 20.04. When I run my jenkins job, I am getting the below logs:
Started by user Pritish
Running as SYSTEM
Building in workspace /var/lib/jenkins/workspace/deploy-staging
Copied 1 artifact from "package" build number 5
[DeployPublisher][INFO] Attempting to deploy 1 war file(s)
[DeployPublisher][INFO] Deploying /var/lib/jenkins/workspace/deploy-staging/webapp/target/webapp.war to container Tomcat 9.x Remote with context null
ERROR: Build step failed with exception
org.codehaus.cargo.container.ContainerException: Failed to redeploy [/var/lib/jenkins/workspace/deploy-staging/webapp/target/webapp.war]
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:176)
at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:81)
at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:167)
at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:136)
at hudson.FilePath.act(FilePath.java:1164)
at hudson.FilePath.act(FilePath.java:1147)
at hudson.plugins.deploy.CargoContainerAdapter.redeployFile(CargoContainerAdapter.java:133)
at hudson.plugins.deploy.PasswordProtectedAdapterCargo.redeployFile(PasswordProtectedAdapterCargo.java:95)
at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:113)
at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:80)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:803)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:752)
at hudson.model.Build$BuildExecution.post2(Build.java:177)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:697)
at hudson.model.Run.execute(Run.java:1932)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Caused by: java.io.FileNotFoundException: http://localhost:9090/manager/text/list
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1896)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:577)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.list(TomcatManager.java:882)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.getStatus(TomcatManager.java:895)
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:161)
... 19 more
java.io.FileNotFoundException: http://localhost:9090/manager/text/list
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1896)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:577)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.list(TomcatManager.java:882)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.getStatus(TomcatManager.java:895)
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:161)
at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:81)
at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:167)
at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:136)
at hudson.FilePath.act(FilePath.java:1164)
at hudson.FilePath.act(FilePath.java:1147)
at hudson.plugins.deploy.CargoContainerAdapter.redeployFile(CargoContainerAdapter.java:133)
at hudson.plugins.deploy.PasswordProtectedAdapterCargo.redeployFile(PasswordProtectedAdapterCargo.java:95)
at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:113)
at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:80)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:803)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:752)
at hudson.model.Build$BuildExecution.post2(Build.java:177)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:697)
at hudson.model.Run.execute(Run.java:1932)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Build step 'Deploy war/ear to a container' marked build as failure
Finished: FAILURE
I fixed it. My webapps directory was empty. So, I installed tomcat9-admin and reinstalled tomcat9 by using the command sudo apt install tomcat9 tomcat9-admin. Then I restarted the tomcat service using sudo service tomcat9 restart. Here are my logs in jenkins:
Started by user Pritish
Running as SYSTEM
Building in workspace /var/lib/jenkins/workspace/deploy-staging
Copied 1 artifact from "package" build number 5
[DeployPublisher][INFO] Attempting to deploy 1 war file(s)
[DeployPublisher][INFO] Deploying /var/lib/jenkins/workspace/deploy-staging/webapp/target/webapp.war to container Tomcat 9.x Remote with context null
[/var/lib/jenkins/workspace/deploy-staging/webapp/target/webapp.war] is not deployed. Doing a fresh deployment.
Deploying [/var/lib/jenkins/workspace/deploy-staging/webapp/target/webapp.war]
Finished: SUCCESS

AutoDeploy Jenkins, Payara

I want an automated deploy to payara server with Jenkins, but I don't know how to achieve this. Could someone please help me?
Maybe I should use docker or any other application to make this job. I used the plugin "deploy war/ear" but this was the error:
C:\Program Files (x86)\Jenkins\workspace\pp1>exit 0
Deploying C:\Program Files (x86)\Jenkins\workspace\pp1\target\despliegue1-1.0-SNAPSHOT.war to container GlassFish 3.x Remote with context
ERROR: Build step failed with exception
org.glassfish.api.admin.InvalidCommandException: V3 cannot process this command at this time, please wait
at com.sun.enterprise.admin.remote.RemoteAdminCommand.fetchCommandModel(RemoteAdminCommand.java:1152)
at com.sun.enterprise.admin.remote.RemoteAdminCommand.getCommandModel(RemoteAdminCommand.java:330)
at com.sun.enterprise.admin.cli.remote.RemoteCommand.prepare(RemoteCommand.java:297)
at com.sun.enterprise.admin.cli.CLICommand.execute(CLICommand.java:242)
at com.sun.enterprise.admin.cli.remote.RemoteCommand.executeAndReturnOutput(RemoteCommand.java:389)
at org.glassfish.deployment.client.RemoteDeploymentFacility$RemoteCommandRunner.run(RemoteDeploymentFacility.java:117)
Caused: java.lang.RuntimeException
at org.glassfish.deployment.client.RemoteDeploymentFacility$RemoteCommandRunner.run(RemoteDeploymentFacility.java:121)
at org.glassfish.deployment.client.AbstractDeploymentFacility.listReferencedTargets(AbstractDeploymentFacility.java:704)
Caused: java.lang.RuntimeException: error submitting remote command
at org.glassfish.deployment.client.AbstractDeploymentFacility.listReferencedTargets(AbstractDeploymentFacility.java:735)
at org.glassfish.deployment.client.AbstractDeploymentFacility.listTargets(AbstractDeploymentFacility.java:693)
at org.glassfish.deployapi.SunDeploymentManager.getTargets(SunDeploymentManager.java:169)
Caused: java.lang.IllegalStateException: error submitting remote command
at org.glassfish.deployapi.SunDeploymentManager.getTargets(SunDeploymentManager.java:171)
at org.codehaus.cargo.container.spi.deployer.AbstractJsr88Deployer.findTargetModule(AbstractJsr88Deployer.java:439)
at org.codehaus.cargo.container.spi.deployer.AbstractJsr88Deployer.redeploy(AbstractJsr88Deployer.java:197)
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:1077)
at hudson.FilePath.act(FilePath.java:1060)
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:744)
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:1840)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Build step 'Deploy war/ear to a container' marked build as failure
Finished: FAILURE

Remote glassfish deployment has been failed using jenkins

I'm trying to deploy the war to remote Glassfish 4.1 server using Jenkins (V2.138.1) deploy to container plugin(v1.13) with following configuration
WAR/EAR files : target/myapp.war
Context path : /myapp
Containers :
Glassfish 3.x
credential : admin/****
Glassfish home :
Glassfish admin port : 4848
Glassfish hostname : my-pc
But following error occurred :
ERROR: Build step failed with exception
org.codehaus.cargo.util.CargoException: Deployment has failed: Action failed Deploying application to target server failed; java.util.concurrent.TimeoutException
at org.codehaus.cargo.container.spi.deployer.AbstractJsr88Deployer.waitForProgressObject(AbstractJsr88Deployer.java:295)
at org.codehaus.cargo.container.spi.deployer.AbstractJsr88Deployer.deploy(AbstractJsr88Deployer.java:133)
at org.codehaus.cargo.container.spi.deployer.AbstractJsr88Deployer.redeploy(AbstractJsr88Deployer.java:217)
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:1077)
at hudson.FilePath.act(FilePath.java:1060)
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:744)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1073)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
at hudson.model.Run.execute(Run.java:1840)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Build step 'Deploy war/ear to a container' marked build as failure
Finished: FAILURE
This is the problem with Glassfish v4.1.1
I upgraded Glassfish to v4.2.1. It's work for me:)

Jenkins and github commit statuses

I am having issues getting GitHub to talk to Jenkins after an upgrade to our private GitHub.
I had the webhooks setup and everything was working till the upgrade now I am getting the following error in the logs
ERROR: [GitHub Commit Status Setter] Failed to update commit state on
GitHub. Ignoring exception [{"message":"Not
Found","documentation_url":"https://developer.github.com/enterprise/2.11/v3"}]
has anyone seen this issue before?
Added Job:
Added error log:
ERROR: Build step failed with exception
java.io.FileNotFoundException: <redacted URL>
at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:243)
at com.squareup.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:210)
at com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:25)
at org.kohsuke.github.Requester.parse(Requester.java:612)
at org.kohsuke.github.Requester.parse(Requester.java:594)
at org.kohsuke.github.Requester._to(Requester.java:272)
Caused: org.kohsuke.github.GHFileNotFoundException: {"message":"Not Found","documentation_url":"https://developer.github.com/enterprise/2.11/v3"}
at org.kohsuke.github.Requester.handleApiError(Requester.java:686)
at org.kohsuke.github.Requester._to(Requester.java:293)
at org.kohsuke.github.Requester.to(Requester.java:234)
at org.kohsuke.github.GHRepository.createCommitStatus(GHRepository.java:1075)
at org.jenkinsci.plugins.github.status.GitHubCommitStatusSetter.perform(GitHubCommitStatusSetter.java:160)
Caused: org.jenkinsci.plugins.github.common.CombineErrorHandler$ErrorHandlingException
at org.jenkinsci.plugins.github.common.CombineErrorHandler.handle(CombineErrorHandler.java:74)
at org.jenkinsci.plugins.github.status.GitHubCommitStatusSetter.perform(GitHubCommitStatusSetter.java:164)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:81)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
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:1819)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
I think you should update the status result

Error while running jenkins build

I am getting below error while running my build. The build is triggering other builds also and creating and deploying RPMS.
Artifactory plugin version is 2.10.3
FATAL: org.jfrog.build.extractor.clientConfiguration.ArtifactoryClientConfiguration.setConnectionRetries(Ljava/lang/Integer;)V
java.lang.NoSuchMethodError: org.jfrog.build.extractor.clientConfiguration.ArtifactoryClientConfiguration.setConnectionRetries(Ljava/lang/Integer;)V
at org.jfrog.hudson.util.ExtractorUtils.setRetryParams(ExtractorUtils.java:400)
at org.jfrog.hudson.util.ExtractorUtils.setPublisherInfo(ExtractorUtils.java:313)
at org.jfrog.hudson.util.ExtractorUtils.getArtifactoryClientConfiguration(ExtractorUtils.java:155)
at org.jfrog.hudson.util.ExtractorUtils.addBuilderInfoArguments(ExtractorUtils.java:141)
at org.jfrog.hudson.maven3.extractor.MavenExtractorEnvironment.buildEnvVars(MavenExtractorEnvironment.java:139)
at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:931)
at hudson.maven.AbstractMavenBuild.getEnvironment(AbstractMavenBuild.java:56)
at hudson.maven.MavenModuleSetBuild.getEnvironment(MavenModuleSetBuild.java:169)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:635)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
at hudson.model.Run.execute(Run.java:1720)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:544)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:404)
Please clear Jenkins cache and update
Artifactory-Jenkins-Plugin to the latest version v2.10.4.

Resources