Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"XNIO001001: No XNIO provider found" error when deploying to Wildfly using Cargo Java API and Jenkins

I am working on a Jenkins plugin which manages the deployment of EAR files to Java EE containers using the Codehaus Cargo Java API, however I've hit an issue when using the API to deploy to a remote Wildfly container. The code works fine when deploying to other containers such as Glassfish, but when attempting to deploy the EAR file to a Wildfly container the error message XNIO001001: No XNIO provider found is returned.

I've spent several hours researching this problem but I cannot find anything that might resolve the problem. This issue occurs when trying to deploy to Wildfly 8.1 and 8.2 running on Windows and Ubuntu. I've also checked the Wildfly server log but it doesn't contain anything related to this issue.

My question is what can do I to prevent the XNIO001001: No XNIO provider found error when deploying to a Wildfly container whilst the code is part of a Jenkins plugin?

I know that Jenkins already has a similar plugin and that Cargo can be used with Maven to deploy to containers but neither option meets my specific requirements.

The code I've written to deploy the EAR file is as follows:

public void redeploy(String containerId, String deployFile, String hostname, String username, String password) {

  DeployableFactory deployableFactory = new DefaultDeployableFactory();
  Deployable deployable = deployableFactory.createDeployable(containerId, deployFile, DeployableType.EAR);

  ConfigurationFactory configurationFactory = new DefaultConfigurationFactory();
  Configuration configuration = configurationFactory.createConfiguration(containerId, ContainerType.REMOTE, ConfigurationType.RUNTIME);
  configuration.setProperty("cargo.hostname",hostname);
  configuration.setProperty("cargo.remote.username", username);
  configuration.setProperty("cargo.remote.password", password);

  ContainerFactory containerFactory=new DefaultContainerFactory();
  Container container = containerFactory.createContainer(containerId, ContainerType.REMOTE, configuration);

  DeployerFactory deployerFactory = new DefaultDeployerFactory();
  Deployer deployer = deployerFactory.createDeployer(container);

  deployer.redeploy(deployable);
}

When containerId is set to wildfly8x the error message XNIO001001: No XNIO provider found is returned along with the following stacktrace:

org.codehaus.cargo.util.CargoException: Cannot deploy deployable org.codehaus.cargo.container.deployable.EAR[hello-world-ear-0.0.1-SNAPSHOT.ear]
    at org.codehaus.cargo.container.jboss.JBoss5xRemoteDeployer.deploy(JBoss5xRemoteDeployer.java:216)
    at org.codehaus.cargo.container.spi.deployer.AbstractDeployer.redeploy(AbstractDeployer.java:245)
    at org.jenkinsci.plugins.cargo.CargoDeployer.redeploy(CargoDeployer.java:56)
    at org.jenkinsci.plugins.cargo.DeployerRedeploy.perform(DeployerRedeploy.java:97)
    at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726)
    at hudson.model.Build$BuildExecution.post2(Build.java:185)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671)
    at hudson.model.Run.execute(Run.java:1769)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:374)
Caused by: java.lang.IllegalArgumentException: XNIO001001: No XNIO provider found
    at org.xnio.Xnio.doGetInstance(Xnio.java:238)
    at org.xnio.Xnio.getInstance(Xnio.java:193)
    at org.jboss.remoting3.Remoting.createEndpoint(Remoting.java:112)
    at org.jboss.as.controller.client.impl.RemotingModelControllerClient.getOrCreateChannel(RemotingModelControllerClient.java:124)
    at org.jboss.as.controller.client.impl.RemotingModelControllerClient$1.getChannel(RemotingModelControllerClient.java:67)
    at org.jboss.as.protocol.mgmt.ManagementChannelHandler.executeRequest(ManagementChannelHandler.java:117)
    at org.jboss.as.protocol.mgmt.ManagementChannelHandler.executeRequest(ManagementChannelHandler.java:92)
    at org.jboss.as.controller.client.impl.AbstractModelControllerClient.executeRequest(AbstractModelControllerClient.java:236)
    at org.jboss.as.controller.client.impl.AbstractModelControllerClient.execute(AbstractModelControllerClient.java:141)
    at org.jboss.as.controller.client.impl.AbstractModelControllerClient.executeAsync(AbstractModelControllerClient.java:101)
    at org.jboss.as.controller.client.helpers.standalone.impl.ModelControllerClientServerDeploymentManager.executeOperation(ModelControllerClientServerDeploymentManager.java:50)
    at org.jboss.as.controller.client.helpers.standalone.impl.AbstractServerDeploymentManager.execute(AbstractServerDeploymentManager.java:79)
    at org.codehaus.cargo.tools.jboss.JBossDeployer.executeAction(JBossDeployer.java:144)
    at org.codehaus.cargo.tools.jboss.JBossDeployer.deploy(JBossDeployer.java:84)
    at org.codehaus.cargo.container.jboss.JBoss5xRemoteDeployer.deploy(JBoss5xRemoteDeployer.java:212)
    ... 12 more
java.lang.IllegalArgumentException: XNIO001001: No XNIO provider found
    at org.xnio.Xnio.doGetInstance(Xnio.java:238)
    at org.xnio.Xnio.getInstance(Xnio.java:193)
    at org.jboss.remoting3.Remoting.createEndpoint(Remoting.java:112)
    at org.jboss.as.controller.client.impl.RemotingModelControllerClient.getOrCreateChannel(RemotingModelControllerClient.java:124)
    at org.jboss.as.controller.client.impl.RemotingModelControllerClient$1.getChannel(RemotingModelControllerClient.java:67)
    at org.jboss.as.protocol.mgmt.ManagementChannelHandler.executeRequest(ManagementChannelHandler.java:117)
    at org.jboss.as.protocol.mgmt.ManagementChannelHandler.executeRequest(ManagementChannelHandler.java:92)
    at org.jboss.as.controller.client.impl.AbstractModelControllerClient.executeRequest(AbstractModelControllerClient.java:236)
    at org.jboss.as.controller.client.impl.AbstractModelControllerClient.execute(AbstractModelControllerClient.java:141)
    at org.jboss.as.controller.client.impl.AbstractModelControllerClient.executeAsync(AbstractModelControllerClient.java:101)
    at org.jboss.as.controller.client.helpers.standalone.impl.ModelControllerClientServerDeploymentManager.executeOperation(ModelControllerClientServerDeploymentManager.java:50)
    at org.jboss.as.controller.client.helpers.standalone.impl.AbstractServerDeploymentManager.execute(AbstractServerDeploymentManager.java:79)
    at org.codehaus.cargo.tools.jboss.JBossDeployer.executeAction(JBossDeployer.java:144)
    at org.codehaus.cargo.tools.jboss.JBossDeployer.deploy(JBossDeployer.java:84)
    at org.codehaus.cargo.container.jboss.JBoss5xRemoteDeployer.deploy(JBoss5xRemoteDeployer.java:212)
    at org.codehaus.cargo.container.spi.deployer.AbstractDeployer.redeploy(AbstractDeployer.java:245)
    at org.jenkinsci.plugins.cargo.CargoDeployer.redeploy(CargoDeployer.java:56)
    at org.jenkinsci.plugins.cargo.DeployerRedeploy.perform(DeployerRedeploy.java:97)
    at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726)
    at hudson.model.Build$BuildExecution.post2(Build.java:185)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671)
    at hudson.model.Run.execute(Run.java:1769)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:374)

In the pom.xml file for my plugin I've included the following dependencies

<dependency>
  <groupId>org.codehaus.cargo</groupId>
  <artifactId>cargo-core-container-wildfly</artifactId>
  <version>1.4.14</version>
</dependency>
<dependency>
  <groupId>org.codehaus.cargo</groupId>
  <artifactId>cargo-core-container-jboss</artifactId>
  <version>1.4.14</version>
</dependency>
<dependency>
  <groupId>org.wildfly</groupId>
  <artifactId>wildfly-controller-client</artifactId>
  <version>8.2.0.Final</version>
</dependency>

Update: I've done some further investigation and have found this is only an issue when running my code as a Jenkins plugin. If I use the same code in a standalone application then Cargo is able to deploy the EAR file to Wildfly without any problems.

like image 213
Paul H Avatar asked Jun 11 '15 22:06

Paul H


2 Answers

It looks like you have xnio-api.jar but no xnio-nio.jar in the classpath when you run your code as a Jenkins plugin. You can run mvn dependency:tree and look what XNIO version is used and then bundle it with your plugin.

like image 140
Vladimir Korenev Avatar answered Oct 19 '22 16:10

Vladimir Korenev


You can add a xnio-nio.jar to your classpath with this dependency in you pom.xml:

<dependency>
    <groupId>org.jboss.xnio</groupId>
    <artifactId>xnio-nio</artifactId>
    <version>3.4.6.Final</version>
</dependency>

See also the version list here: https://mvnrepository.com/artifact/org.jboss.xnio/xnio-nio

like image 31
Jmini Avatar answered Oct 19 '22 17:10

Jmini