2014-10-05 77 views
0

我想使用Jcloud openstack neutron API,並且在嘗試運行時遇到此異常,我嘗試構建如下的neutronApi。把這個作爲一個例子https://gist.github.com/everett-toews/8701756jcloud openstack-neutron:線程「main」中的異常com.google.inject.ConfigurationException:

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罐子版本 - 1.8,番石榴 - 3.0,吉斯 - 1.7

請讓我知道什麼是我做錯了或如何解決這個問題。

在此先感謝。

回答

0
import org.jclouds.openstack.neutron.v2.NeutronApi; 

import org.jclouds.openstack.neutron.v2.domain.Network; 

import org.jclouds.openstack.neutron.v2.domain.NetworkStatus; 

import org.jclouds.openstack.neutron.v2.domain.NetworkType; 

import org.jclouds.openstack.neutron.v2.domain.Networks; 

import org.jclouds.openstack.neutron.v2.features.NetworkApi; 

import org.jclouds.openstack.neutron.v2_0.options.CreateNetworkOptions; 

使用根據進口上述進口

和更改代碼的方法

相關問題