Issue
I have configured Jenkins on a seperate server to build a Maven project, and now I want Jenkins to deploy the project for me on a JBoss EAP(7.3.0) which is located on a different server through the Deploy to Container jenkins (1.16) plugin, however I'm getting the following error when I try to deploy:
15:58:33 [DeployPublisher][INFO] Attempting to deploy 1 war file(s)
15:58:34 ERROR: Build step failed with exception
15:58:34 org.codehaus.cargo.container.ContainerException: Failed to create deployer with implementation class org.codehaus.cargo.container.jboss.JBoss7xRemoteDeployer for the parameters (container [id = [jboss7x]], deployer type [remote]).
15:58:34 at org.codehaus.cargo.generic.spi.AbstractGenericHintFactory.createImplementation(AbstractGenericHintFactory.java:154)
15:58:34 at org.codehaus.cargo.generic.spi.AbstractIntrospectionGenericHintFactory.createImplementation(AbstractIntrospectionGenericHintFactory.java:89)
15:58:34 at org.codehaus.cargo.generic.deployer.DefaultDeployerFactory.createDeployer(DefaultDeployerFactory.java:131)
15:58:34 at org.codehaus.cargo.generic.deployer.DefaultDeployerFactory.createDeployer(DefaultDeployerFactory.java:150)
15:58:34 at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:69)
15:58:34 at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:167)
15:58:34 at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:136)
15:58:34 at hudson.FilePath.act(FilePath.java:1164)
15:58:34 at hudson.FilePath.act(FilePath.java:1147)
15:58:34 at hudson.plugins.deploy.CargoContainerAdapter.redeployFile(CargoContainerAdapter.java:133)
15:58:34 at hudson.plugins.deploy.PasswordProtectedAdapterCargo.redeployFile(PasswordProtectedAdapterCargo.java:95)
15:58:34 at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:113)
15:58:34 at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
15:58:34 at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:80)
15:58:34 at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
15:58:34 at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:803)
15:58:34 at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:752)
15:58:34 at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1072)
15:58:34 at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:697)
15:58:34 at hudson.model.Run.execute(Run.java:1932)
15:58:34 at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
15:58:34 at hudson.model.ResourceController.execute(ResourceController.java:97)
15:58:34 at hudson.model.Executor.run(Executor.java:429)
15:58:34 Caused by: java.lang.reflect.InvocationTargetException
15:58:34 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
15:58:34 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
15:58:34 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
15:58:34 at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
15:58:34 at org.codehaus.cargo.generic.deployer.DefaultDeployerFactory.createInstance(DefaultDeployerFactory.java:229)
15:58:34 at org.codehaus.cargo.generic.deployer.DefaultDeployerFactory.createInstance(DefaultDeployerFactory.java:40)
15:58:34 at org.codehaus.cargo.generic.spi.AbstractGenericHintFactory.createImplementation(AbstractGenericHintFactory.java:148)
15:58:34 ... 22 more
15:58:34 Caused by: org.codehaus.cargo.util.CargoException: Cannot locate the JBoss connector classes! Make sure the required JBoss JARs (or Maven dependencies) are in CARGO's classpath.
15:58:34 More information on: https://codehaus-cargo.github.io/cargo/JBoss+Remote+Deployer.html
15:58:34 at org.codehaus.cargo.container.jboss.JBoss5xRemoteDeployer.<init>(JBoss5xRemoteDeployer.java:146)
15:58:34 at org.codehaus.cargo.container.jboss.JBoss7xRemoteDeployer.<init>(JBoss7xRemoteDeployer.java:39)
15:58:34 ... 29 more
15:58:34 Caused by: java.lang.ClassNotFoundException: org.jboss.as.controller.client.ModelControllerClient
15:58:34 at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1387)
15:58:34 at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1342)
15:58:34 at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1089)
15:58:34 at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
15:58:34 at org.codehaus.cargo.container.jboss.JBoss5xRemoteDeployer.<init>(JBoss5xRemoteDeployer.java:141)
15:58:34 ... 30 more
15:58:34 java.lang.reflect.InvocationTargetException
15:58:34 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
15:58:34 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
15:58:34 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
15:58:34 at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
15:58:34 at org.codehaus.cargo.generic.deployer.DefaultDeployerFactory.createInstance(DefaultDeployerFactory.java:229)
15:58:34 at org.codehaus.cargo.generic.deployer.DefaultDeployerFactory.createInstance(DefaultDeployerFactory.java:40)
15:58:34 at org.codehaus.cargo.generic.spi.AbstractGenericHintFactory.createImplementation(AbstractGenericHintFactory.java:148)
15:58:34 at org.codehaus.cargo.generic.spi.AbstractIntrospectionGenericHintFactory.createImplementation(AbstractIntrospectionGenericHintFactory.java:89)
15:58:34 at org.codehaus.cargo.generic.deployer.DefaultDeployerFactory.createDeployer(DefaultDeployerFactory.java:131)
15:58:34 at org.codehaus.cargo.generic.deployer.DefaultDeployerFactory.createDeployer(DefaultDeployerFactory.java:150)
15:58:34 at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:69)
15:58:34 at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:167)
15:58:34 at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:136)
15:58:34 at hudson.FilePath.act(FilePath.java:1164)
15:58:34 at hudson.FilePath.act(FilePath.java:1147)
15:58:34 at hudson.plugins.deploy.CargoContainerAdapter.redeployFile(CargoContainerAdapter.java:133)
15:58:34 at hudson.plugins.deploy.PasswordProtectedAdapterCargo.redeployFile(PasswordProtectedAdapterCargo.java:95)
15:58:34 at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:113)
15:58:34 at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
15:58:34 at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:80)
15:58:34 at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
15:58:34 at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:803)
15:58:34 at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:752)
15:58:34 at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1072)
15:58:34 at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:697)
15:58:34 at hudson.model.Run.execute(Run.java:1932)
15:58:34 at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
15:58:34 at hudson.model.ResourceController.execute(ResourceController.java:97)
15:58:34 at hudson.model.Executor.run(Executor.java:429)
15:58:34 Caused by: org.codehaus.cargo.util.CargoException: Cannot locate the JBoss connector classes! Make sure the required JBoss JARs (or Maven dependencies) are in CARGO's classpath.
15:58:34 More information on: https://codehaus-cargo.github.io/cargo/JBoss+Remote+Deployer.html
15:58:34 at org.codehaus.cargo.container.jboss.JBoss5xRemoteDeployer.<init>(JBoss5xRemoteDeployer.java:146)
15:58:34 at org.codehaus.cargo.container.jboss.JBoss7xRemoteDeployer.<init>(JBoss7xRemoteDeployer.java:39)
15:58:34 ... 29 more
15:58:34 Caused by: java.lang.ClassNotFoundException: org.jboss.as.controller.client.ModelControllerClient
15:58:34 at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1387)
15:58:34 at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1342)
15:58:34 at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1089)
15:58:34 at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
15:58:34 at org.codehaus.cargo.container.jboss.JBoss5xRemoteDeployer.<init>(JBoss5xRemoteDeployer.java:141)
15:58:34 ... 30 more
15:58:34 Build step 'Deploy war/ear to a container' marked build as failure
15:58:34 Finished: FAILURE
I have attempted to install the cargo-maven3-plugin into my local Maven repository (https://mvnrepository.com/artifact/org.codehaus.cargo/cargo-maven3-plugin/1.9.2) as suggested by the error message if you read the link it provides: https://codehaus-cargo.github.io/cargo/JBoss+Remote+Deployer.html
However I still get the error, does anyone know what the issue might be?
Solution
I found a solution to the problem.
Copy all JAR files located in your JBoss instance (eg. JBossEAP7.3.1/Modules/*.jar). I highly recommend using a search function to find them all.
Put the jars into "Deploy to Container"(named Deploy in folder structure) local jar repository (can be found where you have plugins installed for your jenkins instance, meaning wherever your .jenkins file is located)
Restart Jenkins
Deploy to Container will no longer encounter the posted error.
Unfortunately I afterwards encountered a new error (unrelated to this) which forced me to abandon this plugin for my purposes.
Answered By - Michael Dolatko