10 Replies Latest reply on Jun 12, 2008 8:05 AM by Martin Vecera

    Sending esb message..Problems..

    Andrey Filippov Newbie

      Hello everybody!

      I have got the following problem - when I prepare client to send esb message I get null pointer exception. The deployement of esb project fulfilled without any faults. My client is a simple class with main method, which is part of ejb project. Here is my jboss-esb.xml:

      <?xml version = "1.0" encoding = "UTF-8"?>
      <jbossesb
       xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd"
       parameterReloadSecs="5">
      
       <providers>
       <jms-provider name="JBossMQ"
       connection-factory="ConnectionFactory"
       jndi-URL="jnp://127.0.0.1:1099"
       jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
       jndi-pkg-prefix="org.jboss.naming:org.jnp.interfaces">
      
      
       <jms-bus busid="esbChannel">
       <jms-message-filter dest-type="QUEUE"
       dest-name="queue/request_esb" />
       </jms-bus>
      
       </jms-provider>
      
       <jbr-provider name="JBR-Http-HR-CF" protocol="http" host="localhost">
       <jbr-bus busid="Http-2" port="8766"/>
       </jbr-provider>
       </providers>
      
       <services>
      
       <service category="HRtoCFCategory" name="CandidateListener"
       description="Main ESB Gate">
       <listeners>
       <jms-listener name="helloWorld"
       busidref="esbChannel" maxThreads="5" />
       </listeners>
      
       <actions mep="OneWay">
       <action name="action1"
       class="com.tsystems.tintra4.esb.listeners.CandidateToEmplListenerAction"
       process="displayMessage" />
      
       <action name="register_a_new_employee_process"
       class="org.jboss.soa.esb.services.jbpm.actions.BpmProcessor">
      
       <property name="command"
       value="StartProcessInstanceCommand" />
      
       <property name="process-definition-name"
       value="CFjBPM" />
      
      
      
       <property name="esbToBpmVars">
       <mapping esb="BODY_CONTENT" bpm="theBody" />
       </property>
      
      
      
       </action>
      
       </actions>
       </service>
      
       <service category="HRtoCFCategory" name="WSProducerService" invmScope="GLOBAL" description="WS Frontend speaks natively to the ESB">
      
       <listeners>
       <!--
       <jms-listener name="helloWorld"
       busidref="esbChannel" maxThreads="5" />
       -->
       <jbr-listener name="Http-Gateway" busidref="Http-2" is-gateway="true" maxThreads="1"/>
      
       </listeners>
       <actions>
       <action name="print-before" class="org.jboss.soa.esb.actions.SystemPrintln">
       <property name="id"
       value="BEFORE invoking jbossws endpoint"/>
       </action>
       <action name="JBossWSAdapter" class="org.jboss.soa.esb.actions.soap.SOAPProcessor">
       <property name="jbossws-endpoint" value="ESBTriggerWS"/>
       </action>
       <action name="print-after" class="org.jboss.soa.esb.actions.SystemPrintln">
       <property name="id"
       value="AFTER invoking jbossws endpoint"/>
       </action>
       </actions>
       </service>
      
       <service category="TestCategory" name="WSClientService" description="WS Client + ESB">
      
       <listeners>
       <jms-listener name="helloWorld"
       busidref="esbChannel" maxThreads="5" />
       </listeners>
      
       <actions mep="OneWay">
       <action name="request-mapper"
       class="com.tsystems.test.ws.consumer.RequestAction">
       </action>
       <action name="print-before" class="org.jboss.soa.esb.actions.SystemPrintln">
       <property name="id"
       value="BEFORE invoking jbossws endpoint"/>
       </action>
       <action name="soapui-client-action"
       class="org.jboss.soa.esb.actions.soap.SOAPClient">
       <property name="wsdl"
       value="http://127.0.0.1:8080/HRtoCFesbTrigger/ESBTriggerWS?wsdl" />
       <property name="responseAsOgnlMap" value="true" />
       <property name="SOAPAction" value="gitNameById"/>
       </action>
       <action name="response-mapper"
       class="com.tsystems.test.ws.consumer.ResponseAction">
       </action>
       </actions>
      
       </service>
      
      
      
       </services>
      
      </jbossesb>


      deployement.xml:

      <jbossesb-deployment>
      <depends>jboss.esb.destination:service=Queue,name=request_esb</depends>
      </jbossesb-deployment>


      jbmq-queue-service.xml:

      <?xml version="1.0" encoding="UTF-8"?>
      <server>
       <mbean code="org.jboss.mq.server.jmx.Queue"
       name="jboss.esb.destination:service=Queue,name=request_esb">
       <depends optional-attribute-name="DestinationManager">
       jboss.mq:service=DestinationManager
       </depends>
       </mbean>
      
      </server>
      

      and my java code for message sending:

      System.setProperty("javax.xml.registry.ConnectionFactoryClass","org.apache.ws.scout.registry.ConnectionFactoryImpl");
       // Create a message, assign it a UID, and fill in call information
       Message esbMessage = MessageFactory.getInstance().getMessage();
       Call call = new Call();
       call.setMessageID(new URI(UUID.randomUUID().toString()));
       esbMessage.getHeader().setCall(call);
      
       String mess = "Test";
       esbMessage.getBody().add(mess);
       org.jboss.soa.esb.Service service = new org.jboss.soa.esb.Service("TestCategory","WSClientService");
       ServiceInvoker invoker = new ServiceInvoker(service);
       invoker.deliverAsync(esbMessage);

      And finally I get this stack:

      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:69)
       at org.jboss.soa.esb.services.registry.RegistryFactory.getRegistry(RegistryFactory.java:56)
       at org.jboss.soa.esb.listeners.RegistryUtil.getEprs(RegistryUtil.java:220)
       at org.jboss.soa.esb.client.ServiceInvoker.loadServiceClusterInfo(ServiceInvoker.java:428)
       at org.jboss.soa.esb.client.ServiceInvoker.<init>(ServiceInvoker.java:155)
       at org.jboss.soa.esb.client.ServiceInvoker.<init>(ServiceInvoker.java:136)
       at com.tsystems.test.client.WSClient.checkWSClient(WSClient.java:132)
       at com.tsystems.test.client.WSClient.main(WSClient.java:86)
      org.jboss.soa.esb.listeners.message.MessageDeliverException: Invocation exception. null
       at org.jboss.soa.esb.client.ServiceInvoker.loadServiceClusterInfo(ServiceInvoker.java:441)
       at org.jboss.soa.esb.client.ServiceInvoker.<init>(ServiceInvoker.java:155)
       at org.jboss.soa.esb.client.ServiceInvoker.<init>(ServiceInvoker.java:136)
       at com.tsystems.test.client.WSClient.checkWSClient(WSClient.java:132)
       at com.tsystems.test.client.WSClient.main(WSClient.java:86)
      Caused by: org.jboss.soa.esb.services.registry.RegistryException: Invocation exception. null
       at org.jboss.soa.esb.services.registry.RegistryFactory.createRegistry(RegistryFactory.java:82)
       at org.jboss.soa.esb.services.registry.RegistryFactory.getRegistry(RegistryFactory.java:56)
       at org.jboss.soa.esb.listeners.RegistryUtil.getEprs(RegistryUtil.java:220)
       at org.jboss.soa.esb.client.ServiceInvoker.loadServiceClusterInfo(ServiceInvoker.java:428)
       ... 4 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:69)
       ... 7 more

      On the ServiceInvoker invoker = new ServiceInvoker(service) line...

      Please, could someone give me a clue... I am very close to give up..((( Thanks.