0 Replies Latest reply on Jan 18, 2013 8:04 AM by Daniel Berg

    excluding classes from being exported from rar

    Daniel Berg Newbie

      Hello

      I have a resource adapter using jca 1.6 deployed on jboss 7.1.1.Final, the problem is that the classloader exports all classes included in the rar. Im trying to exclude the classes that are only used internally(implementation details..)

      Using various versions of jboss-deployment-structure files I have been unable to archive this.

      So I have a rar containing a few jar files with my implementation and some dependencies.

       

      adapter.rar

      - common_v1.jar (contains a class named A)

      - adapter.jar (contains connection factories, mdb interfaces, activation spec and so on..) placed in packages below int_.nato.adapter.*

      -META-INF/ jboss-deployment-structure.xml

       

      I want my adapter to export the content of adapter.jar to modules using it, but not the other stuff in common_v1.jar..

       

      I tried quite a few variations of the below without success..

      jboss-deployment-structure.xml

      <jboss-deployment-structure>

        <deployment>

          <exports>

                          <exclude path="/**"/>

                          <include path=" int_/nato/adapter/"**/>

        </exports>

        </deployment>

         </jboss-deployment-structure>

       

       

      The problem arrises when we try to use the adapter from a web application

      webapp.war

      -WEB-INF/lib/common_v2.jar(contains new version of class A and a class B)

      test.jsp

       

      in test.jsp I add

      <%= A.class.getCLassLoader()%>

      <%= A.class.getProtectionDomain().getCodeSource().getLocation()%>

      <%= B.class.getCLassLoader()%>

      <%= B.class.getProtectionDomain().getCodeSource().getLocation()%>

       

      Now for A.class I get the class packaged insite the rar

      For the B.class I get the class packaged inside the war.

      I also tried several variations of jboss-deployment-structure.xml to exclude the classes from import in the webapp (WEB-INF/jboss-deployment-structure.xml) doing so is not preffered as several applications are to be using the adapter..

       

      In production I end up with NoSuchMethodError since in version 2 of class A there are new methods used within the webapp, that does not exist in v1.

       

      Deploys by copying the rar and war to the deployments directory, and everythings works nicely if I just use the same version of common.jar, or just not include it in the webapp..

      Any pointers will be appreciated.

       

      The following seems to be of similar nature but trying the exclusions as described here does not really make any diffrence https://community.jboss.org/message/626315#626315