6 Replies Latest reply on Jul 3, 2012 8:39 AM by ebross

    How to exlude classes from WAR with jboss-deployment-structure.xml?

    mkaesz

      Hey guys,

       

      I read everything about Modules and the jboss-deployment-structure.xml, but one thing I can't get to work is the following:

       

      I have one War. This war includes several Jars in WEB-INF/lib. How can I exclude some classes which are in one of this Jars?

       

      I tried e.g. this:

       

      <jboss-deployment-structure>

        <deployment>

          <exports>

                          <exclude path="/**"/>

                          <exclude path="javax/mail"/>

                          <exclude path="javax/mail/"/>

                          <exclude path="javax/mail/**"/>

                          <exclude path="javax/mail/*"/>

                          <exclude path="javax/mail/?"/>

                          <exclude path="/javax/mail"/>

                          <exclude path="/javax/mail/"/>

                          <exclude path="/javax/mail/**"/>

                          <exclude path="/javax/mail/*"/>

                          <exclude path="/javax/mail/?"/>

                          <exclude path="javax.mail"/>

        </exports>

        </deployment>

       

        </jboss-deployment-structure>

       

       

      I tried several other ways, too, but nothing helped. If I delete the classes from the jar than the errors disappear but that's not a solution.

       

      Any ideas?

       

      Thanks a lot?

       

      Regards

      Marc

        • 1. Re: How to exlude classes from WAR with jboss-deployment-structure.xml?
          ebross

          Hi Marc,

           

          The doc say that you can exclude dependencies -- dependencies are modules i.e., java packages, e.g.,

           

           

             <exclusions>

                <module name="path.to.the.class.to.exlude" />

              </exclusions>

           

           

          Possible solution is to move the class you want to exclude to a separate package and then exclude that package in your jboss-deployment-structure.xml.

          • 2. Re: How to exlude classes from WAR with jboss-deployment-structure.xml?
            mkaesz

            I tried that as well, but it did not work. At the moment I excluded the jar from the war and created my own module and imported only the classes I needed, but that seems to be ignored as well.

             

            Any ides?

            • 3. Re: How to exlude classes from WAR with jboss-deployment-structure.xml?
              ebross

              Hi Marc,

               

              Where is your jboss-deployment-structure.xml placed? It should be in META-INF (or WEB-INF for web deployments).

              • 4. Re: How to exlude classes from WAR with jboss-deployment-structure.xml?
                mkaesz

                Hi!

                 

                It is placed in WEB-INF. It's only a war. If I make some typos the parser finds them. So the file is at the right place.

                 

                Another example: I tried to add the javax.management classes the following way.

                 

                 

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

                 

                    <deployment>

                        <dependencies>

                            <system export="true">

                                <paths>

                                    <path name="javax/management"/>

                                </paths>

                            </system>

                        </dependencies>

                    </deployment>

                </jboss-deployment-structure>

                 

                 

                They are ignored as well. I do always get a LinkageError and Caused By is a ClassNotFoundException. In my case javax.management.remote.JMXConnectionProvider is not found.

                 

                Thanks.

                Marc

                • 5. Re: How to exlude classes from WAR with jboss-deployment-structure.xml?
                  mkaesz

                  ok, I figured out that the javax.management classes should be loaded by the javax.api module which is loaded by the javaee module. I haven't touched any of those modules, so I don't understand why they aren't available in my app. Any ideas?

                  • 6. Re: How to exlude classes from WAR with jboss-deployment-structure.xml?
                    ebross

                    What version of JBoss and "jboss-deployment-structure.xsd" are you using? 

                     

                    Mind you, you could just add it to  the JBoss ...modules/sun/jdk/main/module.xml:

                     

                    <module xmlns="urn:jboss:module:1.1" name="sun.jdk">

                        <resources>

                          <resource-root path="service-loader-resources"/>

                             </resources>

                             <dependencies>

                                 <system export="true">

                                     <paths>

                                        <path name="javax/management"/>

                    ...