4 Replies Latest reply on Jan 4, 2008 9:32 AM by happyspaceinvader

    Standalone bridges - what am I missing?

    happyspaceinvader

      I have written a standalone bridge for receiving JMS messages from a Sonic MQ JMS server (unfortunately, there are some extra properties needed to connect to SonicMQ that are not supported by the JMS provider in the ESB config file); however I'm having problems locating all the auxilliary files I need to make this work.

      My standalone app is simply getting messages from the Sonic JMS server, converting them into ESB messages and then calling ServiceInvoker to send them to my ESB app, which has an ESB queue configured to handle them. However it all falls apart, when constructing the ServiceInvoker, with the following Exception:

      java.lang.NullPointerException
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Class.java:247)
       at org.jboss.soa.esb.util.ClassUtil.forName(ClassUtil.java:65)
       at org.jboss.soa.esb.services.registry.RegistryFactory.createRegistry(RegistryFactory.java:64)
       at org.jboss.soa.esb.services.registry.RegistryFactory.getRegistry(RegistryFactory.java:51)
       at org.jboss.soa.esb.listeners.RegistryUtil.getEprs(RegistryUtil.java:210)
       at org.jboss.soa.esb.client.ServiceInvoker.loadServiceClusterInfo(ServiceInvoker.java:351)
       at org.jboss.soa.esb.client.ServiceInvoker.<init>(ServiceInvoker.java:114)
       at org.jboss.soa.esb.client.ServiceInvoker.<init>(ServiceInvoker.java:137)
       at net.mycorp.JMSMessageProcessor.process(JMSMessageProcessor.java:33)
       at net.mycorp.JMSMessageProcessor.run(JMSMessageProcessor.java:67)
       at net.mycorp.JMSListener.onMessage(JMSListener.java:26)
       at progress.message.jimpl.Session.deliver(Unknown Source)
       at progress.message.jimpl.Session.run(Unknown Source)
       at progress.message.jimpl.Session$SessionThread.run(Unknown Source)
      org.jboss.soa.esb.listeners.message.MessageDeliverException: Invocation exception. null
       at org.jboss.soa.esb.client.ServiceInvoker.loadServiceClusterInfo(ServiceInvoker.java:364)
       at org.jboss.soa.esb.client.ServiceInvoker.<init>(ServiceInvoker.java:114)
       at org.jboss.soa.esb.client.ServiceInvoker.<init>(ServiceInvoker.java:137)
       at net.mycorp.JMSMessageProcessor.process(JMSMessageProcessor.java:33)
       at net.mycorp.JMSMessageProcessor.run(JMSMessageProcessor.java:67)
       at net.mycorp.JMSListener.onMessage(JMSListener.java:26)
       at progress.message.jimpl.Session.deliver(Unknown Source)
       at progress.message.jimpl.Session.run(Unknown Source)
       at progress.message.jimpl.Session$SessionThread.run(Unknown Source)
      Caused by: org.jboss.soa.esb.services.registry.RegistryException: Invocation exception. null
       at org.jboss.soa.esb.services.registry.RegistryFactory.createRegistry(RegistryFactory.java:77)
       at org.jboss.soa.esb.services.registry.RegistryFactory.getRegistry(RegistryFactory.java:51)
       at org.jboss.soa.esb.listeners.RegistryUtil.getEprs(RegistryUtil.java:210)
       at org.jboss.soa.esb.client.ServiceInvoker.loadServiceClusterInfo(ServiceInvoker.java:351)
       ... 8 more
      Caused by: java.lang.NullPointerException
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Class.java:247)
       at org.jboss.soa.esb.util.ClassUtil.forName(ClassUtil.java:65)
       at org.jboss.soa.esb.services.registry.RegistryFactory.createRegistry(RegistryFactory.java:64)
       ... 11 more
      


      I stepped through the ESB source code in debug and found that the problem occurs at line 58 of org.jboss.soa.esb.services.registry.RegistryFactory (JBoss ESB 4.2.1GA).

      String className = Configuration.getRegistryImplementationClass();
      


      This returns null, (when called under my standalone app) thus giving the above Exception. This makes me think I'm missing a vital properties/config file in my standalone app, but that's about as far as I can take it, as I'm very new to JBoss ESB.

      Can anyone help?

        • 1. Re: Standalone bridges - what am I missing?
          jpechanec

          Hi,

          try to call
          System.setProperty("javax.xml.registry.ConnectionFactoryClass",
          "org.apache.ws.scout.registry.ConnectionFactoryImpl");

          or set the property on command line.

          J.

          • 2. Re: Standalone bridges - what am I missing?
            happyspaceinvader

             

            "jpechane@redhat.com" wrote:
            Hi,

            try to call
            System.setProperty("javax.xml.registry.ConnectionFactoryClass",
            "org.apache.ws.scout.registry.ConnectionFactoryImpl");

            or set the property on command line.

            J.


            Already doing that. Here is the code I am using:

            public void process(javax.jms.Message jmsMessage) {
             LOGGER.debug("Entering method process()");
            
             org.jboss.soa.esb.message.Message esbMessage = (org.jboss.soa.esb.message.Message) convertJMSToESB(jmsMessage);
             LOGGER.debug("ESB Message is: " + esbMessage.getBody().get());
            
             try {
             System.setProperty("javax.xml.registry.ConnectionFactoryClass",
             "org.apache.ws.scout.registry.ConnectionFactoryImpl");
             ServiceInvoker serviceInvoker = new ServiceInvoker(serviceCategory, serviceName); // <-- Fails here
             serviceInvoker.deliverAsync(esbMessage);
             } catch (MessageDeliverException ex) {
             LOGGER.error("Failed to deliver message", ex);
             } catch (Exception ex) {
             LOGGER.error("ServiceInvoker failed for some other reason", ex);
             }
             }
            


            • 3. Re: Standalone bridges - what am I missing?
              jpechanec

              Do you have proper jbossesb-properties.xml file on classpath? It must be one from those used in quickstart examples (different from server-side).?

              J

              • 4. Re: Standalone bridges - what am I missing?
                happyspaceinvader

                 

                "jpechane@redhat.com" wrote:
                Do you have proper jbossesb-properties.xml file on classpath? It must be one from those used in quickstart examples (different from server-side).?

                J


                Yes, I have actually just found the mistake I made.

                I had a wrapper shell script running this app, which was creating the CLASSPATH by searching in my lib and config directories. This resulted in the 2 properties files being added literally to the classpath instead of the directory in which they reside. I've fixed this and it now works fine.