2 Replies Latest reply on Oct 22, 2007 3:27 PM by noel.rocher

    quickstart helloworld client

    rwiesemann

      Hello,

      i have attempt the esb sample quickstart->helloworld on a jboss environment JBaoss-AS-4.2.0. It works excellently.

      Now, i want to refactor the sample 'SendEsbMessage' from the ant launcher to my own console-client like:

      public class SendEsbMessage
      {
       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");
      
       Message esbMessage = MessageFactory.getInstance().getMessage();
      
       esbMessage.getBody().setByteArray( "Hello - Straight to ESB listener - no Gateway".getBytes());
      
       new ServiceInvoker("FirstServiceESB", "SimpleListener").deliverAsync(esbMessage);
       }
      }
      

      It is exactly the 'quickstart->helloworld' sample.

      To start the application, i have to provide all necesary libraries for a JBoss-Esb client sending esb messages.

      The sample from the ant context use a very big class-path:
      classpath refid="exec-classpath".
      I have printed this content with
      <pathconvert property="formatted-path" refid="exec-classpath"
       pathsep="${line.separator}" />
      <echo message="path = ${formatted-path}" />
      

      and found nearly all jars on server side.

      Can you tell me, what is the necessary subset of jar files for this sample?

      I have provide all this jar files to my sample and the configuration files:
      - jbossesb-properties.xml
      - jndi.properties
      - juddi.properties
      - log4j.xml
      from the 'quickstart->helloworld' sample.
      But the result is not the same as from 'quickstart->helloworld'.
      The result is a exception:

      12:43:38,757 ERROR [main][JAXRRegistryImpl] Could not set up a connection to the Registry. Invalid queryManagerURL: jnp://localhost:1099/InquiryService?org.apache.juddi.registry.rmi.Inquiry#inquire
      javax.xml.registry.InvalidRequestException: Invalid queryManagerURL: jnp://localhost:1099/InquiryService?org.apache.juddi.registry.rmi.Inquiry#inquire
       at org.apache.ws.scout.registry.ConnectionFactoryImpl.createConnection(ConnectionFactoryImpl.java:77)
       at org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl.getConnection(JAXRRegistryImpl.java:108)
       at org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl.findEPRs(JAXRRegistryImpl.java:314)
       at org.jboss.soa.esb.listeners.RegistryUtil.getEprs(RegistryUtil.java:216)
       at org.jboss.soa.esb.client.ServiceInvoker.loadServiceClusterInfo(ServiceInvoker.java:412)
       at org.jboss.soa.esb.client.ServiceInvoker.<init>(ServiceInvoker.java:117)
       at org.jboss.soa.esb.client.ServiceInvoker.<init>(ServiceInvoker.java:140)
       at labesb42.SendEsbMessage.main(SendEsbMessage.java:52)
      Caused by: java.net.MalformedURLException: unknown protocol: jnp
       at java.net.URL.<init>(URL.java:574)
       at java.net.URL.<init>(URL.java:464)
       at java.net.URL.<init>(URL.java:413)
       at org.apache.ws.scout.registry.ConnectionFactoryImpl.createConnection(ConnectionFactoryImpl.java:74)
       ... 7 more
      Exception in thread "main" java.lang.NullPointerException
       at org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl.findService(JAXRRegistryImpl.java:436)12:43:38,787 ERROR [main][JAXRRegistryImpl] Could not set up a connection to the Registry. Invalid queryManagerURL: jnp://localhost:1099/InquiryService?org.apache.juddi.registry.rmi.Inquiry#inquire
      javax.xml.registry.InvalidRequestException: Invalid queryManagerURL: jnp://localhost:1099/InquiryService?org.apache.juddi.registry.rmi.Inquiry#inquire
       at org.apache.ws.scout.registry.ConnectionFactoryImpl.createConnection(ConnectionFactoryImpl.java:77)
       at org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl.getConnection(JAXRRegistryImpl.java:108)
       at org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl.findService(JAXRRegistryImpl.java:433)
       at org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl.findEPRs(JAXRRegistryImpl.java:316)
       at org.jboss.soa.esb.listeners.RegistryUtil.getEprs(RegistryUtil.java:216)
       at org.jboss.soa.esb.client.ServiceInvoker.loadServiceClusterInfo(ServiceInvoker.java:412)
       at org.jboss.soa.esb.client.ServiceInvoker.<init>(ServiceInvoker.java:117)
       at org.jboss.soa.esb.client.ServiceInvoker.<init>(ServiceInvoker.java:140)
       at labesb42.SendEsbMessage.main(SendEsbMessage.java:52)
      Caused by: java.net.MalformedURLException: unknown protocol: jnp
       at java.net.URL.<init>(URL.java:574)
       at java.net.URL.<init>(URL.java:464)
       at java.net.URL.<init>(URL.java:413)
       at org.apache.ws.scout.registry.ConnectionFactoryImpl.createConnection(ConnectionFactoryImpl.java:74)
       ... 8 more
      
       at org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl.findEPRs(JAXRRegistryImpl.java:316)
       at org.jboss.soa.esb.listeners.RegistryUtil.getEprs(RegistryUtil.java:216)
       at org.jboss.soa.esb.client.ServiceInvoker.loadServiceClusterInfo(ServiceInvoker.java:412)
       at org.jboss.soa.esb.client.ServiceInvoker.<init>(ServiceInvoker.java:117)
       at org.jboss.soa.esb.client.ServiceInvoker.<init>(ServiceInvoker.java:140)
       at labesb42.SendEsbMessage.main(SendEsbMessage.java:52)
      


      Can you tell me, what is the reason for this?

      Thank you.


        • 1. Re: quickstart helloworld client
          burrsutter

          if you look at the helloworld quickstart sample, you'll find a few additional files in the "root" of the project.
          jbossesb-properties.xml
          jndi.properties
          juddi.properties
          log4j.xml

          I believe all 4 of these are required for the client you are trying to build. And you are right, we should clearly indicate which jar files are needed by a remote client. That is something we'll need to work on.

          Burr

          • 2. Re: quickstart helloworld client
            noel.rocher

            This is what is working for me :

             <target name="sendesb" depends="compile"
             description="Will send an esb Message">
            
             <path id="explicit-classpath">
             <!-- used to find config files -->
             <pathelement location="."/>
             <!-- used to find the client classe -->
             <pathelement location="build/classes"/>
             <!-- explicit list of jar used by ServiceInvoker -->
             <fileset dir="../../../lib/ext">
             <include name="jbossall-client.jar"/>
             <include name="jboss-remoting.jar"/>
             <include name="jboss-messaging-client.jar"/>
             <include name="commons-logging-1.0.4.jar"/>
             <include name="jbossts-common.jar"/>
             <include name="juddi-client-1.0-SNAPSHOT.jar"/>
             <include name="jaxr-api-1.0rc1.jar"/>
             <include name="scout-1.0rc1.jar"/>
             <include name="log4j.jar"/>
             <include name="xbean.jar"/>
             <include name="stax-api-1.0.1.jar"/>
             <include name="xercesImpl-2.7.1.jar"/>
             <include name="xml-apis-1.3.02.jar"/>
             </fileset>
             <fileset dir="../../../lib/jbossesb.sar/lib">
             <include name="jbossesb-rosetta.jar"/>
             </fileset>
             <!-- jboss-aop-jdk50-client.jar is not enough DynamicAOPStrategy seems to be needed -->
             <fileset dir="${org.jboss.esb.server.home}/server/${org.jboss.esb.server.config}/deploy/jboss-aop-jdk50.deployer">
             <include name="jboss-aop-jdk50.jar"/>
             </fileset>
             </path>
            
            
             <echo>Runs Test ESB Message Sender</echo>
             <java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.helloworld.test.SendEsbMessage" failonerror="true" >
             <arg value="FirstServiceESB"/> <!-- service category -->
             <arg value="SimpleListener"/> <!-- service name -->
             <arg value="Hello World - Straight to ESB listener - no Gateway"/> <!-- Message text -->
             <classpath refid="explicit-classpath"/>
             </java>
             </target>