I have a REST client code working OK locally in a server but failing to unmarshall JSON into Java when packaged and deployed to Bluemix with same Liberty versión (8.5.5.9). Failing code:
Response response = get("/v0.1/path/" + var + "/path/" + var2);
return response.readEntity(MyClass.class);
In bluemix I get this exception:
2016-05-29T13:32:26.16+0200 [App/0] ERR Caused by: java.lang.NullPointerException 2016-05-29T13:32:26.16+0200 [App/0]
ERR at org.apache.cxf.jaxrs.impl.tl.ThreadLocalProviders.getContextResolver(ThreadLocalProviders.java:50) 2016-05-29T13:32:26.16+0200 [App/0] ERR at [internal classes] 2016-05-29T13:32:26.16+0200 [App/0] ERR at com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider._locateMapperViaProvider(JacksonJsonProvider.java:206) 2016-05-29T13:32:26.16+0200 [App/0] ERR at com.fasterxml.jackson.jaxrs.base.ProviderBase.locateMapper(ProviderBase.java:853) 2016-05-29T13:32:26.16+0200 [App/0] ERR at com.fasterxml.jackson.jaxrs.base.ProviderBase.readFrom(ProviderBase.java:764) 2016-05-29T13:32:26.16+0200 [App/0] ERR at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBodyReader(JAXRSUtils.java:1356) 2016-05-29T13:32:26.16+0200 [App/0] ERR ... 13 more
The REST result by the server is OK. In fact, if I get that JSON code as String and use a Jackson mapper to unmarshall it , it works ok, but not if I do it the standard JAX-RS 2.0 client way:
return response.readEntity(MyClass.class);
which will fail with error above.
Edit: Liberty Versions used:
The build pack wee run locally (JAX-RS 2.0 client requests working OK) is:
(WebSphere Application Server 8.5.5.9/wlp-1.0.12.cl50920160227-1523) on Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_77-b03 (en_US)
The one in BlueMix (JAX-RS 2.0 client requests throwing NPE at CXF class):
(WebSphere Application Server 2016.5.0.0/wlp-1.0.13.20160430-1625) on IBM J9 VM, version pxa6480sr3-20160428_01 (SR3) (en_US)
Thanks for any help