我已经将我的openstack4j版本升级到3.0.3(从v2版本开始),并且在同时使用OKHTTP Connector和HTTPCLIENT Connector从Tomcat运行它时出现此错误。

java.lang.ClassCastException: org.glassfish.jersey.server.internal.RuntimeDelegateImpl cannot be cast to org.jboss.resteasy.spi.ResteasyProviderFactory
    at org.jboss.resteasy.spi.ResteasyProviderFactory.getInstance(ResteasyProviderFactory.java:353)
    at org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor.checkClientExceptionMapper(ApacheHttpClient4Executor.java:72)
    at org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor.<init>(ApacheHttpClient4Executor.java:126)
    at org.openstack4j.connectors.resteasy.executors.ApacheHttpClientExecutor.<init>(ApacheHttpClientExecutor.java:24)
    at org.openstack4j.connectors.resteasy.executors.ApacheHttpClientExecutor.create(ApacheHttpClientExecutor.java:48)
    at org.openstack4j.connectors.resteasy.HttpCommand.initialize(HttpCommand.java:43)
    at org.openstack4j.connectors.resteasy.HttpCommand.create(HttpCommand.java:37)
    at org.openstack4j.connectors.resteasy.HttpExecutorServiceImpl.invoke(HttpExecutorServiceImpl.java:51)
    at org.openstack4j.connectors.resteasy.HttpExecutorServiceImpl.execute(HttpExecutorServiceImpl.java:30)
    at org.openstack4j.core.transport.internal.HttpExecutor.execute(HttpExecutor.java:51)
    at org.openstack4j.openstack.internal.OSAuthenticator.authenticateV3(OSAuthenticator.java:154)
    at org.openstack4j.openstack.internal.OSAuthenticator.invoke(OSAuthenticator.java:70)
    at org.openstack4j.openstack.client.OSClientBuilder$ClientV3.authenticate(OSClientBuilder.java:165)
    at org.openstack4j.openstack.client.OSClientBuilder$ClientV3.authenticate(OSClientBuilder.java:128)


v2的openstack4j不会发生此问题。

最佳答案

我在maven项目中使用3.0.4版时遇到了相同的问题。
将依赖性升级到3.1.0可以解决此问题。
这是包含的工件详细信息:

<dependency>
   <groupId>org.pacesys</groupId>
   <artifactId>openstack4j</artifactId>
   <version>3.1.0</version>
</dependency>

10-05 19:06