jboss 6.3.0: decent way to remove resteasy and use

2019-02-10 17:09发布

I am using jersey.

this is my jboss-deployment-structure:

<?xml version="1.0" encoding="UTF-8"  ?>  
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>  
<exclusions>
  <module name="org.jboss.resteasy.resteasy-atom-provider" />
  <module name="org.jboss.resteasy.resteasy-cdi" />
  <module name="org.jboss.resteasy.resteasy-jaxrs" />
  <module name="org.jboss.resteasy.resteasy-jaxb-provider" />
  <module name="org.jboss.resteasy.resteasy-jackson-provider" />
  <module name="org.jboss.resteasy.resteasy-jsapi" />
  <module name="org.jboss.resteasy.resteasy-multipart-provider" />
  <module name="org.jboss.resteasy.async-http-servlet-30" />
  <module name="javax.ws.rs.api" />      
</exclusions>         

<exclude-subsystems>
    <subsystem name="resteasy" />
    <subsystem name="webservices" />
    <subsystem name="jaxrs" />                         
</exclude-subsystems>          
</deployment>  
</jboss-deployment-structure>  

This alone does not work. I had to comment

<resource-root path="jboss-jaxrs-api_1.1_spec-1.0.1.Final-redhat-2.jar"/>

in

jbossHOME\modules\system\layers\base\javax\ws\rs\api\main\module.xml.

Now the rest service works fine, but by commenting the line, i am disabling resteasy for every application in the server! and that's a hack, not a proper solution. Is there a decent way to disable resteasy just for a given application without touching the general server configuration?

thanks

1条回答
在下西门庆
2楼-- · 2019-02-10 17:33

In JBoss 6 or 7 AS resteasy is loaded as a dependency module by the JavaEE module. Most of the time people get stuck here as we can not exclude JavaEE. However it's possible to exclude JavaEE and include the modules JavaEE is supposed to load except the one's we don't need.

For more details you can check here Foolproof method of excluding resteasy...

Sample jboss-deployment-structure.xml from the same place (Goes in WEB-INF/) :

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
  <deployment>
    <exclude-subsystems>
      <subsystem name="jaxrs" />
      <subsystem name="webservices" />
      <subsystem name="resteasy" />
    </exclude-subsystems>
    <exclusions>
      <module name="javaee.api" />
      <module name="javax.ws.rs.api" />
      <module name="org.jboss.as.jaxrs" />
      <module name="org.jboss.resteasy.resteasy-jaxrs" />
      <module name="org.jboss.resteasy.resteasy-cdi" />
      <module name="org.jboss.resteasy.jackson-provider" />
      <module name="org.jboss.resteasy.resteasy-atom-provider" />
      <module name="org.jboss.resteasy.resteasy-hibernatevalidator-provider" />
      <module name="org.jboss.resteasy.resteasy-jaxb-provider" />
      <module name="org.jboss.resteasy.resteasy-jettison-provider" />
      <module name="org.jboss.resteasy.resteasy-jsapi" />
      <module name="org.jboss.resteasy.resteasy-multipart-provider" />
      <module name="org.jboss.resteasy.resteasy-yaml-provider" />
      <module name="org.codehaus.jackson.jackson-core-asl" />
      <module name="org.codehaus.jackson.jackson-jaxrs" />
      <module name="org.codehaus.jackson.jackson-mapper-asl" />
      <module name="org.codehaus.jackson.jackson-xc" />
      <module name="org.codehaus.jettison" />
      <module name="org.jboss.as.webservices.*" />
      <module name="org.jboss.ws.*" />
    </exclusions>

    <dependencies>
      <module name="javax.activation.api" export="true" />
      <module name="javax.annotation.api" export="true" />
      <!-- <module name="javax.ejb.api" export="true" />
      <module name="javax.el.api" export="true" /> -->
      <module name="javax.enterprise.api" export="true" />
      <module name="javax.enterprise.deploy.api" export="true" />
      <module name="javax.inject.api" export="true" />
      <module name="javax.interceptor.api" export="true" />
      <!-- <module name="javax.jms.api" export="true" />
      <module name="javax.jws.api" export="true" />
      <module name="javax.mail.api" export="true" />
      <module name="javax.management.j2ee.api" export="true" /> -->
      <module name="javax.persistence.api" export="true" />
      <module name="javax.resource.api" export="true" />
      <!-- <module name="javax.rmi.api" export="true" />
      <module name="javax.security.auth.message.api" export="true" />
      <module name="javax.security.jacc.api" export="true" /> -->
      <module name="javax.servlet.api" export="true" />
      <module name="javax.servlet.jsp.api" export="true" />
      <module name="javax.transaction.api" export="true" />
      <module name="javax.validation.api" export="true" />

      <!-- <module name="javax.ws.rs.api" export="true" services="export" /> -->

      <module name="javax.xml.bind.api" export="true" />
      <module name="javax.xml.registry.api" export="true" />
      <module name="javax.xml.soap.api" export="true" />
      <module name="javax.xml.ws.api" export="true" />

      <!-- This one always goes last. -->
      <module name="javax.api" export="true" />
    </dependencies>

  </deployment>
</jboss-deployment-structure>
查看更多
登录 后发表回答