users@jersey.java.net

[Jersey] Re: JsonMessageWriter not working under Netbeans 6.9.1

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Wed, 09 Feb 2011 16:04:23 +0100

On 02/09/2011 03:43 PM, Gili wrote:
>
> Gili wrote:
>
>> 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
>>
>>
> I figured it out. Classic case of user error. My servlet context was defined
> as:
>
> public class GuiceConfig extends GuiceServletContextListener
> {
> @Override
> protected Injector getInjector()
> {
> return Guice.createInjector(new JerseyServletModule()
> {
> @Override
> protected void configureServlets()
> {
> Map<String, String> params = Maps.newHashMap();
> params.put(ServletContainer.RESOURCE_CONFIG_CLASS,
> ClasspathResourceConfig.class.getName());
> params.put(PackagesResourceConfig.PROPERTY_PACKAGES,
> GuiceConfig.class.getPackage().getName());
> serve("/*").with(GuiceContainer.class);
> }
> });
> }
> }
>
> Notice the last line ignores the parameters declared above it. The line
> should read:
>
> serve("/*").with(GuiceContainer.class, params);
>
> PS: Is it possible to update
> http://jersey.java.net/nonav/apidocs/latest/contribs/jersey-guice/com/sun/jersey/guice/spi/container/servlet/package-summary.html
> to contain an example of using RESOURCE_CONFIG_CLASS and PROPERTY_PACKAGES
> parameters? It took me a while to figure this out.
>
Hi Gili,

yes, it definitely is.. can you please log an issue about that? Maybe if
you already have that sample, you can include it.. or create patch.

Thanks,
Pavel


> Thanks,
> Gili
>