Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-244

NullPointerException : Cannot provide charset MediaType with application/json

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.1.GA
    • 1.1.RC2
    • None
    • None

      The following REST service generate a NullPointerException when calling /test/bug

      package mytest;

      import javax.ws.rs.GET;
      import javax.ws.rs.Path;
      import javax.ws.rs.Produces;

      @Path("/test")
      public class TestService {
      @GET
      @Path("bug")
      @Produces(

      {"application/json;charset=UTF-8"}

      )
      public MyObject bug()

      { return new MyObject(); }

      @GET
      @Path("nobug")
      @Produces({"application/json"})
      public MyObject nobug() { return new MyObject(); }

      }

      Exception:

      java.lang.NullPointerException
      org.jboss.resteasy.plugins.providers.jaxb.BaseMarshaller.setProperty(BaseMarshaller.java:35)
      org.jboss.resteasy.plugins.providers.jaxb.AbstractJAXBProvider.setCharset(AbstractJAXBProvider.java:141)
      org.jboss.resteasy.plugins.providers.jaxb.AbstractJAXBProvider.getMarshaller(AbstractJAXBProvider.java:118)
      org.jboss.resteasy.plugins.providers.jaxb.AbstractJAXBProvider.writeTo(AbstractJAXBProvider.java:92)
      org.jboss.resteasy.core.interception.MessageBodyWriterContextImpl.proceed(MessageBodyWriterContextImpl.java:114)
      org.jboss.resteasy.plugins.interceptors.encoding.GZIPEncodingInterceptor.write(GZIPEncodingInterceptor.java:46)
      org.jboss.resteasy.core.interception.MessageBodyWriterContextImpl.proceed(MessageBodyWriterContextImpl.java:120)
      org.jboss.resteasy.core.ServerResponse.writeTo(ServerResponse.java:184)
      org.jboss.resteasy.core.SynchronousDispatcher.writeJaxrsResponse(SynchronousDispatcher.java:413)
      org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:376)
      org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:160)
      org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:113)
      org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:69)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

              patriot1burke@gmail.com Bill Burke (Inactive)
              dcausse_jira David Causse (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: