10 Replies Latest reply on Aug 20, 2012 1:33 PM by Hitz Jain

    New to ESB, question on configuration

    Jason Adam Newbie

      Hello there, I've just started working with JBoss ESB 4.7.  For our purposes, it's going to act as a message router, passing JMS Text Messages around depending on data within the message.  The goal is to have the ESB put hooks into different servers running and listen for messages on give topics/queues.

       

      For testing purposes, I want to configure the ESB to listen to a queue in an external JBoss 6 server, and when a message arrives there it sends it to a queue on an external ActiveMQ server.  So very basic.  I have a two test classes, one that sends the message and one that listens and prints the message out. 

       

      My jboss-esb.xml looks like the following:

       

      <?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://externaljbosshose:1099"
            jndi-context-factory="org.jnp.interfaces.NamingContextFactory">     
                           
                    <jms-bus busid="testIn">
                        <jms-message-filter
                            dest-type="QUEUE"
              dest-name="/queue/testInQueue"/>
            </jms-bus>
            </jms-provider>
            </providers>
           
            <services>
              <service
               category="JMSSecuredESB"
               name="SimpleListener"
               description="Text Message Router">
                  <listeners>
                      <jms-listener name="JMS-Gateway" busidref="testIn" is-gateway="false" >
          </jms-listener>
                  </listeners>
                  <actions mep="OneWay">
           <action name="routeToReplyQueue" class="org.jboss.soa.esb.actions.routing.JMSRouter">
            <property name="jndi-context-factory" value="org.apache.activemq.jndi.ActiveMQInitialContextFactory"/>
            <property name="jndi-URL" value="tcp://externalactivemqhost:61616"/>
            <property name="jndi-pkg-prefix" value="org.apache.activemq.jndi"/>
            <property name="connection-factory" value="ConnectionFactory"/>
            <property name="jndiName"
             value="testOutQueue"/>
            <property name="unwrap" value="true"/>
            <property name="security-principal" value="guest"/>
            <property name="security-credential" value="guest"/>
             </action>               
                         
                  </actions>
              </service>
            </services>
          
      </jbossesb>

       

      If I use this configuration, I get the following message:

       

      14:22:05,349 ERROR [JmsComposer] Unsupported JMS message type: org.hornetq.jms.client.HornetQTextMessage for incoming ESB-aware message.

       

      If I change is-gateway to true, the ESB server throws an exception saying:

       

      Caused by: org.jboss.soa.esb.ConfigurationException: Service 'JMSSecuredESB:SimpleListener' does not define a Message-Aware (is-gateway='false') nor InVm Listener.

       

      So I'm guessing I'm just missing some other configuration to tell the ESB that it's just passing a JMS message along, but I'm not sure where to look.  I've gone through a lot of the sample configurations but none of them seem to address this particular case of not holding the queues itself, but instead just routing from one external queue to another (or if there is that example, it's lost on me, which is very possible).

       

      Any help in pointing me to a source or configuration to get this working would be tremendously helpful.

       

      Thanks in advance

      Jason

       

      EDIT:  Ok, so after doing some more reading, the issue was I was using TextMessage objects instead of ObjectMessage.  So I changed that, but after doing so cause a whole new error (but at least I'm advancing in some direction).  For the object that I set in the ObjectMessage, I just put a simple String saying "Test".

       

      The error is below:

       

      16:41:50,260 ERROR [JmsComposer] Object in JMS message is not a Serializeable

      java.io.IOException: Util.deserialize caught XMLStreamException

              at org.jboss.soa.esb.util.Util.deserialize(Util.java:225)

              at org.jboss.internal.soa.esb.couriers.helpers.JmsComposer.compose(JmsCo

      mposer.java:72)

              at org.jboss.internal.soa.esb.couriers.JmsCourier.pickup(JmsCourier.java

      :460)

              at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.pickup(TwoWayCo

      urierImpl.java:228)

              at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.pickup(TwoWayCo

      urierImpl.java:204)

              at org.jboss.soa.esb.listeners.message.MessageAwareListener.waitForEvent

      AndProcess(MessageAwareListener.java:297)

              at org.jboss.soa.esb.listeners.message.MessageAwareListener.doRun(Messag

      eAwareListener.java:253)

              at org.jboss.soa.esb.listeners.lifecycle.AbstractThreadedManagedLifecycl

      e.run(AbstractThreadedManagedLifecycle.java:115)

              at java.lang.Thread.run(Thread.java:662)

      Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'T

      ' (code 84) in prolog; expected '<'

      at [row,col {unknown-source}]: [1,1]

              at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:

      623)

              at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.ja

      va:2047)

              at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)

              at com.ctc.wstx.sr.BasicStreamReader.nextTag(BasicStreamReader.java:1095

      )

              at org.jboss.internal.soa.esb.util.stax.StreamHelper.skipToNextStartElem

      ent(StreamHelper.java:293)

              at org.jboss.internal.soa.esb.util.stax.StreamHelper.checkNextStartTag(S

      treamHelper.java:335)

              at org.jboss.soa.esb.util.Util.deserialize(Util.java:218)

              ... 8 more

       

      I found some sources online that talked about needing to upgrade to some other version of SOAP but I'm not sure that is valid here.  Has anyone else experienced this?

       

      Thanks

      Jason

       

      FINAL EDIT: Woohoo, success!  So apparently I just needed to add a native inVm queue and listener, and now TextMessage objects work wonderfully.  I'm assuming the inVm listener is used as a sort of bridge between the two external messaging systems. Sort of like an intermediary endpoint that the gateway then acts upon and then sends it to the final endpoint (hopefully I understand that correctly).  But yay, it works.

        • 1. Re: New to ESB, question on configuration
          chian Newbie

          I'm also facing the same problem.

           

          Would you please help me with it. Where and how to define the inVm Queue and Listener?

           

          Please HELP

          • 2. Re: New to ESB, question on configuration
            zerayaqob Newbie

            Glad you were able to solve it. Basically you either have to define your listtener as invm or provide a second jms listener that is esb-aware.

            • 3. Re: New to ESB, question on configuration
              Hitz Jain Newbie

              Hi Jason,

               

              I am new to JBOSS ESB and I have a similar requirement as you had done sometime back.

               

              My requirement is as:

              1) Machine1 - JBOSS AS 7.1 (JMS message producer) puts it on a queue.

              2) Machine2 - JBOSS ESB 4.11 (ESB message listener - I am sure it has to be gateway listener) and then process it.

               

              Can you please share the code base to get this done. I am desparately looking to perform this activity.

               

               

              Regards,

              Hitesh

              hitjain_83@hotmail.com

              • 4. Re: New to ESB, question on configuration
                Tom Cunningham Master

                Hi Hitesh,

                 

                Putting a message on a JMS queue should be easy enough - there are tons of examples out there of how to do that.      For the ESB portion, I'd suggest starting with the quickstarts - probably with the helloworld quickstart, which processes messages from the queue "queue/quickstart_helloworld_Request_gw".

                 

                There's a decent Getting Started document that you should go through as well :

                 

                http://docs.jboss.org/jbossesb/docs/4.11/manuals/html/Getting_Started_Guide/index.html

                • 5. Re: New to ESB, question on configuration
                  Hitz Jain Newbie

                  Hi Tom,

                   

                  Thx for your quick reply.

                  I do understand that there are tons of examples for JbossAS 7.1 JMS queues, but unfortunately all of these talks about 1 machine acting as both sender and receiver (which works for me).

                  I am looking for samples which involves multiple machines - sender on machine 1 and receiver on machine 2.  Also, not any of them clearly talks about the server side configuration changes (standalone.xml, hornetq.xml and what other files needs to be changed to accomplish this).

                   

                  On JAS7.1 using the quick start - created the sender to publish a message to the localhost using "org.jboss.naming.remote.client.InitialContextFactory" and "remote://localhost:4447" and it worked fine.

                   

                  Now when I change the URL from localhost to send it to my machine ip v4 address "remote://10.195.165.75:4449" it fails.

                     Link-local IPv6 Address . . . . . : fe80::41f9:271:2bf7:1b0f%13
                     IPv4 Address. . . . . . . . . . . : 10.195.165.75
                     Subnet Mask . . . . . . . . . . . : 255.255.254.0
                     Default Gateway . . . . . . . . . : fe80::3d7b:c474:bf0f:a207%13
                                                                        10.195.164.1

                   

                  Aug 15, 2012 11:12:03 AM org.jboss.as.quickstarts.jms.HelloWorldJMSClient main
                  SEVERE: Failed to create remoting connection
                  [INFO] ------------------------------------------------------------------------
                  [INFO] BUILD FAILURE
                  [INFO] ------------------------------------------------------------------------

                   

                  So issue 1 on above is how do I drop a message to a queue on a remote PC?

                                   2 what config needs to be changed when doing all this?

                   

                  For Jboss ESB I have done almost all the required quickstarts to understand how these flow, but missing the same thing of server side config changes that are always required from 1 machine to another.

                  With Jboss ESB - there is a file named "jndi.properties" which has

                      

                  java.naming.factory.initial=

                  org.jnp.interfaces.NamingContextFactory

                   

                   

                  java.naming.provider.url=jnp://localhost:1099

                  java.naming.factory.url.pkgs=org.jnp.interfaces

                  In the same regards with my requirement I want my queues to point to a different machine instead of localhost?

                  Also how are the gateway and esb channel exactly used in ESB.

                  I understood gateway is for external requests coming in to the application and non gateway channel is within the application. If true then when do we really use the esb queue?

                   

                  Answers to the above question would help.

                  I have also created a new post to avoid confusions on this.

                  Regards,

                  Jain

                  • 6. Re: New to ESB, question on configuration
                    Tom Cunningham Master

                    Do you have a stack trace to go along with this?    Can you attach your org.jboss.as.quickstarts.jms.HelloWorldJMSClient source?

                     

                    Which JMS provider are you using on each side?  

                    • 7. Re: New to ESB, question on configuration
                      Hitz Jain Newbie

                      Updated: Attached the 2 projects - helloworld_testclient - on JBoss AS 7 message producer

                                                                                  helloworld.esb - jboss soa 5.2 - message consumer.                  Unable to work the combination out..

                       

                      Hi Tom,

                       

                      I do not have a stack trace at this time.

                      This is what I am trying to do.

                      1) Setup a local server for JBoss AP 7.1 with a new queue - Reg

                       

                      Queue (added in standalone-full.xml) as directed. - Works with an ip address - added in standalone-full.xml - Changed the ip address for the jms queue using the interface field - Default JMS queue config provided by jboss - nothing special about it.

                       

                       

                      standalone-full.xml:

                      a)

                           <interfaces>

                               ................ (others as usual)

                              <interface name="messaging">
                                   <inet-address value="${jboss.bind.address:10.195.165.75}"/>
                              </interface>
                          </interfaces>

                       

                      b)                 <jms-queue name="RegQueue">
                                                       <entry name="queue/RegQueue"/>
                                                       <entry name="java:jboss/exported/jms/queue/RegQueue"/>
                                                       <durable>true</durable>
                                          </jms-queue>

                       

                      c)  <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">

                               ................

                               <socket-binding name="remoting" interface="messaging" port="4447"/>

                           </socket-binding-group>

                       

                      d) Client code -

                                

                       

                       

                       

                      Properties properties = new

                      Properties();

                       

                       

                       

                      properties.put(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming.remote.client.InitialContextFactory");

                      properties.put(Context.PROVIDER_URL, "remote://10.195.165.75:4447");

                       

                       

                      properties.put(Context.SECURITY_PRINCIPAL, "testuser");

                      properties.put(Context.SECURITY_CREDENTIALS, "testpass");

                       

                       

                       

                       

                       

                      Context iniCtx = new InitialContext(properties);

                       

                       

                       

                       

                       

                       

                      QueueConnectionFactory qcf = (QueueConnectionFactory) iniCtx.lookup("jms/RemoteConnectionFactory");

                       

                       

                        conn = qcf.createQueueConnection("testuser","testpass");

                       

                       

                       

                      queue = (Queue) iniCtx.lookup("jms/queue/RegQueue");

                       

                       

                       

                      session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);

                       

                       

                       

                      conn.start();

                       

                       

                       

                       

                       

                      QueueSender send = session.createSender(queue);

                       

                      ObjectMessage oMsg = session

                      .createObjectMessage(text);

                       

                       

                      send.send(oMsg);

                       

                       

                       

                      Need a way to see this message on the queue - Not sure what type of tool I can use to see the message.

                       

                       

                      2) Setup Jboss ESB application on local server. Created eclipse jboss esb project from scratch

                       

                      deployment.xml

                       

                       

                      <jbossesb-deployment>

                       

                      <depends>jboss.esb.quickstart.destination:service=Queue,name=RegQueue</depends

                      >

                      </

                       

                      jbossesb-deployment

                      >

                       

                       

                       

                       

                       

                      jboss-esb.xml

                       

                                          <?xml version="1.0"?>
                      <jbossesb parameterReloadSecs="5"
                      xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd"
                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">
                      <providers>
                        <jms-provider connection-factory="ConnectionFactory" name="JBoss Message Queue">
                         <jms-bus busid="JMS_GW_Channel1">
                          <jms-message-filter dest-name="queue/RegQueue" dest-type="QUEUE"/>
                         </jms-bus>
                        </jms-provider>
                      </providers>
                      <services>
                        <service category="FirstServiceESB" description="Hello World"
                         invmScope="GLOBAL" name="SimpleListener">
                         <listeners>
                          <jms-listener busidref="JMS_GW_Channel1" is-gateway="true" name="JMS Gateway Listener"/>
                         </listeners>
                         <actions mep="OneWay">
                           <action class="org.jboss.soa.esb.samples.quickstart.helloworld.MyJMSListenerAction" name="action1"/>
                          <action class="org.jboss.soa.esb.actions.TestMessageStore" name="testStore"/>
                         </actions>
                        </service>
                      </services>
                      </jbossesb>

                       

                      The jbm-queue-service.xml is also configured to use the above.

                       

                      The above 3 files are all in <project>/esbcontent/jbm-queue-service.xml and <project>/esbcontent/META-INF/ -- deployment.xml and jboss-esb.xml

                       

                      When I run the sendJMSMessage all works fine and we know all this is within the same jvm and same machine (localhost).

                      3) Would be to process this incoming message to another ESB-unaware topic/queue on another jvm.

                      Questions:

                      1) Now I need to set up by jboss esb to listen to another JVM

                      2) Need to read to different ip address (queues hosted by another instance of JVM on another machine). So need to know what are all the files I need to change and which properties points to the jms server?

                      3) Also if you have any inputs for performing step 3 it will be helpful.    

                       

                      Also, if there is a doc like https://docs.jboss.org/author/display/AS7/Admin+Guide#AdminGuide-Targetaudience for JBOSS SOA 5.2 (ESB 4.10)  that will be helpful. This provide more of configuration info and helped me setup step 1 in this process.

                      -Jain

                       

                       

                      • 8. Re: New to ESB, question on configuration
                        chian Newbie

                        How to signal a waiting node in jbpm via esb? I am using jbpm 3.2.1

                        and the jbossesb-server 4.11


                        Please Help

                         

                        • 9. Re: New to ESB, question on configuration
                          Tom Cunningham Master

                          Hitz Jain wrote:

                           

                          Questions:

                          1) Now I need to set up by jboss esb to listen to another JVM

                          2) Need to read to different ip address (queues hosted by another instance of JVM on another machine). So need to know what are all the files I need to change and which properties points to the jms server?

                          3) Also if you have any inputs for performing step 3 it will be helpful.    

                           

                          Also, if there is a doc like https://docs.jboss.org/author/display/AS7/Admin+Guide#AdminGuide-Targetaudience for JBOSS SOA 5.2 (ESB 4.10)  that will be helpful. This provide more of configuration info and helped me setup step 1 in this process.

                           

                           

                          You need to get a stack trace.    I have no idea what is failing here.

                           

                          If you want ESB to consume from a remote hornetq queue (in which case, check out https://community.jboss.org/message/556013).       If you want to simply send a message from your AS7 node to a queue that ESB is listening to on AS 5.1.0.GA - check out the jboss-messaging examples probably would be the best way to proceed (http://www.jboss.org/jbossmessaging/downloads).

                           

                          You mentioned that you are using SOA-P - if you have a support contract, I'd file a support case and start there.    

                          • 10. Re: New to ESB, question on configuration
                            Hitz Jain Newbie

                            Hi Tom,

                             

                            I was now able to create these files and here are some of the info you looking for

                            1) Jboss esb server (running on 10.194.224.234) with attached jboss-esb.xml - Consumer -

                            2) Jboss application server - with attached Sender.java - Producer

                            3) Running Sender.java as java application - get the below exception.

                                   

                             

                             

                             

                             

                             

                             

                             

                             

                             

                             

                             

                             

                             

                             

                             

                             

                             

                            Exception in thread "main"

                             

                            javax.naming.CommunicationException: Could not obtain connection to any of these urls: 10.194.224.234:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server /10.194.224.234:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server /10.194.224.234:1099 [Root exception is java.net.ConnectException

                            : Connection refused: connect]]]

                            at org.jnp.interfaces.NamingContext.checkRef(

                             

                            NamingContext.java:1763

                            )

                            at org.jnp.interfaces.NamingContext.lookup(

                             

                            NamingContext.java:693

                            )

                            at org.jnp.interfaces.NamingContext.lookup(

                             

                            NamingContext.java:686

                            )

                            at javax.naming.InitialContext.lookup(Unknown Source)

                            at org.jboss.soa.esb.samples.quickstart.helloworld.test.Sender.initializeSender(

                             

                            Sender.java:59

                            )

                            at org.jboss.soa.esb.samples.quickstart.helloworld.test.Sender.<init>(

                             

                            Sender.java:38

                            )

                            at org.jboss.soa.esb.samples.quickstart.helloworld.test.Sender.main(

                             

                            Sender.java:130

                            )

                            Caused by:

                             

                            javax.naming.CommunicationException: Failed to connect to server /10.194.224.234:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server /10.194.224.234:1099 [Root exception is java.net.ConnectException

                            : Connection refused: connect]]

                            at org.jnp.interfaces.NamingContext.getServer(

                             

                            NamingContext.java:335

                            )

                            at org.jnp.interfaces.NamingContext.checkRef(

                             

                            NamingContext.java:1734

                            )

                            ... 6 more

                            Caused by:

                             

                            javax.naming.ServiceUnavailableException: Failed to connect to server /10.194.224.234:1099 [Root exception is java.net.ConnectException

                            : Connection refused: connect]

                            at org.jnp.interfaces.NamingContext.getServer(

                             

                            NamingContext.java:305

                            )

                            ... 7 more

                            Caused by:

                             

                            java.net.ConnectException

                            : Connection refused: connect

                            at java.net.PlainSocketImpl.socketConnect(

                             

                            Native Method

                            )

                            at java.net.PlainSocketImpl.doConnect(Unknown Source)

                            at java.net.PlainSocketImpl.connectToAddress(Unknown Source)

                            at java.net.PlainSocketImpl.connect(Unknown Source)

                            at java.net.SocksSocketImpl.connect(Unknown Source)

                            at java.net.Socket.connect(Unknown Source)

                            at org.jnp.interfaces.TimedSocketFactory.createSocket(

                             

                            TimedSocketFactory.java:97

                            )

                            at org.jnp.interfaces.TimedSocketFactory.createSocket(

                             

                            TimedSocketFactory.java:82

                            )

                            at org.jnp.interfaces.NamingContext.getServer(

                             

                            NamingContext.java:301

                            )

                            ... 7 more

                             

                             

                            Everything works if both are on 1 machine and I use localhost.

                            Please let me know if you need more info?