5 Replies Latest reply on Mar 11, 2014 9:56 AM by Viliam Kasala

    Switchyard Netty TCP binding - Automatic Serialization of returned Object doesn't work

    Viliam Kasala Newbie

      Hello,

       

      I am trying to write simple app, which has TCP biding. Signature of method is:

       

      OrderAck processTwoWay(SimpleOrder order);


      TCP biding is set to sync=true - to indicate Request - Response, allowDefaultCodec=false and all other config is set to default as Switchyard editor set. OrderAck implements serializable.


      My problem is that when this object is returned following error occurs:


      12:31:53,415 WARN  [org.apache.camel.component.netty.NettyConsumer] (New I/O worker #289) Caused by: [org.apache.camel.CamelExchangeException - Cannot write response to /127.0.0.1:58123. Exchange[Message: <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

      <orderAck accepted="false" xmlns="urn:jboss-soa:order-service:1.0">

          <simpleOrder id="1">

              <items>

                  <item sku="2">

                      <count>3</count>

                      <pricePerUnit>4.0</pricePerUnit>

                  </item>

              </items>

              <name>processTwoWay</name>

              <quantity>1</quantity>

          </simpleOrder>

      </orderAck>

      ]. Caused by: [java.lang.IllegalArgumentException - unsupported message type: class org.jboss.soa.qa.shared.data.OrderAck]]: org.apache.camel.CamelExchangeException: Cannot write response to /127.0.0.1:58123. Exchange[Message: <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

      <orderAck accepted="false" xmlns="urn:jboss-soa:order-service:1.0">

          <simpleOrder id="1">

              <items>

                  <item sku="2">

                      <count>3</count>

                      <pricePerUnit>4.0</pricePerUnit>

                  </item>

              </items>

              <name>processTwoWay</name>

              <quantity>1</quantity>

          </simpleOrder>

      </orderAck>

      ]. Caused by: [java.lang.IllegalArgumentException - unsupported message type: class org.jboss.soa.qa.shared.data.OrderAck]

          at org.apache.camel.component.netty.handlers.ServerResponseFutureListener.operationComplete(ServerResponseFutureListener.java:53) [camel-netty-2.10.0.redhat-60024.jar:2.10.0.redhat-60024]

          at org.jboss.netty.channel.DefaultChannelFuture.notifyListener(DefaultChannelFuture.java:427)

          at org.jboss.netty.channel.DefaultChannelFuture.notifyListeners(DefaultChannelFuture.java:413)

          at org.jboss.netty.channel.DefaultChannelFuture.setFailure(DefaultChannelFuture.java:380)

          at org.jboss.netty.channel.socket.nio.AbstractNioWorker.write0(AbstractNioWorker.java:249)

          at org.jboss.netty.channel.socket.nio.AbstractNioWorker.writeFromTaskLoop(AbstractNioWorker.java:152)

          at org.jboss.netty.channel.socket.nio.AbstractNioChannel$WriteTask.run(AbstractNioChannel.java:335)

          at org.jboss.netty.channel.socket.nio.AbstractNioSelector.processTaskQueue(AbstractNioSelector.java:366)

          at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:290)

          at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:90)

          at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)

          at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)

          at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)

          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]

          at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]

       

       

      Could somebody provide simple example of how to set correct the object serialization? Thank you.

       

      Viliam Kasala