I activate resteasy with the simple Application extension class:

public class JaxRsActivator extends Application {

Everything works ok. But when I add resteasy jackson provider:


... I get the following exception:

java.lang.RuntimeException: Illegal to inject a message body into a
singleton into public

I can solve the problem by overriding the getSingletons() method in my
JaxRsActivator class:

    public Set<Object> getSingletons() {
        return Collections.<Object> singleton(new

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:

So now I have to manually register all the rest providers via overriding the
getClasses() method:

    public Set<Class<?>> getClasses() {
        Set<Class<?>> classes = new HashSet<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. 
Resteasy-users mailing list

Reply via email to