3 Replies Latest reply on Apr 4, 2005 8:00 PM by David Israel

    JBossMQ under other application servers

    Ben Lindahl Newbie

      Is JBossMQ able to function under other application servers? Our product ships with JBoss, but we want to give clients the option to switch out the application server without providing their own JMS implementations.

      Thanks in advance.

        • 1. Re: JBossMQ under other application servers
          Narayana Rallabandi Newbie

          Yes It works. All you have to do is to configure JBOSS MQ as external JNDI Provider in the other Application Server. If you are using a session Bean you can lookup for the external JNDI and if you have to configure the MDB for that in case of Weblogic it gives a provision like

           <provider-url> </provider-url>
           <jms-client-id>.... </jms-client-id>

          In some Application servers like Sun One which will not give that provision to listen in this cases.

          Its always good to look for a general solution like tweaking the jms-ra.rar which is bundled with JBOSS to make it listen to from your Application server to JBOSS MQ.

          The rar comes with a JNDIProvider Adapter which will look for
          some application servers would not accept this naming you can modify 2 classes that comes with the rar to make it work in a generalized way.

          In the package org.jboss.resource.adapter.jms.inflow.JmsActivationSpec bean add the following parameters and also the corresponding methods

           private String providerURL = "jnp://localhost:1099";
           private String initialContextFactory = "org.jnp.interfaces.NamingContextFactory";
           private String urlPkgPrefixes = "org.jnp.interfaces";

          In the package org.jboss.resource.adapter.jms.inflow.JmsActivation bean make the following changes

          protected void setupJMSProviderAdapter() throws Exception
           Properties env = new java.util.Properties();
           adapter = new org.jboss.jms.jndi.JNDIProviderAdapter();
           log.debug("Using jms provider adapter " + adapter);

          and in 2 more methods setupTopicConnection and setupQueueConnection make changes to lookup for ConnectionFactory.

          TopicConnectionFactory tcf = (TopicConnectionFactory) ctx.lookup("ConnectionFactory");

          while giving the ActiovationSpec in your ejb-jar.xml give the properties in the JmsActiovation spec like:


          you can replace the localhot parameter with the machine ip or the name on which the JBOSS MQ is running .

          Since the rar itself will provide for the JNDI providerAdapter too you need not configure the external JNDI in this case. All you have to do is to point to the rar as an example the sunone


          Note: You might want to do away with the DLQ then comment out the call setupDLQ(ctx) in the setup() method of the JmsActiovation.java


          • 2. Re: JBossMQ under other application servers
            Narayana Rallabandi Newbie

            One more thing I forgot to add if we are actually looking for a remote JBOSS MQ as a naming provider, from 3rd party Application servers, the org.jnp.interfaces.NamingContext.java would call discoverServer(Hashtable serverEnv) method, as commented rightly this would do the following

            /** This methods sends a broadcast message on the network and asks and
            * HA-JNDI server to sent it the HA-JNDI stub

            If we were to circumvent this we can replace the code with

             String serverHost;
             String providerURL = (String)serverEnv.get("PROVIDER_URL");
             log.info("providerURL is"+providerURL);
             if(providerURL != null){
             int schemeLength = 0;
             if( providerURL.startsWith ("java:") )
             schemeLength = 7;
             else if( providerURL.startsWith ("jnp:") )
             schemeLength = 6;
             else if( providerURL.startsWith ("jnps:") )
             schemeLength = 7;
             else if( providerURL.startsWith ("jnp-http:") )
             schemeLength = 11;
             else if( providerURL.startsWith ("jnp-https:") )
             schemeLength = 12;
             serverHost = providerURL.substring(schemeLength);
             String[] servers = serverHost.split(":");
             log.info("serverhost is:"+servers[0]+"\n serverPort is "+servers[1]);
             if(servers[0]!= null && servers[1] != null){
             server = getServer (servers[0], Integer.parseInt(servers[1]), serverEnv);
             }catch(NumberFormatException ne){
             server = getServer ("localhost", 1099, serverEnv);
             if(server == null)
             server = getServer ("localhost", 1099, serverEnv);
             return server;

            • 3. Re: JBossMQ under other application servers
              David Israel Newbie

              I am trying to use JBossMQ as a .rar from another application server. With the current jms-ra.rar the first problem I hit is:

              Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/resource/JBossResourceException
              at java.lang.Class.forName0(Native Method)
              at java.lang.Class.forName(Unknown Source)
              at org.jboss.resource.adapter.jms.JmsManagedConnectionFactory.class$(JmsManagedConnectionFactory.java:45)
              at org.jboss.resource.adapter.jms.JmsManagedConnectionFactory.<clinit>(JmsManagedConnectionFactory.java:45)

              JBossResourceException is not included in the rar file. Thanks very much for the tips below on getting this to work. Are there any plans for JBoss resource adaptor jms-ra.rar to work stand alone? Anyone already done this and published on a web site somewhere?

              Thank you for your help.