Hi, I have a double question here.
After this SO thread, I decided to start using Jackson instead of Moxy with
jersey 2.13.
http://stackoverflow.com/questions/29322605/how-to-return-a-json-object-from-a-hashmap-with-moxy-and-jersey
(incorrectly stating that I am using .17).
I got two problems.
first with 2.13 and after following the advice to change Moxy with Jackson
so I can have better behaviour for returning HashMaps like JSON I put into
my pom the media-jackson dependency and changes the client config from
MoxyFeature to :
.register(JacksonFeature.class).build();
that was the only change I made.
This broke this test :
response = client.target(hostname + "/rest/users/arisalexis/friends/").request()
.header("Cookie",
getSessionId()).post(Entity.entity(friendRequest,MediaType.APPLICATION_JSON));
with the error :
Mar 29, 2015 11:12:47 PM
org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor
aroundWriteTo
SEVERE: MessageBodyWriter not found for media type=text/html, type=class
es.revib.server.rest.entities.request.FriendRequest, genericType=class
es.revib.server.rest.entities.request.FriendRequest.
javax.ws.rs.InternalServerErrorException: HTTP 500 Internal Server Error
returning objects seems to be working OK with Jackson.
it is weird that the report says media type=text/html when I explicitly
call it with the MediaType and the resource is also annotated with
@Consumes JSON.
trying to fix this I thought it was a good idea to upgrade to latest.
(that's usually a bad idea because there are many breaking changes with
releases).
with 2.17 a previously working code :
Form f = new Form();
f.param("user", "arisalexis");
f.param("password", "XXX");
Response response = client.target(hostname + "/rest/auth/login").request()
.post(Entity.form(f));
is giving : SEVERE: StandardWrapper.Throwable
java.lang.NoClassDefFoundError:
org/glassfish/jersey/internal/inject/ExtractorException
at
org.glassfish.jersey.media.multipart.internal.FormDataParamValueFactoryProvider.createValueFactory(FormDataParamValueFactoryProvider.java:439)
at
org.glassfish.jersey.server.internal.inject.AbstractValueFactoryProvider.getValueFactory(AbstractValueFactoryProvider.java:134)
at
org.glassfish.jersey.server.spi.internal.ParameterValueHelper.getValueFactory(ParameterValueHelper.java:145)
at
org.glassfish.jersey.server.spi.internal.ParameterValueHelper.createValueProviders(ParameterValueHelper.java:124)
at
org.glassfish.jersey.server.model.Invocable.getValueProviders(Invocable.java:322)
Are these two related? Can anyone help? Thanks
Best Regards,
Aris Giachnis