1 Reply Latest reply on Oct 31, 2013 9:56 PM by David Lloyd

    Is it possible to use jboss-deployment-structure.xml to exclude buggy transitive dependency from module I depend on (and replace it ?)

    Dmytro Zemnytskiy Newbie

      In my Jax-rs application I need to use jackson2 dependency instead of default one, that is include module

      'org.jboss.resteasy.resteasy-jackson2-provider'  and exclude 'org.jboss.resteasy.resteasy-jackson-provider'

       

      Unfortunately, jackson2 provider module depends on buggy "com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider" module

      (it misses dependency to "javax.xml.bind.api" module).

       

      This causes following error:

       

      Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlElement

        at com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector.<init>(JaxbAnnotationIntrospector.java:111)

        at com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector.<init>(JaxbAnnotationIntrospector.java:98)

        at com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector.<init>(JaxbAnnotationIntrospector.java:90)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.7.0_40]

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) [rt.jar:1.7.0_40]

        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.7.0_40]

        at java.lang.reflect.Constructor.newInstance(Constructor.java:526) [rt.jar:1.7.0_40]

        at java.lang.Class.newInstance(Class.java:374) [rt.jar:1.7.0_40]

        at com.fasterxml.jackson.jaxrs.json.JsonMapperConfigurator._resolveIntrospector(JsonMapperConfigurator.java:111)

        at com.fasterxml.jackson.jaxrs.json.JsonMapperConfigurator._resolveIntrospectors(JsonMapperConfigurator.java:84)

        at com.fasterxml.jackson.jaxrs.cfg.MapperConfiguratorBase._setAnnotations(MapperConfiguratorBase.java:120)

        at com.fasterxml.jackson.jaxrs.json.JsonMapperConfigurator.getDefaultMapper(JsonMapperConfigurator.java:45)

        at com.fasterxml.jackson.jaxrs.base.ProviderBase.locateMapper(ProviderBase.java:710)

        at org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider.readFrom(ResteasyJackson2Provider.java:106) [resteasy-jackson2-provider-3.0.4.Final.jar:]

       

      I'm curious, if it is possible to solve this problem just with jboss-deployment-structure.xml, ie redefine buggy module with correctly set dependencies ?

      I tried to exclude buggy module, like this:

       

      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">

        <sub-deployment name="readytech-server.war">

        <dependencies>

        <module name="io.undertow.servlet" />

        <module name="org.jboss.resteasy.resteasy-jackson2-provider" services="import" />

        </dependencies>

        <exclusions>

        <module name="org.jboss.resteasy.resteasy-jackson-provider" />

        <module name="com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider" />

        </exclusions>

        </sub-deployment>

      </jboss-deployment-structure>

       

      but this seems does not have effect, the same error happens, this means, exclusions aren't transitive, that is, I cannot achieve that resteasy-jackson2-provider no more used jackson-jaxrs-json-provider.

       

      Do I understand this right and is there still any working solution (besides patching module definition in wildfly ?)