简体   繁体   English

创建JClouds SwiftApi时出错:无法实例化提供程序org.jclouds.openstack.keystone.v2_0.KeystoneApiMetadata

[英]Error creating JClouds SwiftApi: Provider org.jclouds.openstack.keystone.v2_0.KeystoneApiMetadata could not be instantiated

I have some code for connecting to a JClouds swift storage container which works fine in its own test area, but once I integrate into my project, I get an error: 我有一些连接到JClouds swift存储容器的代码,它在自己的测试区域工作正常,但是一旦我集成到我的项目中,我就会收到一个错误:

Exception in thread "main" java.util.ServiceConfigurationError: org.jclouds.apis.ApiMetadata: Provider org.jclouds.openstack.keystone.v2_0.KeystoneApiMetadata could not be instantiated: java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException 线程“main”中的异常java.util.ServiceConfigurationError:org.jclouds.apis.ApiMetadata:Provider org.jclouds.openstack.keystone.v2_0.KeystoneApiMetadata无法实例化:java.lang.IllegalStateException:java.lang.reflect.InvocationTargetException

This is the code which fails on the ContextBuilder line: 这是在ContextBuilder行上失败的代码:

private SwiftApi swiftApi;

public JCloudsConnector(String username, String password, String endpoint) {
      String provider = "openstack-swift";

      Properties overrides = new Properties();
      overrides.setProperty("jclouds.mpu.parallel.degree", "" + Runtime.getRuntime().availableProcessors());

      swiftApi = ContextBuilder.newBuilder(provider)
            .endpoint(endpoint)
            .credentials(username, password)
            .overrides(overrides)
            .buildApi(SwiftApi.class);
}

I am using the same dependencies (JClouds version 1.7.3) so I can't understand what the problem might be since both are run in the same environment. 我使用相同的依赖项(JClouds版本1.7.3),所以我无法理解问题可能是什么,因为它们都在相同的环境中运行。

Thanks to Ignasi Barrera, I was able to sort this by adding an entry for Guava 15.0 in my maven POM file: 感谢Ignasi Barrera,我能够通过在我的maven POM文件中添加Guava 15.0的条目来对其进行排序:

<dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>15.0</version>
</dependency>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM