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

Jaikiran Pai jpai at redhat.com
Sat Jun 4 10:26:43 EDT 2011


I think the JaxrsDependencyProcessor needs to be fixed 
https://github.com/jbossas/jboss-as/blob/master/jaxrs/src/main/java/org/jboss/as/jaxrs/deployment/JaxrsDependencyProcessor.java 
to import the services from the dependencies it's adding.

-Jaikiran
On Saturday 04 June 2011 10:21 AM, Scott Stark wrote:
> Just adding the following did not do the trick, but have not looked into
> it further.
>
> <module xmlns="urn:jboss:module:1.0"
> name="org.jboss.resteasy.resteasy-jaxrs">
> <resources>
> <resource-root path="resteasy-jaxrs-2.1.0.GA.jar"/>
> <resource-root path="resteasy-jaxrs-2.1.0.GA-jandex.jar"/>
> <!-- Insert resources here -->
> </resources>
>
> <dependencies>
> <module name="javax.api"/>
> <module name="javax.annotation.api"/>
> <module name="javax.activation.api"/>
> <module name="javax.ws.rs.api"/>
> <module name="org.apache.httpcomponents" />
> <module name="org.apache.commons.codec" />
> <module name="org.scannotation.scannotation" />
> <module name="javax.servlet.api"/>
> <module name="org.jboss.resteasy.resteasy-jaxb-provider"
> services="import" />
> <module name="org.jboss.resteasy.resteasy-jackson-provider"
> services="import" />
> </dependencies>
> </module>
>
> On 6/3/11 6:18 PM, Jason Greene wrote:
>> 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
>
> _______________________________________________
> 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