0
我在嘗試連接我的OpenStack時遇到了一些問題。我使用jclouds,這是我的代碼:jclouds中的第一步
context = ContextBuilder.newBuilder("openstack-nova")
.endpoint("http://xxx.xxx.xxx.xxx:5000/v2.0/")
.credentials("tenantname:username", "password")
.modules(ImmutableSet.<Module> of(new SLF4JLoggingModule(), new SshjSshClientModule()))
.buildView(ComputeServiceContext.class);
service = context.getComputeService();
for(ComputeMetadata node: service.listNodes()) {
System.out.println("NODE: " + node.getId());
}
但它總是返回以下錯誤:
DEBUG [org.jclouds.rest.internal.InvokeHttpMethod] [main] >> invoking AuthenticationApi.authenticateWithTenantNameAndCredentials
DEBUG [org.jclouds.http.internal.JavaUrlHttpCommandExecutorService] [main] Sending request -1502473400: POST http://xxx.xxx.xxx.xxx:5000/v2.0/tokens HTTP/1.1
ERROR [org.jclouds.http.internal.JavaUrlHttpCommandExecutorService] [main] Command not considered safe to retry because request method is POST: [method=org.jclouds.openstack.keystone.v2_0.AuthenticationApi.public abstract org.jclouds.openstack.keystone.v2_0.domain.Access org.jclouds.openstack.keystone.v2_0.AuthenticationApi.authenticateWithTenantNameAndCredentials(java.lang.String,org.jclouds.openstack.keystone.v2_0.domain.PasswordCredentials)[tenantname, PasswordCredentials{username=username, password=*****}], request=POST http://xxx.xxx.xxx.xxx:5000/v2.0/tokens HTTP/1.1]
我在Eclipse和IntelliJ IDEA的發展。我一直在審查代理配置,但一切都很正常。
請問任何人都可以幫我嗎?
謝謝!
謝謝你!你的答案是完美的,我已經在我的代碼中使用它,它運行良好!非常感謝!! –