You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jclouds.apache.org by "Varad Meru (Orzota)" <va...@orzota.com> on 2014/04/28 11:36:35 UTC
Errors while creating EC2 specific API Clients when using jclouds
1.7.1 - No implementation bound for @com.google.inject.name.Named at bindImageSupplier.
Hi All,
I am trying to use cloud-specific APIs to generate EC2 security groups
and keypair, but I am not able to create the new clients using the the
method mentioned in the
documentation(http://jclouds.apache.org/guides/aws/), which uses
AWSEC2Client class.
From documentation -
// when you need access to very ec2-specific features, use the
provider-specific context
AWSEC2Client ec2Client =
AWSEC2Client.class.cast(context.getProviderSpecificContext().getApi());
/But this class is not available in 1.7.1.///
After some digging, I found *AWSEC2Api *(org.jclouds.aws.ec2.AWSEC2Api)
to provide different clients with similar functionality as the
AWSEC2Client. (This is not mentioned in the documentation as well.). But
it is causing the exception to be thrown. Please have a look let me know
if I am doing something wrong.
Regards,
Varad
PS: Please find code snippet, pom.xml entries and stacktrace below.
*/_Code Snippet - _/*
builder = ContextBuilder
.newBuilder(new AWSEC2ApiMetadata.Builder().build())
.credentials(awsCredentials.getAccessKey(),
awsCredentials.getSecretKey())
.modules(ImmutableSet.<Module> of(new SshjSshClientModule()));
*// This line is throwing the exception as seen in the stack trace*
awsec2Api = builder.buildApi(AWSEC2Api.class);
computeServiceContext = builder.build(ComputeServiceContext.class);
compute = computeServiceContext.getComputeService();
credentialClient = awsec2Api.getKeyPairApi().get();
securityGroupClient = awsec2Api.getSecurityGroupApi().get();
instanceClient = awsec2Api.getInstanceApi().get();
*_/Stacktrace/_*
com.google.inject.CreationException: Guice creation errors:
1) No implementation for java.lang.String annotated with
@com.google.inject.name.Named(value=jclouds.ec2.cc-regions) was bound.
while locating java.lang.String annotated with
@com.google.inject.name.Named(value=jclouds.ec2.cc-regions)
for parameter 2 at
org.jclouds.aws.ec2.compute.suppliers.AWSEC2ImageSupplier.<init>(AWSEC2ImageSupplier.java:84)
at
org.jclouds.compute.config.BindComputeSuppliersByClass.bindImageSupplier(BindComputeSuppliersByClass.java:45)
1 error
at
com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:435)
at
com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:154)
at
com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:106)
at com.google.inject.Guice.createInjector(Guice.java:95)
at org.jclouds.ContextBuilder.buildInjector(ContextBuilder.java:403)
at org.jclouds.ContextBuilder.buildInjector(ContextBuilder.java:327)
at org.jclouds.ContextBuilder.buildApi(ContextBuilder.java:654)
at org.jclouds.ContextBuilder.buildApi(ContextBuilder.java:646)
at
com.orzota.service.cluster.model.EC2InstanceFactory.<init>(EC2InstanceFactory.java:139)
at
com.orzota.service.cluster.resource.ClusterResource.createInstances(CreateInstances.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:622)
at
com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
at
com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
at
com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
at
com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
at
com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
at
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at
com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
at
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
at
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
at
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
at
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
at
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
at
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
at
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:701)
_/*pom.xml*/_
<repositories>
<repository>
<id>jclouds-snapshots</id>
<url>https://repository.apache.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
...
<dependencies>
<dependency>
<groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-all</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>org.apache.jclouds.driver</groupId>
<artifactId>jclouds-sshj</artifactId>
<version>1.7.1</version>
</dependency>
...
<dependencies>
Regards,
Varad
Re: Errors while creating EC2 specific API Clients when using
jclouds 1.7.1 - No implementation bound for @com.google.inject.name.Named
at bindImageSupplier.
Posted by Andrew Phillips <an...@apache.org>.
> builder = ContextBuilder
> .newBuilder(new AWSEC2ApiMetadata.Builder().build())
> .credentials(awsCredentials.getAccessKey(),
> awsCredentials.getSecretKey())
> .modules(ImmutableSet.<Module> of(new SshjSshClientModule()));
Could you try simply with .newBuilder("aws-ec2") in the above code
snippet? And jclouds 1.7.2 is out, by the way - not that I expect that
to change what you're seeing, though.
Regards
ap