3 Replies Latest reply on Aug 15, 2008 3:53 PM by vishal12345

    SendEsbMessage Error

    vishal12345

      Using following code to sed esb message in HelloWorld example


      Message esbMessage = MessageFactory.getInstance().getMessage();
      ServiceInvoker i = new ServiceInvoker(args[0],args[1]);
      System.out.println("Created invoker");
      esbMessage.getBody().add(args[2]);
      i.deliverAsync(esbMessage);

      and i m getting following error

      [echo] Runs Test ESB Message Sender
      [java] Created message
      [java] 17:00:02,828 ERROR [main][JAXRConnectionFactory] Could not set up a connection to the Registry. Failed to create instance of: null
      [java] javax.xml.registry.JAXRException: Failed to create instance of: null
      [java] at javax.xml.registry.ConnectionFactory.newInstance(ConnectionFactory.java:75)
      [java] at org.jboss.internal.soa.esb.services.registry.JAXRConnectionFactory.getConnection(JAXRConnectionFactory.java:102)
      [java] at org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl.findEPRs(JAXRRegistryImpl.java:305)
      [java] at org.jboss.soa.esb.listeners.RegistryUtil.getEprs(RegistryUtil.java:226)
      [java] at org.jboss.soa.esb.client.ServiceInvoker.loadServiceClusterInfo(ServiceInvoker.java:428)
      [java] at org.jboss.soa.esb.client.ServiceInvoker.(ServiceInvoker.java:155)
      [java] at org.jboss.soa.esb.client.ServiceInvoker.(ServiceInvoker.java:136)
      [java] at org.jboss.soa.esb.client.ServiceInvoker.(ServiceInvoker.java:178)
      [java] at org.jboss.soa.esb.samples.quickstart.helloworld.test.SendEsbMessage.main(SendEsbMessage.java:65)
      [java] Caused by: java.lang.NullPointerException
      [java] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      [java] at java.lang.ClassLoader.loadClass(Unknown Source)
      [java] at javax.xml.registry.ConnectionFactory.newInstance(ConnectionFactory.java:70)
      [java] ... 8 more
      [java] 17:00:02,843 ERROR [main][JAXRConnectionFactory] Could not set up a connection to the Registry. Failed to create instance of: null
      [java] javax.xml.registry.JAXRException: Failed to create instance of: null
      [java] at javax.xml.registry.ConnectionFactory.newInstance(ConnectionFactory.java:75)
      [java] at org.jboss.internal.soa.esb.services.registry.JAXRConnectionFactory.getConnection(JAXRConnectionFactory.java:102)
      [java] at org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl.findService(JAXRRegistryImpl.java:458)
      [java] at org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl.findEPRs(JAXRRegistryImpl.java:307)
      [java] at org.jboss.soa.esb.listeners.RegistryUtil.getEprs(RegistryUtil.java:226)
      [java] at org.jboss.soa.esb.client.ServiceInvoker.loadServiceClusterInfo(ServiceInvoker.java:428)
      [java] at org.jboss.soa.esb.client.ServiceInvoker.(ServiceInvoker.java:155)
      [java] at org.jboss.soa.esb.client.ServiceInvoker.(ServiceInvoker.java:136)
      [java] at org.jboss.soa.esb.client.ServiceInvoker.(ServiceInvoker.java:178)
      [java] at org.jboss.soa.esb.samples.quickstart.helloworld.test.SendEsbMessage.main(SendEsbMessage.java:65)
      [java] Caused by: java.lang.NullPointerException
      [java] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      [java] at java.lang.ClassLoader.loadClass(Unknown Source)
      [java] at javax.xml.registry.ConnectionFactory.newInstance(ConnectionFactory.java:70)
      [java] ... 9 more
      [java] Exception in thread "main" java.lang.NullPointerException
      [java] at org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl.findService(JAXRRegistryImpl.java:461)
      [java] at org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl.findEPRs(JAXRRegistryImpl.java:307)
      [java] at org.jboss.soa.esb.listeners.RegistryUtil.getEprs(RegistryUtil.java:226)
      [java] at org.jboss.soa.esb.client.ServiceInvoker.loadServiceClusterInfo(ServiceInvoker.java:428)
      [java] at org.jboss.soa.esb.client.ServiceInvoker.(ServiceInvoker.java:155)
      [java] at org.jboss.soa.esb.client.ServiceInvoker.(ServiceInvoker.java:136)
      [java] at org.jboss.soa.esb.client.ServiceInvoker.(ServiceInvoker.java:178)
      [java] at org.jboss.soa.esb.samples.quickstart.helloworld.test.SendEsbMessage.main(SendEsbMessage.java:65)


      any idea please how to solve this problem ?

        • 1. Re: SendEsbMessage Error
          beve

          Take a look at one of the SendEsbMessage classes in quickstarts. For example in the helloworld quickstart:

          public static void main(String args[]) throws Exception
           {
          // Setting the ConnectionFactory such that it will use scout
           System.setProperty("javax.xml.registry.ConnectionFactoryClass","org.apache.ws.scout.registry.ConnectionFactoryImpl");
          
           if (args.length < 3)
           {
           System.out.println("Usage SendEsbMessage <category> <name> <text to send>");
           }
          
           Message esbMessage = MessageFactory.getInstance().getMessage();
          
           esbMessage.getBody().add(args[2]);
          
           new ServiceInvoker(args[0], args[1]).deliverAsync(esbMessage);
          
           }
          

          See the comment about scout and see if that works for you.

          Regards,

          /Daniel

          • 2. Re: SendEsbMessage Error
            vishal12345

            Hey thanks man that worked i m greatfull to you !

            • 3. Re: SendEsbMessage Error
              vishal12345

              k that worked finally i have a doubt this is probably my missunderstanding but i want to confirm

              following is the code which is suppose to place n messages on ESB
              i want the listener to get invoked n times but it gets invoked very oddly
              this loop currently goes three times but all three messages appear in only one message body when recvd by listener what shud i do to change it to three different messages , please help

              for(Request thisreq: req){
              System.out.println("New Message");
              //System.out.println(thisreq.print_Messages());
              Message esbMessage = MessageFactory.getInstance().getMessage();
              esbMessage.getBody().add(thisreq.print_Messages());
              new ServiceInvoker("TSService","TsListener").deliverAsync(esbMessage);

              //sjm.sendAMessage(thisreq.print_Messages());
              }