[jboss-as7-dev] How should META-INF/services be dealt with in modules?

Jason Greene jgreene at redhat.com
Fri Jun 3 21:18:44 EDT 2011


Without looking my initial guess is that therest easy module.xml does not have services="import" on all of those extension deps (assuming they are separate modules). We exclude META-INF/services by default.

Sent from my iPad

On Jun 3, 2011, at 6:42 PM, Scott Stark <sstark at redhat.com> wrote:

> So I have been looking at what the minimum is for a reasteasy based war 
> to work with an application/xml content type since the providers for 
> that are bundled in the as7 modules, but the providers are not getting 
> registered by default. The war does not include any of the resteasy jars 
> in its WEB-INF/lib as it looks like everything should already be 
> included in the as7 modules.
> 
> In order for this to work, I have to register all of the 
> javax.ws.rs.ext.Provider annotated classes from the 
> resteasy-jaxb-provider-2.1.0.GA.jar in my resteasy Application:
> 
> import javax.ws.rs.core.Application;
> 
> public class StatusApplication extends Application {
> 
>    @Override
>    public Set<Class<?>> getClasses() {
>        Class<?>[] classes = {
> 
> org.jboss.resteasy.plugins.providers.jaxb.JAXBXmlSeeAlsoProvider.class,
> 
> org.jboss.resteasy.plugins.providers.jaxb.JAXBXmlRootElementProvider.class,
> 
> org.jboss.resteasy.plugins.providers.jaxb.JAXBElementProvider.class,
> 
> org.jboss.resteasy.plugins.providers.jaxb.JAXBXmlTypeProvider.class,
> 
> org.jboss.resteasy.plugins.providers.jaxb.CollectionProvider.class,
>            org.jboss.resteasy.plugins.providers.jaxb.MapProvider.class,
> 
> org.jboss.resteasy.plugins.providers.jaxb.XmlJAXBContextFinder.class
>        };
>       for(Class<?> c : classes)
>         providers.add(c);
>       return providers;
>    }
> 
> Normally resteasy is expecting that it can locate these via the jar 
> META-INF/services/javax.ws.rs.ext.Providers mechanism, but when the 
> resteasy framework does the following call while processing the application:
> 
>       Enumeration<URL> en = 
> Thread.currentThread().getContextClassLoader().getResources("META-INF/services/" 
> + Providers.class.getName());
> 
> all it sees is the 
> resteasy-jaxrs-2.1.0.GA.jar/META-INF/services/javax.ws.rs.ext.Providers 
> resources. It looks like many of the other resteasy provider modules 
> would not be loaded simply because they are purely extension modules 
> with implementations.
> 
> What is the correct way to integrate a collection of services using the 
> META-INF/services mechanism?
> 
> _______________________________________________
> jboss-as7-dev mailing list
> jboss-as7-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev



More information about the jboss-as7-dev mailing list