1 2 Previous Next 19 Replies Latest reply on Feb 26, 2011 3:31 AM by chandrarsa

    Problem with client calling esb

      I downloaded the JBoss ESB Server (already bundled with JBoss App Server) version 4.4

      I started the application server and everything loaded properly and with no error. The I deployed the "webservice_consumer1" example and it deployed successfully.

      I ran the test using ant and it worked perfectly fine.

      Then I copied the code content of SendEsbMessage.java from "org.jboss.soa.esb.samples.quickstart.webservice_consumer1.test.SendEsbMessage" to my standalone a java code. Here is the code:

      package com.cayenta.services;
      
      import org.jboss.soa.esb.message.Message;
      import org.jboss.soa.esb.message.format.MessageFactory;
      import org.jboss.soa.esb.message.format.MessageType;
      import org.jboss.soa.esb.client.ServiceInvoker;
      
      public class SendEsbMessage {
      
       public void sendMessage(String message) throws Exception {
      
       // Create the delivery adapter for the target service (cache it)
       System.setProperty("javax.xml.registry.ConnectionFactoryClass", "org.apache.ws.scout.registry.ConnectionFactoryImpl");
      
       // Create the delivery adapter for the target service (cache it)
       ServiceInvoker deliveryAdapter = new ServiceInvoker("MyServiceCategory", "WebserviceConsumer1");
      
       // Create and populate the request message...
       Message requestMessage = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);
       requestMessage.getBody().add(message);
      
       // Deliver the request message synchronously - timeout after 20
       // seconds...
      
       deliveryAdapter.deliverAsync(requestMessage);
      
       }
      
       public static void main(String args[]) throws Exception {
      
       SendEsbMessage sm = new SendEsbMessage();
       sm.sendMessage("hello");
      
       }
      
      }
      


      The classpath is pointing to [JBOSS_HOME]\lib\* and the jboss esb libraries in the .sar and .esb folder in the deploy folder.

      When I execute it I get the following error:

      Exception in thread "main" org.jboss.soa.esb.listeners.message.MessageDeliverException: Invocation exception. null
       at org.jboss.soa.esb.client.ServiceInvoker.loadServiceClusterInfo(ServiceInvoker.java:446)
       at org.jboss.soa.esb.client.ServiceInvoker.<init>(ServiceInvoker.java:157)
       at org.jboss.soa.esb.client.ServiceInvoker.<init>(ServiceInvoker.java:138)
       at org.jboss.soa.esb.client.ServiceInvoker.<init>(ServiceInvoker.java:180)
       at com.cayenta.services.SendEsbMessage.sendMessage(SendEsbMessage.java:80)
       at com.cayenta.services.SendEsbMessage.main(SendEsbMessage.java:114)
      Caused by: org.jboss.soa.esb.services.registry.RegistryException: Invocation exception. null
       at org.jboss.soa.esb.services.registry.RegistryFactory.createRegistry(RegistryFactory.java:121)
       at org.jboss.soa.esb.services.registry.RegistryFactory.getRegistry(RegistryFactory.java:86)
       at org.jboss.soa.esb.listeners.RegistryUtil.getEprs(RegistryUtil.java:220)
       at org.jboss.soa.esb.client.ServiceInvoker.loadServiceClusterInfo(ServiceInvoker.java:433)
       ... 5 more
      Caused by: java.lang.NullPointerException
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Class.java:242)
       at org.jboss.soa.esb.util.ClassUtil.forName(ClassUtil.java:65)
       at org.jboss.soa.esb.services.registry.RegistryFactory.createRegistry(RegistryFactory.java:110)
       ... 8 more
      



      * My environment is MacOS X (latest one)
      * My IDE is Eclipse with JBoss tools installed on it


      what am I doing wrong?

        • 1. Re: Problem with client calling esb
          scottdawson

          The Programmer's Guide in the 4.5 release shows how to call a service remotely. You can find the doc here: http://www.jboss.org/jbossesb/docs/4.5.GA/manuals/html/ProgrammersGuide.html
          Look for the section entitled "Configuration for a remote ServiceInvoker".

          Just a guess... it may be that you don't have the jbossesb-properties.xml on your classpath.

          Regards,
          Scott

          • 2. Re: Problem with client calling esb

            Hi Scott,

            the example in that document does not work.
            If my application is remote why do I need to have access to jbossesb-properties.xml ? I believe the whole point is that my application is a remote one.

            Unfortunately the JBoss documents unlike their brilliant products are not the best help you can find or not as accurate as they can be.

            cheers,

            Alex

            • 3. Re: Problem with client calling esb

              Can someone tell me how to call an ESB service from a standalone application executed from eclipse?

              Eventually I want to take this code and add it into my front-end application.

              • 4. Re: Problem with client calling esb
                beve

                 

                the example in that document does not work.

                I've just tested the example code against 4.5 and this works without error. I ran it from eclipse and have setup my classpath according to the information in the ProgrammersGuide. Are you still seeing an error if you follow the setup described?

                If my application is remote why do I need to have access to jbossesb-properties.xml ?

                It contains information about how to connect to the registry. It does not require a full configuration but this is probably easier to copy a jbossesb-properties.xml.

                Did you try adding the jbossesb-properties.xml to the classpath as Scott suggested?

                /Daniel

                • 5. Re: Problem with client calling esb

                  Hi Daniel

                  I did add the file. It doesn't work. Could you please tell me what you have as your eclipse classpath setting?

                  The second question is that if you have a client application that just want to send a simple message without reliance on jboss libs how do I do that?

                  Cheers,

                  Alex

                  • 6. Re: Problem with client calling esb
                    beve

                     

                    Could you please tell me what you have as your eclipse classpath setting?

                    Sure, here is my .classpath:
                    <?xml version="1.0" encoding="UTF-8"?>
                    <classpath>
                     <classpathentry kind="src" path="src"/>
                     <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
                     <classpathentry kind="lib" path="lib/jbossts-common.jar"/>
                     <classpathentry kind="lib" path="lib/log4j-1.2.14.jar"/>
                     <classpathentry kind="lib" path="lib/stax-1.2.0.jar"/>
                     <classpathentry kind="lib" path="lib/stax-api-1.0.1.jar"/>
                     <classpathentry kind="lib" path="lib/jbossall-client.jar"/>
                     <classpathentry kind="lib" path="lib/scout-1.0rc2.aop.jar"/>
                     <classpathentry kind="lib" path="lib/xbean-2.2.0.jar"/>
                     <classpathentry kind="lib" path="lib/commons-logging-1.1.jar"/>
                     <classpathentry kind="lib" path="lib/jboss-aop-jdk50-1.5.6.GA.jar"/>
                     <classpathentry kind="lib" path="lib/javassist-3.6.0.GA.jar"/>
                     <classpathentry kind="lib" path="lib/trove.jar"/>
                     <classpathentry kind="lib" path="lib/juddi-client-2.0rc5.jar"/>
                     <classpathentry kind="lib" path="lib/jboss-messaging-client.jar"/>
                     <classpathentry kind="lib" path="lib/jboss-remoting.jar"/>
                     <classpathentry kind="lib" path="lib/commons-codec-1.3.jar"/>
                     <classpathentry kind="lib" path="lib/wstx-asl-3.2.0.jar"/>
                     <classpathentry kind="lib" path="lib/xercesImpl-2.8.0.jar"/>
                     <classpathentry kind="lib" path="lib/servlet-api-2.4.jar"/>
                     <classpathentry kind="lib" path="lib"/>
                     <classpathentry kind="lib" path="/opt/jboss/esb/trunk/product/build/jbossesb/lib/jbossesb-config-model-1.0.1.jar"/>
                     <classpathentry kind="lib" path="/opt/jboss/esb/trunk/product/build/jbossesb/lib/jbossesb-config-model-1.1.0.jar"/>
                     <classpathentry kind="lib" path="/opt/jboss/esb/trunk/product/build/jbossesb/lib/jbossesb-rosetta.jar"/>
                     <classpathentry kind="output" path="bin"/>
                    </classpath>

                    Notice that lib is included in the classpath here. This is where I store the jbossesb-properties file which is required or you will see the error that you posted.

                    if you have a client application that just want to send a simple message without reliance on jboss libs how do I do that?

                    You can post a message to a JMS destination that is picked up by a gateway. Create a file on the filesystem which gets picked up by a file gateway. Update a database table etc.

                    Regards,

                    /Daniel




                    • 7. Re: Problem with client calling esb
                      cmi000

                      1. include <jboss as>/lib/endorsed/*.jar and <jboss as>/client/*.jar in your client class path.
                      2. modify your jbossesb-properties.xml as below

                      <properties name="registry">
                       <property name="org.jboss.soa.esb.registry.queryManagerURI"
                       value="jnp://<your host ip or dns name>:1099/InquiryService?org.apache.juddi.registry.rmi.Inquiry#inquire"/>
                       <property name="org.jboss.soa.esb.registry.lifeCycleManagerURI"
                       value="jnp://<your host ip or dns name>:1099/PublishService?org.apache.juddi.registry.rmi.Publish#publish" />
                       <property name="org.jboss.soa.esb.registry.implementationClass"
                       value="org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl"/>
                       <property name="org.jboss.soa.esb.registry.factoryClass"
                       value="org.apache.ws.scout.registry.ConnectionFactoryImpl"/>
                       <property name="org.jboss.soa.esb.registry.user"
                       value="jbossesb"/>
                       <property name="org.jboss.soa.esb.registry.password"
                       value="password"/>
                       <!-- the following parameter is scout specific to set the type of communication between scout and the UDDI (embedded, rmi, soap) -->
                       <property name="org.jboss.soa.esb.scout.proxy.transportClass"
                       value="org.apache.ws.scout.transport.RMITransport"/>
                       </properties>
                      


                      3. start your jboss as with -b 0.0.0.0 or bind to ip or dns name

                      • 8. Re: Problem with client calling esb
                        cmi000

                        for 1. also include deploy/jbossesb.sar/lib/*.jar in your classpath

                        • 9. Re: Problem with client calling esb

                          Hi cmi000

                          here is the error message I get after the changes you mentioned. At least I am one step ahead

                          Exception in thread "main" java.lang.NullPointerException
                           at org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl.findService(JAXRRegistryImpl.java:415)
                           at org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl.findEPRs(JAXRRegistryImpl.java:272)
                           at org.jboss.internal.soa.esb.services.registry.InVMRegistryInterceptor.findEPRs(InVMRegistryInterceptor.java:133)
                           at org.jboss.soa.esb.services.registry.RegistryFactory$HeadRegistryInterceptor.findEPRs(RegistryFactory.java:229)
                           at org.jboss.soa.esb.listeners.RegistryUtil.getEprs(RegistryUtil.java:226)
                           at org.jboss.soa.esb.client.ServiceInvoker.loadServiceClusterInfo(ServiceInvoker.java:433)
                           at org.jboss.soa.esb.client.ServiceInvoker.<init>(ServiceInvoker.java:157)
                           at org.jboss.soa.esb.client.ServiceInvoker.<init>(ServiceInvoker.java:138)
                           at org.jboss.soa.esb.client.ServiceInvoker.<init>(ServiceInvoker.java:180)
                           at com.cayenta.services.SendEsbMessage.sendMessage(SendEsbMessage.java:74)
                           at com.cayenta.services.SendEsbMessage.main(SendEsbMessage.java:98)
                          


                          • 10. Re: Problem with client calling esb

                            got it working. thanks cmi000

                            • 11. Re: Problem with client calling esb
                              franky_b

                              Hi,

                               

                              I have the same issue. Can you please explain HOW you got it working (apart from the hints provided here in this thread)?

                               

                              Thanks,
                              Frank

                              • 12. Re: Problem with client calling esb
                                chandrarsa

                                Hi All,

                                 

                                I am getting below exception while I am calling ESB using ServiceInvoker

                                 

                                I have jbossesb-properties.xml in my classpath so please help me to sort out this issue

                                 

                                thanks

                                Chandra

                                 

                                 

                                ##################################

                                Invoking service...

                                Exception in thread "main" org.jboss.soa.esb.listeners.message.MessageDeliverException: Invocation exception. null

                                      at org.jboss.soa.esb.client.ServiceInvoker.loadServiceClusterInfo(ServiceInvoker.java:545)

                                      at org.jboss.soa.esb.client.ServiceInvoker.<init>(ServiceInvoker.java:174)

                                      at org.jboss.soa.esb.client.ServiceInvoker.<init>(ServiceInvoker.java:155)

                                      at org.jboss.soa.esb.client.ServiceInvoker.<init>(ServiceInvoker.java:197)

                                      at com.test.SendEsbMessage.sendMessage(SendEsbMessage.java:21)

                                      at com.test.SendEsbMessage.main(SendEsbMessage.java:41)

                                Caused by: org.jboss.soa.esb.services.registry.RegistryException: Invocation exception. null

                                      at org.jboss.soa.esb.services.registry.RegistryFactory.createRegistry(RegistryFactory.java:121)

                                      at org.jboss.soa.esb.services.registry.RegistryFactory.getRegistry(RegistryFactory.java:86)

                                      at org.jboss.soa.esb.listeners.RegistryUtil.getEprs(RegistryUtil.java:220)

                                      at org.jboss.soa.esb.client.ServiceInvoker.loadServiceClusterInfo(ServiceInvoker.java:532)

                                      ... 5 more

                                Caused by: java.lang.NullPointerException

                                      at java.lang.Class.forName0(Native Method)

                                      at java.lang.Class.forName(Unknown Source)

                                      at org.jboss.soa.esb.util.ClassUtil.forName(ClassUtil.java:65)

                                      at org.jboss.soa.esb.services.registry.RegistryFactory.createRegistry(RegistryFactory.java:110)

                                      ... 8 more

                                • 13. Re: Problem with client calling esb
                                  beve

                                  Hi,

                                   

                                  "6.1.5. Configuration for a remote ServiceInvoker " in the programmers guide describes which jars and also which configuration files are required:

                                   

                                   

                                  The following configuration file is also required to be available on the classpath:

                                  jbossesb-properties.xml

                                  META-INF/uddi.xml

                                  Can you give that a try?

                                   

                                  Regards,

                                   

                                  /Daniel

                                  • 14. Re: Problem with client calling esb
                                    chandrarsa

                                    Hello Daniel,

                                     

                                    No luck after adding uddi.xml in classpath and one more doubt in my mind I ran this sample application successfully using ANT script which is provided in quickstart examples then I examine both esb archive files from using jboss dev studio [having problem to run test] and from quickstart ANT build tool [successfully run test] but both are not same. Quickstart ant build tool archive doesn't have jbossesb-properties.xml and uddi.xml

                                     

                                    Thanks&Regards

                                    Chandra

                                    1 2 Previous Next