我正在尝试使用 Jcloud openstack neutron API,并且在尝试运行时遇到了此异常,我尝试如下构建 neutronApi。以此为例https://gist.github.com/everett-toews/8701756
Iterable<Module> modules = ImmutableSet.<Module>of();
String provider = "openstack-neutron";
String identity = "admin:admin"; // tenantName:userName
String credential = "devstack";
Properties prop = new Properties();
prop.setProperty("jclouds.relax-hostname", "true");
prop.setProperty("jclouds.trust-all-certs", "true");
neutronApi = ContextBuilder.newBuilder(provider)
.endpoint("https://<devstack IP>:5000/v2.0")
.credentials(identity, credential)
.modules(modules).overrides(prop)
.buildApi(NeutronApi.class);
我得到以下异常
[java] Exception in thread "main" com.google.inject.ConfigurationException: Guice configuration errors:
[java] 1) No implementation for org.jclouds.openstack.neutron.v2_0.NeutronApi was bound.
[java] while locating org.jclouds.openstack.neutron.v2_0.NeutronApi
[java] 1 error
[java] at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1004)
[java] at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1009)
[java] at org.jclouds.ContextBuilder.buildApi(ContextBuilder.java:655)
[java] at org.jclouds.ContextBuilder.buildApi(ContextBuilder.java:647)
[java] at openstack.NovaOpenstack.<init>(Unknown Source)
[java] at bootstrap.OpenstackBootstrap.main(Unknown Source)
Jcloud jar 版本 - 1.8,番石榴 - 3.0,guice - 1.7
请让我知道我做错了什么或如何解决这个问题。
提前致谢。