gpt4 book ai didi

java - 使用 Cargo Java API 和 Jenkins 部署到 Wildfly 时出现 "XNIO001001: No XNIO provider found"错误

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:05:20 27 4
gpt4 key购买 nike

我正在开发一个 Jenkins 插件,它使用 Codehaus Cargo Java API 管理 EAR 文件到 Java EE 容器的部署,但是我在使用 API 部署到远程 Wildfly 容器时遇到了问题。当部署到其他容器(如 Glassfish)时,代码工作正常,但当尝试将 EAR 文件部署到 Wildfly 容器时,返回错误消息 XNIO001001: No XNIO provider found

我花了几个小时研究这个问题,但找不到任何可能解决问题的方法。尝试部署到在 Windows 和 Ubuntu 上运行的 Wildfly 8.1 和 8.2 时会出现此问题。我还检查了 Wildfly 服务器日志,但它不包含与此问题相关的任何内容。

我的问题是当代码是 Jenkins 插件的一部分时部署到 Wildfly 容器时,我能做些什么来防止 XNIO001001: No XNIO provider found 错误?

我知道 Jenkins 已经有一个类似的插件并且 Cargo 可以与 Maven 一起使用来部署到容器,但是这两个选项都不符合我的特定要求。

我为部署 EAR 文件编写的代码如下:

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);
}

containerId 设置为 wildfly8x 时,错误消息 XNIO001001: No XNIO provider found 与以下堆栈跟踪一起返回:

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)

在我的插件的 pom.xml 文件中,我包含了以下依赖项

<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>

更新:我做了一些进一步的调查,发现这只是将我的代码作为 Jenkins 插件运行时的一个问题。如果我在独立应用程序中使用相同的代码,那么 Cargo 能够毫无问题地将 EAR 文件部署到 Wildfly。

最佳答案

当您将代码作为 Jenkins 插件运行时,类路径中似乎有 xnio-api.jar 但没有 xnio-nio.jar。您可以运行 mvn dependency:tree 并查看使用的 XNIO 版本,然后将其与您的插件捆绑在一起。

关于java - 使用 Cargo Java API 和 Jenkins 部署到 Wildfly 时出现 "XNIO001001: No XNIO provider found"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30792240/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com