How can I reproduce the problem?  What app server?  What does your 
web.xml look like?

Thanks

On 10/24/11 7:37 AM, for...@paaro.com wrote:
> Hi,
>
> I activate resteasy with the simple Application extension class:
>
> @ApplicationPath("/rest")
> public class JaxRsActivator extends Application {
> }
>
> Everything works ok. But when I add resteasy jackson provider:
>
> <dependency>
> <groupId>org.jboss.resteasy</groupId>
> <artifactId>resteasy-jackson-provider</artifactId>
> <version>2.2.2.GA <http://2.2.2.GA></version>
> </dependency>
>
> ... I get the following exception:
>
> java.lang.RuntimeException: Illegal to inject a message body into a singleton 
> into public 
> org.codehaus.jackson.jaxrs.JacksonJsonProvider(org.codehaus.jackson.map.ObjectMapper,org.codehaus.jackson.jaxrs.Annotations[])
>
> I can solve the problem by overriding the getSingletons() method in my
> JaxRsActivator class:
>
>      @Override
>      public Set<Object> getSingletons() {
>          return Collections.<Object> singleton(new
> JacksonJaxbJsonProvider());
>      }
>
> But then the rest provider class scanning stops working and I get the
> following error:
>
> _Could not find resource for relative : /users of full path:
> https://localhost:8443/sample/rest/users_
>
> So now I have to manually register all the rest providers via overriding
> the getClasses() method:
>
>      @Override
>      public Set<Class<?>> getClasses() {
>          Set<Class<?>> classes = new HashSet<Class<?>>();
>          classes.add(UserResourceRESTService.class);
>          return classes;
>      }
>
> Is there a way to use JacksonJaxbJsonProvider while still maintaining
> the scanning ability?
>
> Btw, I don't use web.xml file. Should I?
>
>
> ------------------------------------------------------------------------------
> The demand for IT networking professionals continues to grow, and the
> demand for specialized networking skills is growing even more rapidly.
> Take a complimentary Learning@Cisco Self-Assessment and learn
> about Cisco certifications, training, and career opportunities.
> http://p.sf.net/sfu/cisco-dev2dev
>
>
>
> _______________________________________________
> Resteasy-users mailing list
> Resteasy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/resteasy-users

-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com

------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users

Reply via email to