1 Reply Latest reply on Nov 9, 2016 6:47 AM by dowjones

    JMS provider connection to JBoss ESB Service does not work (Message not serializable)

    dowjones

      I am newby to JBossESB an I am evaluating it to compare it with Mule for project implementations decisions.

      First I've deployed JBossESB version 4.10 on JBoss AS version 5.1.0.GA successfully. I can also deploy JBossESB archives to the JBoss AS.

      JBoss AS version 5.1.0.GA is running on a java 1.6 jvm.

      I tried to run a first example with a JMS provider connected to an ESB service. The use case is: A client sends a message to a JMS queue (JBossMQ) and a JBossESB service listens to the queue, receives the message and prints its content to the console. See my jboss-esb.xml below

      ----

      <?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"

          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"

          parameterReloadSecs="5">

          <!-- external providers -->

          <providers>

              <jms-provider connection-factory="ConnectionFactory"

                  name="JBossMQ">

                  <jms-bus busid="integration_layer_service_to_logic">

                      <jms-message-filter

                          dest-name="queue/integration_layer_service_to_logic_queue"

                          dest-type="QUEUE" />

                  </jms-bus>

              </jms-provider>

          </providers>

       

          <!-- esb internal services -->

          <services>

              <service category="logic" description="integration_layer_service_to_logic"

                  name="logicService">

       

                  <listeners>

                      <jms-listener busidref="integration_layer_service_to_logic"

                          name="QueueListener"/>

                  </listeners>

       

                  <actions mep="OneWay">

                      <action name="dump" class="org.jboss.soa.esb.actions.SystemPrintln">

                          <property name="printfull" value="false" />

                      </action>

                  </actions>

       

              </service>

          </services>

      </jbossesb>

      ---

      and this is my client impl ( I do not use any property files in the classpath)

      ---

      /*

      * JBoss, Home of Professional Open Source

      * Copyright 2006, JBoss Inc., and others contributors as indicated

      * by the @authors tag. All rights reserved.

      * See the copyright.txt in the distribution for a

      * full listing of individual contributors.

      * This copyrighted material is made available to anyone wishing to use,

      * modify, copy, or redistribute it subject to the terms and conditions

      * of the GNU Lesser General Public License, v. 2.1.

      * This program is distributed in the hope that it will be useful, but WITHOUT A

      * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A

      * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.

      * You should have received a copy of the GNU Lesser General Public License,

      * v.2.1 along with this distribution; if not, write to the Free Software

      * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,

      * MA  02110-1301, USA.

      *

      * (C) 2005-2006,

      * @author JBoss Inc.

      */

      package com.agcs.systems;

       

      import java.util.Properties;

       

      import javax.jms.JMSException;

      import javax.jms.ObjectMessage;

      import javax.jms.Queue;

      import javax.jms.QueueConnection;

      import javax.jms.QueueConnectionFactory;

      import javax.jms.QueueSender;

      import javax.jms.QueueSession;

      import javax.jms.TextMessage;

      import javax.naming.Context;

      import javax.naming.InitialContext;

      import javax.naming.NamingException;

       

      public class SendJMSMessage {

          QueueConnection conn;

          QueueSession session;

          Queue que;

       

          public void setupConnection() throws JMSException, NamingException {

              Properties properties1 = new Properties();

              properties1.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");

              properties1.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");

              properties1.put(Context.PROVIDER_URL, "jnp://127.0.0.1:1099");

              InitialContext iniCtx = new InitialContext(properties1);

       

              Object tmp = iniCtx.lookup("ConnectionFactory");

              QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;

              conn = qcf.createQueueConnection();

              que = (Queue) iniCtx.lookup("queue/integration_layer_service_to_logic_queue");

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

              conn.start();

              System.out.println("Connection Started");

          }

       

          public void stop() throws JMSException {

              conn.stop();

              session.close();

              conn.close();

          }

         

          public void sendAMessage(String msg) throws JMSException {

              QueueSender send = session.createSender(que);       

              ObjectMessage tm = session.createObjectMessage(msg);

              tm.setStringProperty("JMSXGroupID", "123");

              tm.setIntProperty("AIDIndex", 100);

              send.send(tm);

              send.close();

          }

       

          public static void main(String args[]) throws Exception {

              SendJMSMessage sm = new SendJMSMessage();

              sm.setupConnection();

              sm.sendAMessage("Calculate");

              sm.stop();

          }

      }

      ---

      the error is:

      ---

      10:29:42,782 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(JmsComposer.java:72)

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

              at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.pickup(TwoWayCourierImpl.java:228)

              at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.pickup(TwoWayCourierImpl.java:204)

              at org.jboss.soa.esb.listeners.message.MessageAwareListener.waitForEventAndProcess(MessageAwareListener.java:298)

              at org.jboss.soa.esb.listeners.message.MessageAwareListener.doRun(MessageAwareListener.java:254)

              at org.jboss.soa.esb.listeners.lifecycle.AbstractThreadedManagedLifecycle.run(AbstractThreadedManagedLifecycle.java:115)

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

      Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '<'

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

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

              at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java: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.skipToNextStartElement(StreamHelper.java:293)

              at org.jboss.internal.soa.esb.util.stax.StreamHelper.checkNextStartTag(StreamHelper.java:335)

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

              ... 8 more

      ---

      The queue was up and running normally.

      I tried many other configurations (2 days), but the error persists.

      It would be great if you could help me with this issue.

      Thanks in advance