jclouds-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesus arteche <chechu.li...@gmail.com>
Subject error with example code for OpenStack
Date Mon, 15 Dec 2014 15:16:57 GMT
Hey guys,

I'm running the example code for OpenStack from this site:
https://jclouds.apache.org/guides/openstack/ for nova

And I'm getting this error when it tries to build the connector:

JCloudsNova.java:42: error: no suitable method found for
buildApi(Class<NovaApi>)
                .buildApi(NovaApi.class);
                ^
    method ContextBuilder.<A#1>buildApi(TypeToken<A#1>) is not applicable
      (no instance(s) of type variable(s) A#1 exist so that argument type
Class<NovaApi> conforms to formal parameter type TypeToken<A#1>)
    method ContextBuilder.<A#2>buildApi(Class<A#2>) is not applicable
      (inferred type does not conform to declared bound(s)
        inferred: NovaApi
        bound(s): Closeable)
  where A#1,A#2 are type-variables:
    A#1 extends Closeable declared in method <A#1>buildApi(TypeToken<A#1>)
    A#2 extends Closeable declared in method <A#2>buildApi(Class<A#2>)
JCloudsNova.java:59: error: method close in class Closeables cannot be
applied to given types;
        Closeables.close(novaApi, true);
                  ^
  required: Closeable,boolean
  found: NovaApi,boolean
  reason:  actual argument NovaApi cannot be converted to Closeable by
method invocation conversion
2 errors



This is part of teh code:

 public JCloudsNova() {
        Iterable<Module> modules = ImmutableSet.<Module>of(new
SLF4JLoggingModule());

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

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


Any idea why?

Thanks in advance

Mime
View raw message