5

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:

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

This is the code which fails on the ContextBuilder line:

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.

Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
Oj5000
  • 51
  • 3

1 Answers1

4

Thanks to Ignasi Barrera, I was able to sort this by adding an entry for Guava 15.0 in my maven POM file:

<dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>15.0</version>
</dependency>
Robert Harvey
  • 178,213
  • 47
  • 333
  • 501