Ask Your Question
2

Problem with JClouds

asked 2014-07-29 05:12:20 -0500

anhdenday gravatar image

updated 2014-07-30 01:41:59 -0500

Dear All, I've tried to connect to OpenStack by JCloud. I have the code below - can someone tell me the cause of the error?

  public JCloudsNova() {

        Iterable<Module> modules = ImmutableSet.<Module>of(new SLF4JLoggingModule());
        String provider = "openstack-nova";
        String identity = "demo:demo"; // tenantName:userName
        String credential = "nova";
        String enpoint="http://xxx.xxx.xxx.xxx:5000/v2.0/";

        novaApi = ContextBuilder.newBuilder(provider)
                .endpoint(enpoint)
                .credentials(identity, credential)
                .modules(modules)
                .buildApi(NovaApi.class);
        zones = novaApi.getConfiguredZones();
    }

The error is below.

Exception in thread "main" java.util.ServiceConfigurationError: org.jclouds.providers.ProviderMetadata: Provider org.jclouds.rackspace.cloudservers.CloudServersUSProviderMetadata could not be instantiated
    at java.util.ServiceLoader.fail(ServiceLoader.java:232)
    at java.util.ServiceLoader.access$100(ServiceLoader.java:185)
    at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:384)
    at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
    at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
    at com.google.common.collect.ImmutableCollection$Builder.addAll(ImmutableCollection.java:342)
    at com.google.common.collect.ImmutableSet$Builder.addAll(ImmutableSet.java:596)
    at org.jclouds.providers.Providers.all(Providers.java:84)
    at org.jclouds.providers.Providers.withId(Providers.java:101)
    at org.jclouds.ContextBuilder.newBuilder(ContextBuilder.java:166)
    at com.mycompany.app.my_app.JCloudsNova.<init>(JCloudsNova.java:40)
    at com.mycompany.app.my_app.JCloudsNova.main(JCloudsNova.java:20)
Caused by: java.lang.IllegalAccessError: tried to access class com.google.common.reflect.TypeResolver from class org.jclouds.util.TypeToken2
    at org.jclouds.util.TypeToken2.where(TypeToken2.java:47)
    at org.jclouds.rest.internal.BaseRestApiMetadata.contextToken(BaseRestApiMetadata.java:60)
    at org.jclouds.rest.internal.BaseRestApiMetadata$Builder.<init>(BaseRestApiMetadata.java:74)
    at org.jclouds.cloudservers.CloudServersApiMetadata$Builder.<init>(CloudServersApiMetadata.java:71)
    at org.jclouds.cloudservers.CloudServersApiMetadata.<init>(CloudServersApiMetadata.java:55)
    at org.jclouds.rackspace.cloudservers.CloudServersUSProviderMetadata$Builder.<init>(CloudServersUSProviderMetadata.java:61)
    at org.jclouds.rackspace.cloudservers.CloudServersUSProviderMetadata.builder(CloudServersUSProviderMetadata.java:36)
    at org.jclouds.rackspace.cloudservers.CloudServersUSProviderMetadata.<init>(CloudServersUSProviderMetadata.java:45)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
    at java.lang.Class.newInstance(Class.java:433)
    at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
    ... 9 more

Thanks you so much!

edit retag flag offensive close merge delete

Comments

I've solved the problem, thanks you

anhdenday gravatar imageanhdenday ( 2014-07-29 22:13:13 -0500 )edit

how did you solve the problem?

fifieldt gravatar imagefifieldt ( 2014-07-30 01:00:54 -0500 )edit

2 answers

Sort by ยป oldest newest most voted
3

answered 2014-07-30 01:39:43 -0500

anhdenday gravatar image

The default artifact is not enough. Add full artifact to build. Error above is because of missing openstack-nova artifact.

 <dependency>
      <groupId>org.apache.jclouds.api</groupId>
      <artifactId>openstack-nova</artifactId>
      <version>${jclouds.version}</version>
    </dependency>
edit flag offensive delete link more

Comments

thanks for sharing the solution

smaffulli gravatar imagesmaffulli ( 2014-07-30 14:15:53 -0500 )edit

Thanks. this helps others to learn.

SGPJ gravatar imageSGPJ ( 2014-09-01 04:42:03 -0500 )edit
0

answered 2015-09-17 16:50:02 -0500

Li gravatar image

I tried to use jclouds to connect openstack. I got the following error. Any body can help for this?

    String provider = "openstack-nova";
    String identity = "demo:admin"; // tenantName:userName
    String credential = "nova";

    novaApi = ContextBuilder.newBuilder(provider)
            .endpoint("http://xxx.xx.xx.xxx/:5000/v2.0/")
            .credentials(identity, credential)
            .modules(modules)
            .buildApi(NovaApi.class);
    regions = novaApi.getConfiguredRegions();

===============================================================================

14:44:51.530 [main] DEBUG o.j.rest.internal.InvokeHttpMethod - >> invoking AuthenticationApi.authenticateWithTenantNameAndCredentials 14:44:51.533 [main] DEBUG o.j.h.i.JavaUrlHttpCommandExecutorService - Sending request -1395735804: POST http://172.19.27.169/:5000/v2.0/tokens HTTP/1.1 14:44:51.534 [main] DEBUG jclouds.wire - >> "Sensitive data in payload, use PROPERTY_LOGGER_WIRE_LOG_SENSITIVE_INFO override to enable logging this data." 14:44:51.534 [main] DEBUG jclouds.headers - >> POST http://172.19.27.169/:5000/v2.0/tokens HTTP/1.1 14:44:51.534 [main] DEBUG jclouds.headers - >> Accept: application/json 14:44:51.534 [main] DEBUG jclouds.headers - >> Content-Type: application/json 14:44:51.535 [main] DEBUG jclouds.headers - >> Content-Length: 91 14:44:51.562 [main] DEBUG o.j.h.i.JavaUrlHttpCommandExecutorService - Receiving response -1395735804: HTTP/1.1 404 Not Found 14:44:51.562 [main] DEBUG jclouds.headers - << HTTP/1.1 404 Not Found 14:44:51.562 [main] DEBUG jclouds.headers - << Date: Thu, 17 Sep 2015 14:43:08 GMT 14:44:51.562 [main] DEBUG jclouds.headers - << Keep-Alive: timeout=5, max=100 14:44:51.563 [main] DEBUG jclouds.headers - << Connection: Keep-Alive 14:44:51.563 [main] DEBUG jclouds.headers - << Server: Apache/2.4.7 (Ubuntu) 14:44:51.563 [main] DEBUG jclouds.headers - << Content-Type: text/html; charset=iso-8859-1 14:44:51.563 [main] DEBUG jclouds.headers - << Content-Length: 293 14:44:51.567 [main] DEBUG jclouds.wire - << "[\n]" 14:44:51.567 [main] DEBUG jclouds.wire - << "[\n]" 14:44:51.567 [main] DEBUG jclouds.wire - << "404 Not Found[\n]" 14:44:51.567 [main] DEBUG jclouds.wire - << "[\n]" 14:44:51.567 [main] DEBUG jclouds.wire - << "

Not Found

[\n]" 14:44:51.567 [main] DEBUG jclouds.wire - << "

The requested URL /:5000/v2.0/tokens was not found on this server.

[\n]" 14:44:51.567 [main] DEBUG jclouds.wire - << "
[\n]" 14:44:51.567 [main] DEBUG jclouds.wire - << "
Apache/2.4.7 (Ubuntu) Server at 172.19.27.169 Port 80
[\n]" 14:44:51.567 [main] DEBUG jclouds.wire - << "</body></html>[\n]"

edit flag offensive delete link more

Comments

please make a new question for this

fifieldt gravatar imagefifieldt ( 2015-09-18 00:08:14 -0500 )edit

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2014-07-29 05:12:20 -0500

Seen: 962 times

Last updated: Jul 30 '14