运行实例异常跟踪:
1.问题描述及解决
2012-11-23 14:27:41 org.glassfish.jersey.filter.LoggingFilter log
信息: 1 * LoggingFilter - Request received on thread main
1 > POST http://192.168.2.12:5000/v2.0/tokens
1 > Accept: application/json
1 > Content-Type: application/json
{
"auth" : {
"passwordCredentials" : {
"username" : "admin",
"password" : "password"
}
}
}
2012-11-23 14:27:41 org.glassfish.jersey.filter.LoggingFilter log
信息: 2 * LoggingFilter - Response received on thread main
2 < 200
2 < Vary: X-Auth-Token
2 < Date: Fri, 23 Nov 2012 06:27:43 GMT
2 < Content-Length: 276
2 < Content-Type: application/json
2 < Connection: keep-alive
{"access": {"token": {"issued_at": "06:27:43.551375", "expires": "2012-11-24T06:27:43Z", "id": "f639195fbb804e198e58abb20c42d7a8"}, "serviceCatalog": {}, "user": {"username": "admin", "roles_links": [], "id": "cba680a55e36422683462ac8707236a5", "roles": [], "name": "admin"}}}
Exception in thread "main" javax.ws.rs.client.ClientException: Unexpected error during response processing.
at org.glassfish.jersey.client.JerseyInvocation.translate(JerseyInvocation.java:725)
at org.glassfish.jersey.client.JerseyInvocation.access$500(JerseyInvocation.java:86)
at org.glassfish.jersey.client.JerseyInvocation$2.call(JerseyInvocation.java:629)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:420)
at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:625)
at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:387)
at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:290)
at org.openstack.keystone.api.Authenticate.execute(Authenticate.java:60)
at org.openstack.keystone.api.Authenticate.execute(Authenticate.java:1)
at org.openstack.keystone.KeystoneClient.execute(KeystoneClient.java:23)
at org.openstack.examples.compute.test.NovaListImages.main(NovaListImages.java:38)
Caused by: javax.ws.rs.MessageProcessingException: Error reading entity from input stream.
at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:826)
at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:749)
at org.glassfish.jersey.client.InboundJaxrsResponse.readEntity(InboundJaxrsResponse.java:94)
at org.glassfish.jersey.client.JerseyInvocation.translate(JerseyInvocation.java:719)
... 10 more
Caused by: org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "issued_at" (Class org.openstack.keystone.model.Access$Token), not marked as ignorable
at [Source: org.glassfish.jersey.message.internal.EntityInputStream@145f939; line: 1, column: 37] (through reference chain: org.openstack.keystone.model.Access["token"]->org.openstack.keystone.model.Token["issued_at"])
at org.codehaus.jackson.map.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:53)
at org.codehaus.jackson.map.deser.StdDeserializationContext.unknownFieldException(StdDeserializationContext.java:267)
at org.codehaus.jackson.map.deser.std.StdDeserializer.reportUnknownProperty(StdDeserializer.java:673)
at org.codehaus.jackson.map.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:659)
at org.codehaus.jackson.map.deser.BeanDeserializer.handleUnknownProperty(BeanDeserializer.java:1365)
at org.codehaus.jackson.map.deser.BeanDeserializer._handleUnknown(BeanDeserializer.java:725)
at org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:703)
at org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:580)
at org.codehaus.jackson.map.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:299)
at org.codehaus.jackson.map.deser.SettableBeanProperty$FieldProperty.deserializeAndSet(SettableBeanProperty.java:579)
at org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:697)
at org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:580)
at org.codehaus.jackson.map.ObjectMapper._unwrapAndDeserialize(ObjectMapper.java:2802)
at org.codehaus.jackson.map.ObjectMapper._readValue(ObjectMapper.java:2702)
at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1315)
at org.codehaus.jackson.jaxrs.JacksonJsonProvider.readFrom(JacksonJsonProvider.java:419)
at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.aroundReadFrom(ReaderInterceptorExecutor.java:208)
at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor.proceed(ReaderInterceptorExecutor.java:158)
at org.glassfish.jersey.message.internal.ExceptionWrapperInterceptor.aroundReadFrom(ExceptionWrapperInterceptor.java:70)
at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor.proceed(ReaderInterceptorExecutor.java:158)
at org.glassfish.jersey.message.internal.MessageBodyFactory.readFrom(MessageBodyFactory.java:852)
at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:811)
... 13 more
处理结果是在org.openstack.keystone.model.Access类中添加
private String issued_at;
public String getIssued_at() {
return issued_at;
}
public void setIssued_at(String issuedAt) {
issued_at = issuedAt;
}