[Jersey] how to avoid classpath scanning?

From: sreeram duvur <>
Date: Fri, 9 Aug 2013 19:34:32 -0700

I have a peculiar regression in my Jersey/Glassfish web app after a recent
Glassfish upgrade to 3.1.2

Jersey end points that do not return a collection like ArrayList or Vector
are doing fine. When the return type is an ArrayList I am seeing the
exception: com.sun.jersey.api.MessageException: A
> message body writer for Java class java.util.ArrayList, and Java type class
> java.util.ArrayList, and MIME media type application/json was not found
The app includes jersey libraries. The error happens for XML or JSON

The suspicion is that the wrong writer is being invoked and it does not how
to handle this type. Since this is independent of XML or JSON, it is
probably a JAXB issue?

This is what Jakub said elsewhere:

".. if you added some extra libs, and your application is configured to
scan the class path, then wrong message body workers could have been
picked. To resolve this, you need to get rid of class-path scanning (it
happens if your
application returns empty list from it's getClasses and getSingletons
methods. For production deployments, it is more practical to name your
classes/instances so that you both save time (for scanning) and end up with
safe predictable config."

My question is how to I get "rid of classpath scanning" for my app? Any