6 Replies Latest reply on May 1, 2014 4:39 PM by Chad Martin

    Problems creating a jms bridge

    Chad Martin Newbie

      I created a post already but marked it answered by accident.

       

      Im trying to create a jms message bridge from WildFly 8 to openmq. Every example i tried did not work. Can someone help me. I never have created a jms bridge before.

       

      The jms-bridge entry in my standalone-full.xml

      <jms-bridge name="myBridge" module="org.glassfish">

                      <source>

                          <connection-factory name="jms/ConnectionFactory"/>

                          <destination name="jms/TestQueue"/>

                          <context>

                              <property key="java.naming.factory.initial" value="com.sun.enterprise.naming.SerialInitContextFactory"/>

                              <property key="java.naming.provider.url" value="mq://localhost:7676"/>

                          </context>

                      </source>

                      <target>

                          <connection-factory name="jmsConnectionFactory"/>

                          <destination name="/"jms/TestQueue"/>

                      </target>

                      <quality-of-service>AT_MOST_ONCE</quality-of-service>

                      <failure-retry-interval>500</failure-retry-interval>

                      <max-retries>1</max-retries>

                      <max-batch-size>500</max-batch-size>

                      <max-batch-time>500</max-batch-time>

                      <add-messageID-in-header>true</add-messageID-in-header>

                  </jms-bridge>

       

      I created a module from imqjmsra.rar.

      The module.xml

       

      <module xmlns="urn:jboss:module:1.0" name="org.glassfish">

        <resources>

          <resource-root path="fscontext.jar"/>

          <resource-root path="imqbroker.jar"/>

          <resource-root path="imqjmsbridge.jar"/>

          <resource-root path="imqjmsra.jar"/>

          <resource-root path="imqjmx.jar"/>

          <resource-root path="imqstomp.jar"/>

        </resources>

        <dependencies>

              <!-- add the dependencies required by JMS Bridge code                -->

             <module name="javax.api" />

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

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

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

        </dependencies>

      </module>

       

      The error that i get is

       

      2014-04-04 14:36:04,846 WARN  [org.hornetq.jms.server] (pool-3-thread-1) HQ122010: Failed to connect JMS Bridge: javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory com.sun.enterprise.naming.SerialInitContextFactory from classloader ModuleClassLoader for Module "org.glassfish:main" from local module loader @6b573f80 (finder: local module finder @2d0a238e (roots: C:\Installs\JBoss\wildfly-8.0.0.Final\modules,C:\Installs\JBoss\wildfly-8.0.0.Final\modules\system\layers\base)) [Root exception is java.lang.ClassNotFoundException: com.sun.enterprise.naming.SerialInitContextFactory from [Module "org.glassfish:main" from local module loader @6b573f80 (finder: local module finder @2d0a238e (roots: C:\Installs\JBoss\wildfly-8.0.0.Final\modules,C:\Installs\JBoss\wildfly-8.0.0.Final\modules\system\layers\base))]]

          at org.jboss.as.naming.InitialContext.getDefaultInitCtx(InitialContext.java:116)

          at org.jboss.as.naming.InitialContext.init(InitialContext.java:99)

          at javax.naming.ldap.InitialLdapContext.<init>(InitialLdapContext.java:153) [rt.jar:1.7.0_45]

          at org.jboss.as.naming.InitialContext.<init>(InitialContext.java:90)

          at org.jboss.as.naming.InitialContextFactory.getInitialContext(InitialContextFactory.java:44)

          at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684) [rt.jar:1.7.0_45]

          at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307) [rt.jar:1.7.0_45]

          at javax.naming.InitialContext.init(InitialContext.java:242) [rt.jar:1.7.0_45]

          at javax.naming.InitialContext.<init>(InitialContext.java:216) [rt.jar:1.7.0_45]

          at org.hornetq.jms.bridge.impl.JNDIFactorySupport.createObject(JNDIFactorySupport.java:53)

          at org.hornetq.jms.bridge.impl.JNDIDestinationFactory.createDestination(JNDIDestinationFactory.java:38)

          at org.hornetq.jms.bridge.impl.JMSBridgeImpl.setupJMSObjects(JMSBridgeImpl.java:1217)

          at org.hornetq.jms.bridge.impl.JMSBridgeImpl.setupJMSObjectsWithRetry(JMSBridgeImpl.java:1457)

          at org.hornetq.jms.bridge.impl.JMSBridgeImpl.access$2000(JMSBridgeImpl.java:76)

          at org.hornetq.jms.bridge.impl.JMSBridgeImpl$FailureHandler.run(JMSBridgeImpl.java:2046)

          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_45]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45]

          at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]

        • 1. Re: Problems creating a jms bridge
          Justin Bertram Master

          The exception you're getting indicates that the classloader can't find com.sun.enterprise.naming.SerialInitContextFactory.  Is this class actually in one of the jars in your "org.glassfish" module?  If not, that is your problem.

           

          In general, I wouldn't expect the classes used for the OpenMQ JCA RA (i.e. the ones from imqjmsra.rar) to be terribly useful for the JMS bridge.  The JMS bridge doesn't use anything specifically related to JCA for its integration.  Think of the JMS bridge as a normal, standalone JMS client.  It uses the JNDI and JMS APIs and that's about it.  It would need all the same jars as a standalone JMS client would need that is connecting remotely to OpenMQ.

          • 2. Re: Problems creating a jms bridge
            Chad Martin Newbie

            i added the "glassfish-embedded-all.jar" to my module. Doing this threw:

             

            2014-04-07 09:51:54,024 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 62) MSC000001: Failed to start service jboss.messaging.jms-bridge.myBridge: org.jboss.msc.service.StartException in service jboss.messaging.jms-bridge.myBridge: JBAS011639: Failed to create JMS Bridge

                at org.jboss.as.messaging.jms.bridge.JMSBridgeService$1.run(JMSBridgeService.java:83) [wildfly-messaging-8.0.0.Final.jar:8.0.0.Final]

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_45]

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45]

                at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]

                at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.1.Final.jar:2.1.1.Final]

            Caused by: java.lang.NoClassDefFoundError: Lsun/corba/Bridge;

                at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.7.0_45]

                at java.lang.Class.privateGetDeclaredFields(Class.java:2397) [rt.jar:1.7.0_45]

                at java.lang.Class.getDeclaredField(Class.java:1946) [rt.jar:1.7.0_45]

                at com.sun.corba.ee.spi.orbutil.tf.MethodMonitorRegistry.initializeField(MethodMonitorRegistry.java:362)

                at com.sun.corba.ee.spi.orbutil.tf.MethodMonitorRegistry.registerClass(MethodMonitorRegistry.java:400)

                at com.sun.corba.ee.impl.io.ObjectStreamClass.<clinit>(ObjectStreamClass.java)

                at com.sun.corba.ee.impl.util.RepositoryId.<clinit>(RepositoryId.java:192)

                at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_Object(CDRInputStream_1_0.java:824)

                at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_Object(CDRInputStream_1_0.java:782)

                at com.sun.corba.ee.impl.encoding.CDRInputObject.read_Object(CDRInputObject.java:472)

                at org.omg.CORBA.ObjectHelper.read(ObjectHelper.java:92) [rt.jar:1.7.0_45]

                at org.omg.CosNaming._NamingContextStub.resolve(_NamingContextStub.java:245) [rt.jar:1.7.0_45]

                at com.sun.enterprise.naming.impl.SerialContext$ProviderCacheKey.getNameService(SerialContext.java:1244)

                at com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider(SerialContext.java:411)

                at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:347)

                at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:504)

                at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)

                at javax.naming.InitialContext.lookup(InitialContext.java:411) [rt.jar:1.7.0_45]

                at javax.naming.InitialContext.lookup(InitialContext.java:411) [rt.jar:1.7.0_45]

                at javax.naming.InitialContext.lookup(InitialContext.java:411) [rt.jar:1.7.0_45]

                at org.hornetq.jms.bridge.impl.JNDIFactorySupport.createObject(JNDIFactorySupport.java:56) [hornetq-jms-server-2.4.1.Final.jar:]

                at org.hornetq.jms.bridge.impl.JNDIDestinationFactory.createDestination(JNDIDestinationFactory.java:38) [hornetq-jms-server-2.4.1.Final.jar:]

                at org.hornetq.jms.bridge.impl.JMSBridgeImpl.setupJMSObjects(JMSBridgeImpl.java:1217) [hornetq-jms-server-2.4.1.Final.jar:]

                at org.hornetq.jms.bridge.impl.JMSBridgeImpl.start(JMSBridgeImpl.java:409) [hornetq-jms-server-2.4.1.Final.jar:]

                at org.jboss.as.messaging.jms.bridge.JMSBridgeService.startBridge(JMSBridgeService.java:105) [wildfly-messaging-8.0.0.Final.jar:8.0.0.Final]

                at org.jboss.as.messaging.jms.bridge.JMSBridgeService$1.run(JMSBridgeService.java:79) [wildfly-messaging-8.0.0.Final.jar:8.0.0.Final]

                ... 4 more

            Caused by: java.lang.ClassNotFoundException: sun.corba.Bridge from [Module "org.glassfish:main" from local module loader @6b573f80 (finder: local module finder @2d0a238e (roots: C:\Installs\JBoss\wildfly-8.0.0.Final\modules,C:\Installs\JBoss\wildfly-8.0.0.Final\modules\system\layers\base))]

                at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:197) [jboss-modules.jar:1.3.0.Final]

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:443) [jboss-modules.jar:1.3.0.Final]

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:431) [jboss-modules.jar:1.3.0.Final]

                at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:373) [jboss-modules.jar:1.3.0.Final]

                at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:118) [jboss-modules.jar:1.3.0.Final]

                ... 30 more

             

            Am i going down the right path? The Missing class is located in the jdk

            • 3. Re: Problems creating a jms bridge
              Justin Bertram Master

              It looks like you're going down the right path.

               

              However, I find it odd that the InitialContext implementation from GF would use CORBA, but that's just my opinion.  That may just be the way GF decided to implement it.

               

              As I said previously, the JMS bridge is just a normal JMS client accessing resources via JNDI.  It will need all the same jars that a standalone, remote GlassFish JMS client would.

              1 of 1 people found this helpful
              • 4. Re: Problems creating a jms bridge
                Chad Martin Newbie

                The missing class is in the jdk. Do i have to add the jdk to the module so this class can be found?

                • 5. Re: Problems creating a jms bridge
                  Justin Bertram Master

                  Yes, I believe so.

                   

                  For what it's worth, I deal specifically with HornetQ and this problem is more of a general application server problem not directly related to HornetQ.

                  • 6. Re: Problems creating a jms bridge
                    Chad Martin Newbie

                    I got this working. I was using the wrong glassfish jar.

                    my module.xml file is:

                     

                    <module xmlns="urn:jboss:module:1.0" name="org.glassfish"> 

                      <resources> 

                        <resource-root path="glassfish-embedded-all-3.1.1.jar"/>

                      </resources> 

                      <dependencies> 

                      <system export="true">

                        <paths>

                            <path name="sun/corba"/>      

                        </paths>

                      </system>

                            <!-- add the dependencies required by JMS Bridge code                -->

                           <module name="javax.api" />

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

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

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

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

                           <module name="org.omg.api"/>

                           <module name="sun.jdk"/>       

                      </dependencies> 

                    </module>

                     

                    The jms-bridge entry in my standalone-full.xml

                    <jms-bridge name="myBridge" module="org.glassfish">

                                    <source>

                                        <connection-factory name="jms/ConnectionFactory"/>

                                        <destination name="jms/TestQueue"/>

                                        <context>

                                            <property key="java.naming.factory.initial" value="com.sun.enterprise.naming.SerialInitContextFactory"/>

                                        </context>

                                    </source>

                                    <target>

                                        <connection-factory name="java:/jmsConnectionFactory"/>

                                        <destination name="jms/TestQueue"/>

                                        <context>

                                            <property key="java.naming.factory.initial" value="org.jboss.as.naming.InitialContextFactory"/>

                                        </context>

                                    </target>

                                    <quality-of-service>AT_MOST_ONCE</quality-of-service>

                                    <failure-retry-interval>500</failure-retry-interval>

                                    <max-retries>10</max-retries>

                                    <max-batch-size>500</max-batch-size>

                                    <max-batch-time>500</max-batch-time>

                                    <add-messageID-in-header>true</add-messageID-in-header>

                    </jms-bridge>