4 Replies Latest reply on Dec 15, 2017 2:52 AM by dilipraj

    Exclude javax.jms from JBOSS EAP 7

    dilipraj

      I'm trying to deploy WAR that already has javax.jms library included. And apparently, Jboss EAP 7 also loads it's javax.jms library. I am particularly interested in ConnectionFactory class which I can see two instances loaded during runtime

       

      vfs:/content/nipe_simulator_dev.war/WEB-INF/lib/jms-1.1.jar/javax/jms/ConnectionFactory.class and

      com.dbs.nipe.engine.sender.MQSender:50 - :243-, rxnTransRef=null, jar:file:/Users/dilipraj/ipe/app/jboss/modules/system/layers/base/javax/jms/api/main/jboss-jms-api_2.0_spec-1.0.0.Final-redhat-1.jar!/javax/jms/ConnectionFactory.class

       

      I'm getting "Cannot cast to ConnectionFactory" exception.

       

      So, how can exclude implicitly included jms library from jboss so that my application uses the library (jar) included with the WAR itself?

        • 1. Re: Exclude javax.jms from JBOSS EAP 7
          nitin.takale

          Create jboss-deployment-structure.xml in your application's WEB-INF folder. And paste following content in it -

           

          <?xml version="1.0" encoding="UTF-8"?>

          <jboss-deployment-structure>

          <deployment>

                <exclusions>

                          <module name="javax.jms.api"/>

                </exclusions>

              </deployment>

          </jboss-deployment-structure>

           

          Make a build & deploy your WAR.

          -Nitin

          • 2. Re: Exclude javax.jms from JBOSS EAP 7
            dilipraj

            Hi.

             

            That doesn't work. I can still see both the JARs loaded.

            • 3. Re: Exclude javax.jms from JBOSS EAP 7
              ctomc

              best thing to do is to remove your JMS jar from your application.

               

              if you are using maven, jms-api dependency you are using, should be set to scope=provided

               

              You can also not enable messaging support in app server by running with standalone.xml instead of standalone-full.xml

              but that will disable all JMS related functionality, for example MDBs wouldn't work anymore.

              • 4. Re: Exclude javax.jms from JBOSS EAP 7
                dilipraj

                I did that. I removed the JMS jar from my application. But it resulted an error while deploying the WAR.  NoClassDefFoundError: javax/jms/Destination