<< Back to previous view

[GLASSFISH-20576] Internal Server Error on JSON REST web service returning array Created: 23/May/13  Updated: 13/Jun/13

Status: In Progress
Project: glassfish
Component/s: jax-rs
Affects Version/s: 4.0_b89_RC5
Fix Version/s: 4.0.1

Type: Bug Priority: Major
Reporter: Peter Salomonsen Assignee: Michal Gajdos
Resolution: Unresolved Votes: 1
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

glassfish-4.0-b90-05_22_2013, jdk1.7

Tags: glassfish4 jersey rest json
Participants: Marek Potociar, Michal Gajdos and Peter Salomonsen


The following REST web service causes internal server error (and no stack trace in server.log). Returning an empty array works, but as soon as there are elements in the array - it does not.

public Object[] getArray() {
return new Object[] {"Test"};

Comment by Marek Potociar [ 28/May/13 04:52 PM ]

Targeting for GF 4.0.1, Re-assigning to dev eng. for evaluation.

Comment by Michal Gajdos [ 11/Jun/13 03:42 PM ]

Which Json provider from Jersey are you using? Have you configured one? Thanks.

Comment by Peter Salomonsen [ 11/Jun/13 04:05 PM ]

I haven't configured anything - no web.xml at all. Just application config class like this:

public class ApplicationConfig extends Application {


And the REST service class:

public class GenericResource {

private UriInfo context;

public GenericResource() {

public Object[] getArray() {
return new Object[] {"Test"};

That's all.

Comment by Michal Gajdos [ 13/Jun/13 02:43 PM ]

The easiest way would be registering JacksonFeature (make sure you have jersey-media-json-jackson on your classpath) in your ApplicationConfig. Something like:

public Set<Class<?>> getClasses() {
    return new HashSet<Class<?>>() {{ add(GenericResource.class); add(JacksonFeature.class); }};
Comment by Peter Salomonsen [ 13/Jun/13 04:34 PM ]

org.glassfish.jersey.jackson.JacksonFeature works as you propose. MoxyJsonFeature gives the server error, and JettisonFeature says it cannot find a MessageBodyWriter. Is MoxyJsonFeature the default? Shouldn't this also be able to handle arrays?

Generated at Sun Apr 20 00:03:32 UTC 2014 using JIRA 4.0.2#472.