users@jersey.java.net

[Jersey] JsonMessageWriter not working under Netbeans 6.9.1

From: Gili <cowwoc_at_bbs.darktech.org>
Date: Tue, 8 Feb 2011 14:28:14 -0800 (PST)

Hi,

I am getting frustrated with the fact that I keep on getting stuck trying to
do the same thing every time I start a new project :)

I'm trying to get a simple webapp to run under Jersey 1.5, Netbeans 6.9.1,
Glassfish 3.0 and Guice 2.0.

When I hit a resource I get:

INFO: Loading application com.amayagaming_MoneyWheel.Server_war_1.0-SNAPSHOT
at /
INFO: com.amayagaming_MoneyWheel.Server_war_1.0-SNAPSHOT was successfully
deployed in 1,554 milliseconds.
INFO: Registering com.amayagaming.moneywheel.server.WinnerResource as a root
resource class
INFO: Initiating Jersey application, version 'Jersey: 1.5 01/14/2011 12:36
PM'
INFO: Binding com.amayagaming.moneywheel.server.WinnerResource to
GuiceManagedComponentProvider with the scope "PerRequest"
SEVERE: A message body writer for Java class
com.amayagaming.moneywheel.server.data.User, and Java type class
com.amayagaming.moneywheel.server.data.User, and MIME media type
application/json was not found
SEVERE: The registered message body writers compatible with the MIME media
type are:
application/json ->
  com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider$App
  com.sun.jersey.json.impl.provider.entity.JSONArrayProvider$App
  com.sun.jersey.json.impl.provider.entity.JSONObjectProvider$App
  com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$App
  com.sun.jersey.json.impl.provider.entity.JSONListElementProvider$App
*/* ->
  com.sun.jersey.core.impl.provider.entity.FormProvider
  com.sun.jersey.core.impl.provider.entity.MimeMultipartProvider
  com.sun.jersey.core.impl.provider.entity.StringProvider
  com.sun.jersey.core.impl.provider.entity.ByteArrayProvider
  com.sun.jersey.core.impl.provider.entity.FileProvider
  com.sun.jersey.core.impl.provider.entity.InputStreamProvider
  com.sun.jersey.core.impl.provider.entity.DataSourceProvider
  com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General
  com.sun.jersey.core.impl.provider.entity.ReaderProvider
  com.sun.jersey.core.impl.provider.entity.DocumentProvider
  com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider
  com.sun.jersey.core.impl.provider.entity.SourceProvider$SourceWriter
  com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider$General
  com.sun.jersey.json.impl.provider.entity.JSONArrayProvider$General
  com.sun.jersey.json.impl.provider.entity.JSONObjectProvider$General
  com.sun.jersey.json.impl.provider.entity.JSONWithPaddingProvider
  com.sun.jersey.server.impl.template.ViewableMessageBodyWriter
  com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General
  com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General
  com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$General
  com.sun.jersey.json.impl.provider.entity.JSONListElementProvider$General
  com.sun.jersey.json.impl.provider.entity.JacksonProviderProxy

SEVERE: Mapped exception to response: 500 (Internal Server Error)
javax.ws.rs.WebApplicationException: com.sun.jersey.api.MessageException: A
message body writer for Java class
com.amayagaming.moneywheel.server.data.User, and Java type class
com.amayagaming.moneywheel.server.data.User, and MIME media type
application/json was not found
        at
com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:285)
        at
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1316)
        at
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1229)
        at
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1219)
        at
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:419)
        at
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
        at
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
        at
com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:216)
        at
com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:141)
        at
com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:93)
        at
com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:63)
        at
com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:122)
        at
com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:110)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:277)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
        at
com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
        at
org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
        at
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
        at
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
        at
com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
        at
com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
        at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
        at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
        at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
        at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
        at
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
        at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
        at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
        at
com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
        at
com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
        at java.lang.Thread.run(Thread.java:662)
Caused by: com.sun.jersey.api.MessageException: A message body writer for
Java class com.amayagaming.moneywheel.server.data.User, and Java type class
com.amayagaming.moneywheel.server.data.User, and MIME media type
application/json was not found
        ... 39 more


I've modified Glassfish (classpath delegation, etc) to use Jersey 1.5 in the
WAR file. Please take a look at the attached testcase and let me know if you
see anything wrong. This is giving me white hairs :)

http://jersey.576304.n2.nabble.com/file/n6005749/MoneyWheel.Server.zip
MoneyWheel.Server.zip

Thanks,
Gili
-- 
View this message in context: http://jersey.576304.n2.nabble.com/JsonMessageWriter-not-working-under-Netbeans-6-9-1-tp6005749p6005749.html
Sent from the Jersey mailing list archive at Nabble.com.