jclouds-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesus arteche <chechu.li...@gmail.com>
Subject Re: error with example code for OpenStack
Date Thu, 18 Dec 2014 12:27:59 GMT
I think is set to Nova... :(


import com.google.common.collect.ImmutableSet;
import com.google.common.io.Closeables;
import com.google.inject.Module;
import org.jclouds.ContextBuilder;
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
import org.jclouds.openstack.nova.v2_0.NovaApi;
import org.jclouds.openstack.nova.v2_0.domain.Server;
import org.jclouds.openstack.nova.v2_0.features.ServerApi;

import java.io.Closeable;
import java.io.IOException;
import java.util.Set;

public class JCloudsNova implements Closeable {
    private final NovaApi novaApi;
    private final Set<String> zones;

    public static void main(String[] args) throws IOException {
        JCloudsNova jcloudsNova = new JCloudsNova();

        try {
            jcloudsNova.listServers();
            jcloudsNova.close();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            jcloudsNova.close();
        }
    }

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

        String provider = "openstack-nova";
        String identity = "xxx:xxxx"; // tenantName:userName
        String credential = "xxxx";

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

    private void listServers() {
        for (String zone : zones) {
            ServerApi serverApi = novaApi.getServerApiForZone(zone);

            System.out.println("Servers in " + zone);

            for (Server server : serverApi.listInDetail().concat()) {
                System.out.println("  " + server);
            }
        }
    }

    public void close() throws IOException {
        Closeables.close(novaApi, true);
    }
}

On Wed, Dec 17, 2014 at 4:39 PM, Ignasi Barrera <nacx@apache.org> wrote:
>
> It seems that you are *not* trying to use Nova but the swift provider?
> Can you paste the code you are using?
>
> On 16 December 2014 at 18:44, Jesus arteche <chechu.linux@gmail.com>
> wrote:
> > I could compile it, but executing...I got this:
> >
> > Exception in thread "main" java.util.ServiceConfigurationError:
> > org.jclouds.providers.ProviderMetadata: Provider
> > org.jclouds.rackspace.cloudfiles.CloudFilesUSProviderMetadata could not
> be
> > instantiated
> > at java.util.ServiceLoader.fail(ServiceLoader.java:235)
> > at java.util.ServiceLoader.access$100(ServiceLoader.java:192)
> > at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:388)
> > at java.util.ServiceLoader$1.next(ServiceLoader.java:456)
> > at
> >
> com.google.common.collect.ImmutableCollection$Builder.addAll(ImmutableCollection.java:281)
> > at
> >
> com.google.common.collect.ImmutableCollection$ArrayBasedBuilder.addAll(ImmutableCollection.java:360)
> > at
> >
> com.google.common.collect.ImmutableSet$Builder.addAll(ImmutableSet.java:508)
> > at org.jclouds.providers.Providers.all(Providers.java:82)
> > at org.jclouds.providers.Providers.withId(Providers.java:99)
> > at org.jclouds.ContextBuilder.newBuilder(ContextBuilder.java:165)
> > at JCloudsNova.<init>(JCloudsNova.java:38)
> > at JCloudsNova.main(JCloudsNova.java:19)
> > Caused by: java.lang.NoSuchMethodError:
> >
> org/jclouds/openstack/swift/SwiftApiMetadata$Builder.<init>(Ljava/lang/Class;)V
> > at
> >
> org.jclouds.cloudfiles.CloudFilesApiMetadata$Builder.<init>(CloudFilesApiMetadata.java:57)
> > at
> >
> org.jclouds.cloudfiles.CloudFilesApiMetadata.<init>(CloudFilesApiMetadata.java:42)
> > at
> >
> org.jclouds.rackspace.cloudfiles.CloudFilesUSProviderMetadata$Builder.<init>(CloudFilesUSProviderMetadata.java:59)
> > at
> >
> org.jclouds.rackspace.cloudfiles.CloudFilesUSProviderMetadata.builder(CloudFilesUSProviderMetadata.java:34)
> > at
> >
> org.jclouds.rackspace.cloudfiles.CloudFilesUSProviderMetadata.<init>(CloudFilesUSProviderMetadata.java:43)
> > at java.lang.J9VMInternals.newInstanceImpl(Native Method)
> > at java.lang.Class.newInstance(Class.java:1628)
> > at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:384)
> > ... 9 more
> >
> >
> > On Tue, Dec 16, 2014 at 12:52 PM, Ignasi Barrera <nacx@apache.org>
> wrote:
> >>
> >> You have a mix of jclouds 1.5.7 and jclouds 1.8.1 dependencies that is
> >> causing classpath issues.
> >> Can you change your dependencies to use just jclouds 1.8.1? I'm pretty
> >> sure that will fix your issue.
> >>
> >>
> >> I.
> >>
> >> On 16 December 2014 at 13:33, Jesus arteche <chechu.linux@gmail.com>
> >> wrote:
> >> > hey
> >> >
> >> > thanks for the answer, I downloaded following the steps from the
> >> > website,
> >> > using the Maven approach (yesterday). This is the output of your
> >> > command:
> >> >
> >> > [INFO] Scanning for projects...
> >> > [INFO]
> >> > [INFO]
> >> >
> ------------------------------------------------------------------------
> >> > [INFO] Building my-app 1.0-SNAPSHOT
> >> > [INFO]
> >> >
> ------------------------------------------------------------------------
> >> > [INFO]
> >> > [INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ my-app ---
> >> > [INFO] com.mycompany.app:my-app:jar:1.0-SNAPSHOT
> >> > [INFO] +- org.apache.jclouds:jclouds-all:jar:1.8.1:compile
> >> > [INFO] |  +-
> >> > org.apache.jclouds.api:rackspace-cloudidentity:jar:1.8.1:compile
> >> > [INFO] |  |  \-
> >> > org.apache.jclouds.api:openstack-keystone:jar:1.8.1:compile
> >> > [INFO] |  +- org.apache.jclouds.api:openstack-cinder:jar:1.8.1:compile
> >> > [INFO] |  |  \- org.apache.jclouds:jclouds-core:jar:1.8.1:compile
> >> > [INFO] |  |     \- javax.ws.rs:jsr311-api:jar:1.1.1:compile
> >> > [INFO] |  +-
> org.apache.jclouds.api:rackspace-clouddns:jar:1.8.1:compile
> >> > [INFO] |  +-
> >> > org.apache.jclouds.provider:aws-cloudwatch:jar:1.8.1:compile
> >> > [INFO] |  |  \- org.apache.jclouds.api:cloudwatch:jar:1.8.1:compile
> >> > [INFO] |  +-
> >> >
> >> >
> org.apache.jclouds.provider:rackspace-cloudblockstorage-us:jar:1.8.1:compile
> >> > [INFO] |  +-
> >> >
> >> >
> org.apache.jclouds.provider:rackspace-cloudblockstorage-uk:jar:1.8.1:compile
> >> > [INFO] |  +-
> >> > org.apache.jclouds.provider:rackspace-clouddns-us:jar:1.8.1:compile
> >> > [INFO] |  +-
> >> > org.apache.jclouds.provider:rackspace-clouddns-uk:jar:1.8.1:compile
> >> > [INFO] |  +-
> >> >
> >> >
> org.apache.jclouds.provider:rackspace-clouddatabases-us:jar:1.8.1:compile
> >> > [INFO] |  |  \-
> org.apache.jclouds.api:openstack-trove:jar:1.8.1:compile
> >> > [INFO] |  +-
> >> >
> >> >
> org.apache.jclouds.provider:rackspace-clouddatabases-uk:jar:1.8.1:compile
> >> > [INFO] |  +- org.apache.jclouds.provider:aws-sqs:jar:1.8.1:compile
> >> > [INFO] |  |  \- org.apache.jclouds.api:sqs:jar:1.8.1:compile
> >> > [INFO] |  +- org.apache.jclouds.provider:aws-sts:jar:1.8.1:compile
> >> > [INFO] |  |  \- org.apache.jclouds.api:sts:jar:1.8.1:compile
> >> > [INFO] |  +- org.apache.jclouds.provider:aws-route53:jar:1.8.1:compile
> >> > [INFO] |  |  \- org.apache.jclouds.api:route53:jar:1.8.1:compile
> >> > [INFO] |  +- org.apache.jclouds.provider:ultradns-ws:jar:1.8.1:compile
> >> > [INFO] |  +- org.apache.jclouds.provider:dynect:jar:1.8.1:compile
> >> > [INFO] |  +-
> >> > org.apache.jclouds:jclouds-allloadbalancer:jar:1.8.1:compile
> >> > [INFO] |  |  +-
> >> >
> >> >
> org.apache.jclouds.provider:rackspace-cloudloadbalancers-uk:jar:1.8.1:compile
> >> > [INFO] |  |  |  +-
> >> > org.apache.jclouds:jclouds-loadbalancer:jar:1.8.1:compile
> >> > [INFO] |  |  |  \-
> >> > org.apache.jclouds.api:rackspace-cloudloadbalancers:jar:1.8.1:compile
> >> > [INFO] |  |  \-
> >> >
> >> >
> org.apache.jclouds.provider:rackspace-cloudloadbalancers-us:jar:1.8.1:compile
> >> > [INFO] |  +- org.apache.jclouds:jclouds-allcompute:jar:1.8.1:compile
> >> > [INFO] |  |  +- org.apache.jclouds.provider:aws-ec2:jar:1.8.1:compile
> >> > [INFO] |  |  +-
> org.apache.jclouds.api:openstack-nova:jar:1.8.1:compile
> >> > [INFO] |  |  |  \-
> org.apache.jclouds:jclouds-compute:jar:1.8.1:compile
> >> > [INFO] |  |  |     \-
> >> > org.apache.jclouds:jclouds-scriptbuilder:jar:1.8.1:compile
> >> > [INFO] |  |  +-
> >> > org.apache.jclouds.api:openstack-nova-ec2:jar:1.8.1:compile
> >> > [INFO] |  |  +- org.apache.jclouds.api:byon:jar:1.8.1:compile
> >> > [INFO] |  |  +- org.apache.jclouds.api:ec2:jar:1.8.1:compile
> >> > [INFO] |  |  +-
> >> > org.apache.jclouds.provider:cloudservers-us:jar:1.8.1:compile
> >> > [INFO] |  |  |  \-
> >> > org.apache.jclouds.common:openstack-common:jar:1.8.1:compile
> >> > [INFO] |  |  +-
> >> > org.apache.jclouds.provider:cloudservers-uk:jar:1.8.1:compile
> >> > [INFO] |  |  +- org.apache.jclouds.api:cloudservers:jar:1.8.1:compile
> >> > [INFO] |  |  +- org.apache.jclouds.api:vcloud:jar:1.8.1:compile
> >> > [INFO] |  |  +- org.apache.jclouds.provider:gogrid:jar:1.8.1:compile
> >> > [INFO] |  |  +- org.apache.jclouds.api:elasticstack:jar:1.8.1:compile
> >> > [INFO] |  |  +-
> >> > org.apache.jclouds.provider:elastichosts-lon-p:jar:1.8.1:compile
> >> > [INFO] |  |  +-
> >> > org.apache.jclouds.provider:elastichosts-sat-p:jar:1.8.1:compile
> >> > [INFO] |  |  +-
> >> > org.apache.jclouds.provider:elastichosts-lon-b:jar:1.8.1:compile
> >> > [INFO] |  |  +-
> >> > org.apache.jclouds.provider:openhosting-east1:jar:1.8.1:compile
> >> > [INFO] |  |  +-
> >> > org.apache.jclouds.provider:serverlove-z1-man:jar:1.8.1:compile
> >> > [INFO] |  |  +-
> >> > org.apache.jclouds.provider:skalicloud-sdg-my:jar:1.8.1:compile
> >> > [INFO] |  |  +-
> >> > org.apache.jclouds.provider:go2cloud-jhb1:jar:1.8.1:compile
> >> > [INFO] |  |  +-
> org.apache.jclouds.provider:softlayer:jar:1.8.1:compile
> >> > [INFO] |  |  +- org.apache.jclouds.api:cloudstack:jar:1.8.1:compile
> >> > [INFO] |  |  +-
> >> > org.apache.jclouds.provider:hpcloud-compute:jar:1.8.1:compile
> >> > [INFO] |  |  +-
> >> >
> org.apache.jclouds.provider:rackspace-cloudservers-us:jar:1.8.1:compile
> >> > [INFO] |  |  \-
> >> >
> org.apache.jclouds.provider:rackspace-cloudservers-uk:jar:1.8.1:compile
> >> > [INFO] |  \- org.apache.jclouds:jclouds-allblobstore:jar:1.8.1:compile
> >> > [INFO] |     +- org.apache.jclouds.api:s3:jar:1.8.1:compile
> >> > [INFO] |     |  \-
> >> > org.apache.jclouds:jclouds-blobstore:jar:1.8.1:compile
> >> > [INFO] |     +- org.apache.jclouds.provider:aws-s3:jar:1.8.1:compile
> >> > [INFO] |     +-
> org.apache.jclouds.provider:azureblob:jar:1.8.1:compile
> >> > [INFO] |     +- org.apache.jclouds.api:atmos:jar:1.8.1:compile
> >> > [INFO] |     +- org.apache.jclouds.api:swift:jar:1.8.1:compile
> >> > [INFO] |     +-
> org.apache.jclouds.api:openstack-swift:jar:1.8.1:compile
> >> > [INFO] |     +- org.apache.jclouds.api:cloudfiles:jar:1.8.1:compile
> >> > [INFO] |     +-
> >> > org.apache.jclouds.provider:cloudfiles-us:jar:1.8.1:compile
> >> > [INFO] |     +-
> >> > org.apache.jclouds.provider:cloudfiles-uk:jar:1.8.1:compile
> >> > [INFO] |     +- org.apache.jclouds.api:filesystem:jar:1.8.1:compile
> >> > [INFO] |     \-
> >> > org.apache.jclouds.provider:hpcloud-objectstorage:jar:1.8.1:compile
> >> > [INFO] +- org.jclouds:jclouds-allcompute:jar:1.5.7:compile
> >> > [INFO] |  +-
> >> > org.jclouds.provider:greenhousedata-element-vcloud:jar:1.5.7:compile
> >> > [INFO] |  +-
> >> > org.jclouds.provider:eucalyptus-partnercloud-ec2:jar:1.5.7:compile
> >> > [INFO] |  |  \- org.jclouds.api:eucalyptus:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.api:deltacloud:jar:1.5.7:compile
> >> > [INFO] |  |  \- org.jclouds:jclouds-compute:jar:1.5.7:compile
> >> > [INFO] |  |     \- org.jclouds:jclouds-scriptbuilder:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:aws-ec2:jar:1.5.7:compile
> >> > [INFO] |  |  \- org.jclouds.common:aws-common:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:rimuhosting:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.api:openstack-nova:jar:1.5.7:compile
> >> > [INFO] |  |  \- org.jclouds.api:openstack-keystone:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.api:openstack-nova-ec2:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.api:nova:jar:1.5.7:compile
> >> > [INFO] |  |  \- org.jclouds.common:openstack-common:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.api:byon:jar:1.5.7:compile
> >> > [INFO] |  |  \- org.yaml:snakeyaml:jar:1.10:compile
> >> > [INFO] |  +- org.jclouds.api:ec2:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:cloudservers-us:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:cloudservers-uk:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.api:cloudservers:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.api:vcloud:jar:1.5.7:compile
> >> > [INFO] |  |  \- com.jamesmurty.utils:java-xmlbuilder:jar:0.4:compile
> >> > [INFO] |  +- org.jclouds.api:cloudsigma:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:trmk-vcloudexpress:jar:1.5.7:compile
> >> > [INFO] |  |  \- org.jclouds.common:trmk-common:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:trmk-ecloud:jar:1.5.7:compile
> >> > [INFO] |  +-
> >> > org.jclouds.provider:bluelock-vcloud-zone01:jar:1.5.7:compile
> >> > [INFO] |  +-
> >> > org.jclouds.provider:stratogen-vcloud-mycloud:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:gogrid:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:slicehost:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.api:elasticstack:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:elastichosts-lon-p:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:elastichosts-sat-p:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:elastichosts-lon-b:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:openhosting-east1:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:serverlove-z1-man:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:skalicloud-sdg-my:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:cloudsigma-zrh:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:cloudsigma-lvs:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:go2cloud-jhb1:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:softlayer:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.api:cloudstack:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:ninefold-compute:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:hpcloud-compute:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:trystack-nova:jar:1.5.7:compile
> >> > [INFO] |  +-
> >> > org.jclouds.provider:rackspace-cloudservers-us:jar:1.5.7:compile
> >> > [INFO] |  |  \-
> >> > org.jclouds.api:rackspace-cloudidentity:jar:1.5.7:compile
> >> > [INFO] |  \-
> >> > org.jclouds.provider:rackspace-cloudservers-uk:jar:1.5.7:compile
> >> > [INFO] +- org.jclouds:jclouds-allblobstore:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.api:s3:jar:1.5.7:compile
> >> > [INFO] |  |  \- org.jclouds:jclouds-blobstore:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:aws-s3:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:ninefold-storage:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:synaptic-storage:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:cloudonestorage:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.api:walrus:jar:1.5.7:compile
> >> > [INFO] |  +-
> >> > org.jclouds.provider:eucalyptus-partnercloud-s3:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:azureblob:jar:1.5.7:compile
> >> > [INFO] |  |  \- org.jclouds.common:azure-common:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.api:atmos:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.api:swift:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.api:cloudfiles:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:cloudfiles-us:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.provider:cloudfiles-uk:jar:1.5.7:compile
> >> > [INFO] |  +- org.jclouds.api:filesystem:jar:1.5.7:compile
> >> > [INFO] |  |  \- commons-io:commons-io:jar:2.4:compile
> >> > [INFO] |  \-
> >> > org.jclouds.provider:hpcloud-objectstorage:jar:1.5.7:compile
> >> > [INFO] \- org.jclouds.driver:jclouds-slf4j:jar:1.5.4:compile
> >> > [INFO]    +- org.jclouds:jclouds-core:jar:1.5.4:compile
> >> > [INFO]    |  +- org.bouncycastle:bcprov-jdk16:jar:1.46:compile
> >> > [INFO]    |  +- aopalliance:aopalliance:jar:1.0:compile
> >> > [INFO]    |  +- com.sun.jersey:jersey-core:jar:1.12:compile
> >> > [INFO]    |  +-
> >> > com.google.inject.extensions:guice-assistedinject:jar:3.0:compile
> >> > [INFO]    |  +- com.google.inject:guice:jar:3.0:compile
> >> > [INFO]    |  +- org.99soft.guice:rocoto:jar:6.1:compile
> >> > [INFO]    |  +- javax.inject:javax.inject:jar:1:compile
> >> > [INFO]    |  +- javax.annotation:jsr250-api:jar:1.0:compile
> >> > [INFO]    |  +- com.google.code.gson:gson:jar:2.2:compile
> >> > [INFO]    |  \- com.google.guava:guava:jar:13.0:compile
> >> > [INFO]    \- org.slf4j:slf4j-api:jar:1.6.4:compile
> >> > [INFO]
> >> >
> ------------------------------------------------------------------------
> >> > [INFO] BUILD SUCCESS
> >> > [INFO]
> >> >
> ------------------------------------------------------------------------
> >> > [INFO] Total time: 6.557s
> >> > [INFO] Finished at: Tue Dec 16 12:31:42 GMT 2014
> >> > [INFO] Final Memory: 11M/22M
> >> > [INFO]
> >> >
> ------------------------------------------------------------------------
> >> >
> >> >
> >> > Thanks
> >> >
> >> >
> >> > On Mon, Dec 15, 2014 at 5:21 PM, Ignasi Barrera <nacx@apache.org>
> wrote:
> >> >>
> >> >> Hi,
> >> >>
> >> >> Which version of jclouds are you using? Also, which dependencies have
> >> >> you
> >> >> configured in your project? (if you use Maven the output of running
> >> >> "mvn
> >> >> dependency:tree" on your project will help).
> >> >>
> >> >> I.
> >> >>
> >> >> El 15/12/2014 16:24, "Jesus arteche" <chechu.linux@gmail.com>
> escribió:
> >> >>
> >> >>> 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