我目前正在使用 openstack4j 库连接到 Bluemix 中的对象存储。当我尝试将 java 代码作为 java 应用程序在本地运行时,连接似乎可以工作,但是当我在 Bluemix 中部署与我们的 Java Web 应用程序相同的代码时,出现以下错误。当我尝试执行身份验证方法时,会发生失败的代码:
OSClient os = OSFactory.builderV3()
.endpoint(auth_url)
.credentials(username, password)
.scopeToProject(projectIdent, domainIdent)
.authenticate();
Exception thrown by application class 'org.openstack4j.connectors.jersey2.HttpExecutorServiceImpl.invoke:58'
org.openstack4j.api.exceptions.ConnectionException: org.apache.cxf.interceptor.Fault: No message body writer has been found for class org.openstack4j.openstack.identity.domain.v3.KeystoneAuth, ContentType: application/json
at org.openstack4j.connectors.jersey2.HttpExecutorServiceImpl.invoke(HttpExecutorServiceImpl.java:58)
at org.openstack4j.connectors.jersey2.HttpExecutorServiceImpl.execute(HttpExecutorServiceImpl.java:33)
at org.openstack4j.core.transport.internal.HttpExecutor.execute(HttpExecutor.java:51)
at org.openstack4j.openstack.internal.OSAuthenticator.authenticateV3(OSAuthenticator.java:156)
at org.openstack4j.openstack.internal.OSAuthenticator.invoke(OSAuthenticator.java:78)
at org.openstack4j.openstack.client.OSClientBuilder$ClientV3.authenticate(OSClientBuilder.java:163)
at org.openstack4j.openstack.client.OSClientBuilder$ClientV3.authenticate(OSClientBuilder.java:127)
at com.ibm.sample.ObjectStorageService.(ObjectStorageService.java:36)
at wasdev.sample.servlet.SimpleServlet.doGet(SimpleServlet.java:30)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1290)
at [internal classes]
Caused by: javax.ws.rs.ProcessingException: org.apache.cxf.interceptor.Fault: No message body writer has been found for class org.openstack4j.openstack.identity.domain.v3.KeystoneAuth, ContentType: application/json
at org.apache.cxf.jaxrs.client.WebClient.doResponse(WebClient.java:1206)
at [internal classes]
at org.openstack4j.connectors.jersey2.HttpCommand.execute(HttpCommand.java:79)
at org.openstack4j.connectors.jersey2.HttpExecutorServiceImpl.invokeRequest(HttpExecutorServiceImpl.java:65)
at org.openstack4j.connectors.jersey2.HttpExecutorServiceImpl.invoke(HttpExecutorServiceImpl.java:56)
... 12 more
Caused by: org.apache.cxf.interceptor.Fault: No message body writer has been found for class org.openstack4j.openstack.identity.domain.v3.KeystoneAuth, ContentType: application/json
at org.apache.cxf.jaxrs.client.WebClient$BodyWriter.doWriteBody(WebClient.java:1286)
... 16 more
Caused by: javax.ws.rs.ProcessingException: No message body writer has been found for class org.openstack4j.openstack.identity.domain.v3.KeystoneAuth, ContentType: application/json
at org.apache.cxf.jaxrs.client.AbstractClient.reportMessageHandlerProblem(AbstractClient.java:758)
... 16 more
Caused by: org.codehaus.jackson.map.JsonMappingException: (was java.lang.NullPointerException) (through reference chain: org.openstack4j.openstack.identity.domain.v3.KeystoneAuth["id"])
at org.codehaus.jackson.map.JsonMappingException.wrapWithPath(JsonMappingException.java:215)
... 16 more
Caused by: java.lang.NullPointerException:
at org.openstack4j.openstack.identity.domain.v3.KeystoneAuth.getId(KeystoneAuth.java:90)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.get(BeanPropertyWriter.java:285)