[mule-user] Jms Transport Not able to send / receive messages

122 views
Skip to first unread message

PawanModi

unread,
Sep 22, 2008, 2:28:31 AM9/22/08
to us...@mule.codehaus.org

Hello Friends,

I am using mule2.0. I am using mule JMS connector to publish & receive
message.
My mule clients (publisher & consumer) both are opting mule services via
remote dispatcher.

My mule config file:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:stdio="http://www.mulesource.org/schema/mule/stdio/2.0"
xmlns:vm="http://www.mulesource.org/schema/mule/vm/2.0"
xmlns:ejb="http://www.mulesource.org/schema/mule/ejb/2.0"
xmlns:jms="http://www.mulesource.org/schema/mule/jms/2.0"
xmlns:client="http://www.mulesource.org/schema/mule/client/2.0"
xmlns:tcp="http://www.mulesource.org/schema/mule/tcp/2.0"
xsi:schemaLocation="
http://www.mulesource.org/schema/mule/core/2.0
http://www.mulesource.org/schema/mule/core/2.0/mule.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.mulesource.org/schema/mule/vm/2.0
http://www.mulesource.org/schema/mule/vm/2.0/mule-vm.xsd
http://www.mulesource.org/schema/mule/ejb/2.0
http://www.mulesource.org/schema/mule/ejb/2.0/mule-ejb.xsd
http://www.mulesource.org/schema/mule/stdio/2.0
http://www.mulesource.org/schema/mule/stdio/2.0/mule-stdio.xsd
http://www.mulesource.org/schema/mule/jms/2.0
http://www.mulesource.org/schema/mule/jms/2.0/mule-jms.xsd
http://www.mulesource.org/schema/mule/client/2.0
http://www.mulesource.org/schema/mule/client/2.0/mule-client.xsd
http://www.mulesource.org/schema/mule/tcp/2.0
http://www.mulesource.org/schema/mule/tcp/2.0/mule-tcp.xsd">

<client:remote-dispatcher-agent>
<client:remote-endpoint address="tcp://localhost:60504"
synchronous="true" />
</client:remote-dispatcher-agent>

<vm:connector name="asyncVm" queueEvents="true" />

<jms:connector name="jmsConnector" connectionFactory-ref="openMQ"
specification="1.1"
persistentDelivery="true" maxRedelivery="5" clientId="esb-backbone"
durable="true" recoverJmsConnections="true" eagerConsumer="true"
createMultipleTransactedReceivers="true"
numberOfConcurrentTransactedReceivers="3">
<spring:property name="jmsSupport" ref="jndiJmsSupport" />
</jms:connector>

<spring:beans>
<spring:bean name="jndiJmsSupport"
class="org.mule.transport.jms.Jms102bSupport">
<spring:constructor-arg ref="jmsConnector" />
</spring:bean>

<spring:bean name="openMQ"
class="org.springframework.jndi.JndiObjectFactoryBean">
<spring:property name="jndiName"
value="MyTopicConnectionFactory" />
<spring:property name="jndiEnvironment">
<spring:props>
<spring:prop
key="java.naming.factory.initial">com.sun.jndi.fscontext.RefFSContextFactory</spring:prop>
<spring:prop
key="specifications">1.1</spring:prop>
<spring:prop
key="java.naming.provider.url">file:///C:/TEMP</spring:prop>
</spring:props>
</spring:property>
</spring:bean>
</spring:beans>

<endpoint name="JmsMessage" address="jms://topic:jmsMessage" />

<endpoint name="JmsMessage2" address="jms://topic:jmsMessage2" />

<model name="EventBridge">
<service name="muleUMO">
<inbound>
<inbound-endpoint ref="JmsMessage" />
</inbound>
<outbound>
<multicasting-router>
<outbound-endpoint ref="JmsMessage2" />
</multicasting-router>

</outbound>
</service>
</model>
</mule>


My publisher code:

MuleClient client = new MuleClient();
RemoteDispatcher remoteDispatcher =
client.getRemoteDispatcher("tcp://localhost:60504");

while(true)
{
client.sendAsync("jms://topic:jmsMessage", "Test Message",null);
Thread.sleep(3000);
}


My consumer code:
MuleClient client = new MuleClient();
RemoteDispatcher remoteDispatcher =
client.getRemoteDispatcher("tcp://localhost:60504");
MuleMessage muleMessage = null;

while(true)
{


//muleMessage = client.request("jms://topic:jmsMessage", 5000);
muleMessage = rd.receiveRemote("jms://topic:jmsMessage2", 5000);

if (muleMessage != null)
{
System.out.println("payload is " +
muleMessage.getPayloadAsString());

}
Thread.sleep(3000);
}


Erro Logs:
org.mule.api.transport.DispatchException: Failed to route event via
endpoint: DefaultOutboundEndpoint{endpointUri=tcp://localhost:60504,
connector=TcpConnector{this=1506dc4, started=true, initialised=true,
name='connector.tcp.0', disposed=false,
numberOfConcurrentTransactedReceivers=4,
createMultipleTransactedReceivers=true, connected=true,
supportedProtocols=[tcp], serviceOverrides=null}, transformer=[],
name='endpoint.tcp.localhost.60504', properties={},
transactionConfig=Transaction{factory=null, action=NEVER, timeout=0},
filter=null, deleteUnacceptedMessages=false, securityFilter=null,
synchronous=true, initialState=started, remoteSync=true,
remoteSyncTimeout=10000, endpointEncoding=UTF-8}. Message payload is of
type: byte[]
at
org.mule.module.client.RemoteDispatcher.dispatchAction(RemoteDispatcher.java:415)
at
org.mule.module.client.RemoteDispatcher.receiveRemote(RemoteDispatcher.java:276)
at
com.agilent.caaf.eventbus.Mule202Consumer.receiveMessage(Mule202Consumer.java:45)
at com.agilent.caaf.eventbus.Mule202Consumer.main(Mule202Consumer.java:24)
Caused by: org.mule.api.transformer.TransformerException: Failed to
transform from "byte[]" to "Object"
at
org.mule.transformer.simple.ByteArrayToSerializable.doTransform(ByteArrayToSerializable.java:53)
at
org.mule.transformer.AbstractTransformer.transform(AbstractTransformer.java:254)
at
org.mule.transformer.wire.TransformerPairWireFormat.read(TransformerPairWireFormat.java:52)
at
org.mule.module.client.RemoteDispatcher.dispatchAction(RemoteDispatcher.java:402)
... 3 more
Caused by: org.apache.commons.lang.SerializationException:
java.io.StreamCorruptedException: invalid stream header: 4661696C
at
org.apache.commons.lang.SerializationUtils.deserialize(SerializationUtils.java:167)
at
org.mule.transformer.simple.ByteArrayToSerializable.doTransform(ByteArrayToSerializable.java:48)
... 6 more
Caused by: java.io.StreamCorruptedException: invalid stream header: 4661696C
at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
at java.io.ObjectInputStream.<init>(Unknown Source)
at
org.apache.commons.lang.SerializationUtils.deserialize(SerializationUtils.java:161)
... 7 more

I am not able to send & receive any messages. Can any one help me please?


Thanks & regards,
Pawan Modi
--
View this message in context: http://www.nabble.com/Jms-Transport-Not-able-to-send---receive-messages-tp19602535p19602535.html
Sent from the Mule - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Antoine Borg

unread,
Sep 24, 2008, 4:41:14 AM9/24/08
to us...@mule.codehaus.org
Hello Pawan,

When you send the message to the JMS topic, you're dispatching "Test
Message" which needs to be placed on the topic. The default transformation
is from ObjectToJMSMessage but the error message points out that the item
received is a byte [] (byte array) that cannot be handled by this
transformer. Could a transformation be the key?

Why is your consumer code using the remoteDispatcher? This could be a very
simple Mule application that reads from jms://topic:jmsMessage2 and outputs
to console.

HTH

Antoine Borg, Senior Consultant | Tel: +32 28 504 696
ricston Ltd., BP 2, 1180 Uccle, Brussels, BELGIUM
email: antoin...@ricston.com | blog: blog.ricston.com | web: ricston.com

PawanModi

unread,
Sep 24, 2008, 4:53:06 AM9/24/08
to us...@mule.codehaus.org

Hello Antoine,

Many thanks for reply. I will give a try with appropriate transformer. Your
question to me.


"Why is your consumer code using the remoteDispatcher? This could be a very
simple Mule application that reads from jms://topic:jmsMessage2 and outputs
to console.
"

As i mentioned in my previous post that mule server is running separetly on
a console & clients are opting its services via remote dispatcher. My
question is if mule server is started separtely on console then can a mule
client gets its services without using remote dispatcher ? Do i need
following code ?

MuleClient client = new MuleClient();
RemoteDispatcher remoteDispatcher =
client.getRemoteDispatcher("tcp://localhost:60504");

Please suggest....

With regards,
Pawan Modi


antoine.borg wrote:
>
> Hello Pawan,
>
> When you send the message to the JMS topic, you're dispatching "Test
> Message" which needs to be placed on the topic. The default
> transformation
> is from ObjectToJMSMessage but the error message points out that the item
> received is a byte [] (byte array) that cannot be handled by this
> transformer. Could a transformation be the key?
>
> Why is your consumer code using the remoteDispatcher? This could be a very
> simple Mule application that reads from jms://topic:jmsMessage2 and
> outputs
> to console.
>
> HTH
>
>
>
> Antoine Borg, Senior Consultant | Tel: +32 28 504 696
> ricston Ltd., BP 2, 1180 Uccle, Brussels, BELGIUM
> email: antoin...@ricston.com | blog: blog.ricston.com | web:
> ricston.com
>
> -----Original Message-----
> From: PawanModi [mailto:modipa...@gmail.com]
> Sent: Monday, September 22, 2008 8:29 AM
> To: us...@mule.codehaus.org
> Subject: [mule-user] Jms Transport Not able to send / receive messages
>
>
>

> org.apache.commons.lang.SerializationUtils.deserialize(SerializationUtils.ja
> va:167)
> at
> org.mule.transformer.simple.ByteArrayToSerializable.doTransform(ByteArrayToS

--
View this message in context: http://www.nabble.com/Jms-Transport-Not-able-to-send---receive-messages-tp19602535p19644607.html

Antoine Borg

unread,
Sep 25, 2008, 3:44:19 AM9/25/08
to us...@mule.codehaus.org
Hi Pawan,

You're completely right - using the MuleClient does need the
remoteDispatcher call. My point was that you could wrap up all your code
into a POJO and have that as a service inside a Mule application ... This
would avoid your needing the MuleClient entirely.

HTH


Hello Antoine,

Please suggest....

With regards,
Pawan Modi

> ) Caused by: org.mule.api.transformer.TransformerException: Failed to

PawanModi

unread,
Sep 30, 2008, 3:13:06 AM9/30/08
to us...@mule.codehaus.org

Hi Antoine,

I don't know, still things are not clear to me. How to wrap my code in a
POJO & have it as a service inside Mule? If you explain it with an example
that would be a great help.

Thanks,
Pawan

antoine.borg wrote:
>
> Hi Pawan,
>
> You're completely right - using the MuleClient does need the
> remoteDispatcher call. My point was that you could wrap up all your code
> into a POJO and have that as a service inside a Mule application ... This
> would avoid your needing the MuleClient entirely.
>

> HTH
>
>
> Antoine Borg, Senior Consultant | Tel: +32 28 504 696
> ricston Ltd., BP 2, 1180 Uccle, Brussels, BELGIUM
> email: antoin...@ricston.com | blog: blog.ricston.com | web:
> ricston.com
>
> -----Original Message-----
> From: PawanModi [mailto:modipa...@gmail.com]

> Sent: Wednesday, September 24, 2008 10:53 AM
> To: us...@mule.codehaus.org

>> com.agilent.caaf.eventbus.Mule202Consumer.receiveMessage(Mule202Consum
>> er.jav
>> a:45)
>> at
>> com.agilent.caaf.eventbus.Mule202Consumer.main(Mule202Consumer.java:24

>> ) Caused by: org.mule.api.transformer.TransformerException: Failed to

>> transform from "byte[]" to "Object"
>> at
>> org.mule.transformer.simple.ByteArrayToSerializable.doTransform(ByteAr
>> rayToS
>> erializable.java:53)
>> at
>>
> org.mule.transformer.AbstractTransformer.transform(AbstractTransformer.java:
>> 254)
>> at

>> org.mule.transformer.wire.TransformerPairWireFormat.read(TransformerPa
>> irWire
>> Format.java:52)
>> at
>> org.mule.module.client.RemoteDispatcher.dispatchAction(RemoteDispatche
>> r.java

>> :402)
>> ... 3 more
>> Caused by: org.apache.commons.lang.SerializationException:
>> java.io.StreamCorruptedException: invalid stream header: 4661696C
>> at

>> org.apache.commons.lang.SerializationUtils.deserialize(SerializationUt
>> ils.ja
>> va:167)
>> at
>> org.mule.transformer.simple.ByteArrayToSerializable.doTransform(ByteAr
>> rayToS

--
View this message in context: http://www.nabble.com/Jms-Transport-Not-able-to-send---receive-messages-tp19602535p19737237.html

Antoine Borg

unread,
Oct 1, 2008, 2:59:40 AM10/1/08
to us...@mule.codehaus.org
Hi Pawan,

(writing this in e-mail not a code editor so check for typos)

<service name="myService">
<inbound>
<stdio:inbound-endpoint system="IN"/>
</inbound>
<component class="com.pawan.generateMessage"/>
<outbound>
<pass-through-router>
<jms:outbound-endpoint queue="firstQueue"/>
</pass-through-router>
</service>

Inside the component, place all the code necessary to generate the
appropriate message. As soon as something is typed out on the console, the
message will be generated and sent to the JMS queue called firstQueue. This
way, you don't need the MuleClient, just a Mule application that sends
messages to the right queue.

A

PawanModi

unread,
Oct 1, 2008, 5:04:39 AM10/1/08
to us...@mule.codehaus.org

Hello Antoine

Many thanks for your reply. Now it is clear to me what you wanted to convey.
But i can't make my component as mule service. They are the part of my own
framework.

My usecase is some thing like, Component A send some message to B (dont
worry about trasnport between A & B). Now B will publish this message on Jms
topic (mule + sun message queue). Component C has subscribed for this topic
& receives it. I want, communication between component B & C is only via JMS
transport using mule.

A ------> B -------->JmsEventBus -------> C

Please guide the appropriate way to achieve this using mule.

Thanks & regards,
Pawan


antoine.borg wrote:
>
> Hi Pawan,
>

> (writing this in e-mail not a code editor so check for typos)
>
> <service name="myService">
> <inbound>
> <stdio:inbound-endpoint system="IN"/>
> </inbound>
> <component class="com.pawan.generateMessage"/>
> <outbound>
> <pass-through-router>
> <jms:outbound-endpoint queue="firstQueue"/>
> </pass-through-router>
> </service>
>
> Inside the component, place all the code necessary to generate the
> appropriate message. As soon as something is typed out on the console, the
> message will be generated and sent to the JMS queue called firstQueue.
> This
> way, you don't need the MuleClient, just a Mule application that sends
> messages to the right queue.
>
> A
>

>>> org.mule.transformer.wire.TransformerPairWireFormat.read(TransformerP
>>> a
>>> irWire
>>> Format.java:52)
>>> at
>>> org.mule.module.client.RemoteDispatcher.dispatchAction(RemoteDispatch
>>> e

>>> r.java
>>> :402)
>>> ... 3 more
>>> Caused by: org.apache.commons.lang.SerializationException:
>>> java.io.StreamCorruptedException: invalid stream header: 4661696C
>>> at

>>> org.apache.commons.lang.SerializationUtils.deserialize(SerializationU
>>> t
>>> ils.ja
>>> va:167)
>>> at
>>> org.mule.transformer.simple.ByteArrayToSerializable.doTransform(ByteA
>>> r

--
View this message in context: http://www.nabble.com/Jms-Transport-Not-able-to-send---receive-messages-tp19602535p19756827.html

Antoine Borg

unread,
Oct 2, 2008, 6:01:56 AM10/2/08
to us...@mule.codehaus.org
Hello Pawan,

> I want, communication between component B & C is only via JMS transport
using mule.

If B and C are both Mule services:

B just needs an outbound endpoint which is a JMS topic. It writes
information to the topic.
C just needs an inbound endpoint which is a JMS topic. It reads information
from the topic.

If B is not a Mule service, B will need to use the MuleClient to write to a
JMS topic.
If C is not a Mule service, C will need to use the MuleClient to read from a
JMS topic.

In both these two cases, the MuleClient would connect to a remote Mule
server (remoteDispatcher as you mentioned previously). At minimum, this Mule
server needs to have the JMS connector properly configured.

Not sure if I've answered your question though ...

A


Hello Antoine

Thanks & regards,
Pawan

>>> - To unsubscribe from this list, please visit:
>>>
>>> http://xircles.codehaus.org/manage_email
>>>
>>>
>>>
>>> --------------------------------------------------------------------
>>> - To unsubscribe from this list, please visit:

PawanModi

unread,
Oct 2, 2008, 7:56:17 AM10/2/08
to us...@mule.codehaus.org

Hello Antoine,

Many thanks for the clarifications from your side. As i mentioned in
previous post, i can't make B & C as mule service then as per your guideline
i have to use mule client in both component B & C with remote dispatcher.
Now it is sure that i have to use mule client with remote dispatcher in my
component B & C.

Now my component B should be a publisher & will publish data using following
code.

remoteDispatcher.dispatchRemote("jms://topic:mytopic1", "My message ",
null);

My component C should be a consumer & will receive messages using following
code.
muleMessage = remoteDispatcher.receiveRemote("jms://topic:mytopic1, 3000");
System.out.println(muleMessage.getPayloadAsString());

Services need to be configure in mule config file for publisher with just
jms outbound endpoint & for consumer with just jms inbound endpoints.

I hope above setup should work for me. I will give a try & let you know my
results.
If you find any mistake in the setup described above then please do correct
me.

Thanks & regards,
Pawan


antoine.borg wrote:
>
> Hello Pawan,


>
>> I want, communication between component B & C is only via JMS transport
> using mule.
>

> If B and C are both Mule services:
>
> B just needs an outbound endpoint which is a JMS topic. It writes
> information to the topic.
> C just needs an inbound endpoint which is a JMS topic. It reads
> information
> from the topic.
>
> If B is not a Mule service, B will need to use the MuleClient to write to
> a
> JMS topic.
> If C is not a Mule service, C will need to use the MuleClient to read from
> a
> JMS topic.
>
> In both these two cases, the MuleClient would connect to a remote Mule
> server (remoteDispatcher as you mentioned previously). At minimum, this
> Mule
> server needs to have the JMS connector properly configured.
>
> Not sure if I've answered your question though ...
>

>>>> - To unsubscribe from this list, please visit:
>>>>
>>>> http://xircles.codehaus.org/manage_email
>>>>
>>>>
>>>>
>>>> --------------------------------------------------------------------
>>>> - To unsubscribe from this list, please visit:

--
View this message in context: http://www.nabble.com/Jms-Transport-Not-able-to-send---receive-messages-tp19602535p19777807.html

PawanModi

unread,
Oct 16, 2008, 12:45:36 AM10/16/08
to us...@mule.codehaus.org

Hello Antoine,

I performed the tests we discussed in previous posts (please have a look
this thread).

My Publisher:
--------------------------------------------------

MuleClient client = new MuleClient();

RemoteDispatcher dispatcher =
client.getRemoteDispatcher("tcp://localhost:60504?synchronous=true");
try
{
while (true)
{
dispatcher.dispatchRemote("jms://topic:jmsMessage", "My Dummy
Message", null);
Thread.sleep(3000);
}
}catch (DispatchException e)
-------------------------------------------------

My Consumer:


MuleClient client = new MuleClient();

RemoteDispatcher dispatcher =
client.getRemoteDispatcher("tcp://localhost:60504?synchronous=true");

MuleMessage muleMessage = null;

while (true)
{
try
{
muleMessage =
dispatcher.receiveRemote("jms://topic:jmsMessage", 3000);

if (muleMessage != null)
{
System.out.println("Payload is " +
muleMessage.getPayload());
}
}
catch (Exception e)
{

}
}
-------------------------------------------

I am getting following error at consumer side.

2008-10-16 10:09:58 GMT+05:30 [muleconsumer ] INFO Mule consumer is now
ready to receive events

org.mule.api.transport.DispatchException: Failed to route event via
endpoint:

DefaultOutboundEndpoint{endpointUri=tcp://localhost:60504?synchronous=true,
connector=TcpConnector{this=d81784, started=true, initialised=true,


name='connector.tcp.0', disposed=false,
numberOfConcurrentTransactedReceivers=4,
createMultipleTransactedReceivers=true, connected=true,
supportedProtocols=[tcp], serviceOverrides=null}, transformer=[],

name='endpoint.tcp.localhost.60504', properties={synchronous=true},


transactionConfig=Transaction{factory=null, action=NEVER, timeout=0},
filter=null, deleteUnacceptedMessages=false, securityFilter=null,
synchronous=true, initialState=started, remoteSync=true,
remoteSyncTimeout=10000, endpointEncoding=UTF-8}. Message payload is of
type: byte[]
at

org.mule.module.client.RemoteDispatcher.dispatchAction(RemoteDispatcher.java:415)
at
org.mule.module.client.RemoteDispatcher.receiveRemote(RemoteDispatcher.java:276)
at MuleConsumer211Direct.run(MuleConsumer211Direct.java:73)
at MuleConsumer211Direct.main(MuleConsumer211Direct.java:35)


Caused by: org.mule.api.transformer.TransformerException: Failed to
transform from "byte[]" to "Object"
at

org.mule.transformer.simple.ByteArrayToSerializable.doTransform(ByteArrayToSerializable.java:53)


at
org.mule.transformer.AbstractTransformer.transform(AbstractTransformer.java:254)
at
org.mule.transformer.wire.TransformerPairWireFormat.read(TransformerPairWireFormat.java:52)
at

org.mule.module.client.RemoteDispatcher.dispatchAction(RemoteDispatcher.java:402)


... 3 more
Caused by: org.apache.commons.lang.SerializationException:

java.io.StreamCorruptedException: invalid stream header: 6A617661
at
org.apache.commons.lang.SerializationUtils.deserialize(SerializationUtils.java:167)
at
org.mule.transformer.simple.ByteArrayToSerializable.doTransform(ByteArrayToSerializable.java:48)
... 6 more
Caused by: java.io.StreamCorruptedException: invalid stream header: 6A617661
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:783)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280)


at
org.apache.commons.lang.SerializationUtils.deserialize(SerializationUtils.java:161)
... 7 more

2008-10-16 10:10:00 GMT+05:30 [muleconsumer ] WARN Exception occured

I am gettting following error at mule server side.

2008-10-16 10:10:03 GMT+05:30 [connector.tcp.0.receiver.9] ERROR Failed to
process admin request: java.io.NotSerializableException:
com.sun.messaging.jmq.jmsclient.TextMessageImpl
org.apache.commons.lang.SerializationException:
java.io.NotSerializableException:
com.sun.messaging.jmq.jmsclient.TextMessageImpl
at
org.apache.commons.lang.SerializationUtils.serialize(SerializationUtils.java:111)
at
org.apache.commons.lang.SerializationUtils.serialize(SerializationUtils.java:133)
at
org.mule.transformer.simple.MuleMessageToByteArray.transform(MuleMessageToByteArray.java:29)
at
org.mule.transformer.AbstractMessageAwareTransformer.doTransform(AbstractMessageAwareTransformer.java:68)
at
org.mule.transformer.AbstractTransformer.transform(AbstractTransformer.java:254)
at
org.mule.transformer.wire.TransformerPairWireFormat.write(TransformerPairWireFormat.java:100)
at
org.mule.module.client.remoting.RemoteDispatcherComponent.receiveAction(RemoteDispatcherComponent.java:242)
at
org.mule.module.client.remoting.RemoteDispatcherComponent.onCall(RemoteDispatcherComponent.java:114)
at
org.mule.component.SimpleCallableJavaComponent.invokeComponentInstance(SimpleCallableJavaComponent.java:165)
at
org.mule.component.AbstractJavaComponent.doOnCall(AbstractJavaComponent.java:75)
at
org.mule.component.AbstractComponent.onCall(AbstractComponent.java:96)
at org.mule.model.seda.SedaService.doSend(SedaService.java:237)
at
org.mule.service.AbstractService.sendEvent(AbstractService.java:510)
at
org.mule.DefaultMuleSession.sendEvent(DefaultMuleSession.java:354)
at
org.mule.routing.inbound.DefaultInboundRouterCollection.send(DefaultInboundRouterCollection.java:221)
at
org.mule.routing.inbound.DefaultInboundRouterCollection.route(DefaultInboundRouterCollection.java:181)
at
org.mule.transport.AbstractMessageReceiver$DefaultInternalMessageListener.onMessage(AbstractMessageReceiver.java:603)
at
org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:346)
at
org.mule.transport.AbstractReceiverWorker$1.doInTransaction(AbstractReceiverWorker.java:114)
at
org.mule.transaction.TransactionTemplate.execute(TransactionTemplate.java:99)
at
org.mule.transport.AbstractReceiverWorker.doRun(AbstractReceiverWorker.java:131)
at
org.mule.transport.AbstractReceiverResourceWorker.doRun(AbstractReceiverResourceWorker.java:51)
at
org.mule.transport.AbstractReceiverWorker.run(AbstractReceiverWorker.java:62)
at org.mule.work.WorkerContext.run(WorkerContext.java:310)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.NotSerializableException:
com.sun.messaging.jmq.jmsclient.TextMessageImpl
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.writeObject(Unknown Source)
at
org.apache.commons.lang.SerializationUtils.serialize(SerializationUtils.java:108)
... 26 more

I have attached my mule-config file here
http://www.nabble.com/file/p20007018/mule-config.xml mule-config.xml

Can you please guide what's wrong with my setup & how to resolve these
errors?

Thanks & regards,
Pawan Modi

--
View this message in context: http://www.nabble.com/Jms-Transport-Not-able-to-send---receive-messages-tp19602535p20007018.html

Ross Mason

unread,
Oct 16, 2008, 3:11:59 AM10/16/08
to us...@mule.codehaus.org
Guys,

Please read the updated MuleClient documentation that will explain
when to use the remote dispatcher. Essentially, if you don't need to
run all your interactions through a firewall, you don't need the
remote dispatcher.

Cheers,

Ross Mason
CTO, Founder
MuleSource Inc.

http://mulesource.com | http://blog.rossmason.com

>> org
>> .mule
>> .module.client.RemoteDispatcher.dispatchAction(RemoteDispatcher.java
>> :415)
>> at
>> org
>> .mule
>> .module.client.RemoteDispatcher.receiveRemote(RemoteDispatcher.java:
>> 276)
>> at
>> com
>> .agilent

>> .caaf.eventbus.Mule202Consumer.receiveMessage(Mule202Consumer.jav
>> a:45)
>> at
>> com.agilent.caaf.eventbus.Mule202Consumer.main(Mule202Consumer.java:
>> 24)
>> Caused by: org.mule.api.transformer.TransformerException: Failed to
>> transform from "byte[]" to "Object"
>> at

>> org
>> .mule
>> .transformer.simple.ByteArrayToSerializable.doTransform(ByteArrayToS
>> erializable.java:53)
>> at
>> org
>> .mule
>> .transformer.AbstractTransformer.transform(AbstractTransformer.java:
>> 254)
>> at
>> org
>> .mule
>> .transformer.wire.TransformerPairWireFormat.read(TransformerPairWire
>> Format.java:52)
>> at
>> org
>> .mule
>> .module.client.RemoteDispatcher.dispatchAction(RemoteDispatcher.java

>> :402)
>> ... 3 more
>> Caused by: org.apache.commons.lang.SerializationException:
>> java.io.StreamCorruptedException: invalid stream header: 4661696C
>> at

>> org
>> .apache
>> .commons.lang.SerializationUtils.deserialize(SerializationUtils.ja
>> va:167)
>> at
>> org
>> .mule
>> .transformer.simple.ByteArrayToSerializable.doTransform(ByteArrayToS

PawanModi

unread,
Oct 16, 2008, 7:11:50 AM10/16/08
to us...@mule.codehaus.org

Hi Ross,

I gone through the document several time.
http://www.mulesource.org/display/MULE2USER/Using+the+Mule+Client

But documents are not conveying what you want to say. In my setup i dont
have interaction across the firewall but with in the same system.
I am using Mule2.0.3. I am having mule publisher & mule consumer. Mule
server is running on port 60504. I am using JMS transport to send / receive
my messages.
Now can you tell me how these two mule client gets the services of mule
server? You can see my code & config file here.
http://www.nabble.com/Jms-Transport-Not-able-to-send---receive-messages-tt19602535.html

It would be great if you explain with an example.

Thanks & regards,
Pawan Modi

--
View this message in context: http://www.nabble.com/Jms-Transport-Not-able-to-send---receive-messages-tp19602535p20011533.html

Antoine Borg

unread,
Oct 16, 2008, 7:46:18 PM10/16/08
to us...@mule.codehaus.org
Hold on - if you're using Mule client on both sides (both on the consumer
and the producer), then where is the Mule server? Surely one of these two
should be the Mule server?

Why don't you try upgrading to 2.1 though .. ?

A


Hi Ross,

602535p20011533.html

PawanModi

unread,
Oct 17, 2008, 3:31:12 AM10/17/08
to us...@mule.codehaus.org

Hello Antonie,

Yes, both publisher & consumer are mule client. Mule server will run
seperately but on same machine.
These two mule clients were getting services using RemoteDispatcher.

As Ross said, the usage of RemoteDispatcher is for across the firewall
communication. Though my mule server & two mule clients are running on same
machine then there is no need for RemoteDispatcher. Now my query is, how
these mule clients get the services of mule server without using
RemoteDispatcher.

Can you please explain?

Cheers,
Pawan Modi

antoine.borg wrote:
>
> Hold on - if you're using Mule client on both sides (both on the consumer
> and the producer), then where is the Mule server? Surely one of these two
> should be the Mule server?
>
> Why don't you try upgrading to 2.1 though .. ?
>
> A
>
>

> Antoine Borg, Senior Consultant | Tel: +32 28 504 696
> ricston Ltd., BP 2, 1180 Uccle, Brussels, BELGIUM
> email: antoin...@ricston.com | blog: blog.ricston.com | web:
> ricston.com
>
> -----Original Message-----
> From: PawanModi [mailto:modipa...@gmail.com]

> Sent: Thursday, October 16, 2008 4:12 AM
> To: us...@mule.codehaus.org

> 602535p20011533.html


> Sent from the Mule - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
>
>

--
View this message in context: http://www.nabble.com/Jms-Transport-Not-able-to-send---receive-messages-tp19602535p20027809.html

PawanModi

unread,
Nov 3, 2008, 4:27:42 AM11/3/08
to us...@mule.codehaus.org

Hello,

Can any one help me out here. I have two mule clients & a mule server
running in same machine. Mule server is running on console independent of
mule clients.
My mule-config.xml is loaded by mule server & services are available for the
mule clients.

How can i get the services of mule server?

I dont want to use remote dispatcher & i dont want to load seperate config
file in mule clients.

I want my mule clients to communicate to mule server & finally mule server
will contact to jms broker i.e. activemq

Kindly suggest.


Thanks in advance.

Pawan Modi

--
View this message in context: http://www.nabble.com/Jms-Transport-Not-able-to-send---receive-messages-tp19602535p20299571.html

NiHeitz

unread,
Nov 3, 2008, 8:07:50 AM11/3/08
to us...@mule.codehaus.org

Hello,

Not quite sure why I chose to read this one, but it sounded interesting and
I thought I'd give it a try. I'm using Mule 2.1.1, so I can't swear that
the issues overlap, but I was able to recreate your error. Then I added the
following:

<client:remote-dispatcher-agent>
<client:remote-endpoint address="tcp://localhost:60504"

synchronous="true" transformer-refs="JmsToObject"
responseTransformer-refs="JmsToObject"/>
<client:xml-wire-format></client:xml-wire-format>
</client:remote-dispatcher-agent>

Notice the wire format! Suddenly, String-based message payloads were
successfully sent and received from a remote message dispatch.

I recommend you upgrade to at least Mule 2.1, as 2.0.3 has other problems.

Maybe this will help?

--
View this message in context: http://www.nabble.com/Jms-Transport-Not-able-to-send---receive-messages-tp19602535p20302446.html

NiHeitz

unread,
Nov 3, 2008, 8:15:58 AM11/3/08
to us...@mule.codehaus.org

Sorry, one other thing...

<client:remote-dispatcher-agent>
<client:remote-endpoint address="tcp://localhost:60504"
synchronous="true"/>
<client:xml-wire-format></client:xml-wire-format>
</client:remote-dispatcher-agent>

my last post was misleading. It doesn't seem like you need the
transformers...


However, I've noticed one other major problem. I used the following java
code to test:
...


RemoteDispatcher dispatcher =
client.getRemoteDispatcher("tcp://localhost:60504?synchronous=true");

dispatcher.dispatchRemote("jms://jmsTest1?connector=jmsConnector",
"Sample", null);

MuleMessage mm =
dispatcher.receiveRemote("jms://jmsTest1?connector=jmsConnector", 10000);
System.out.println(mm.getPayloadAsString());
...

I get the text "Sample" successfully, but the message is *not* dequeued (or
maybe not committed) from jms! Therefore, I can keep dequeueing the same
message repeatedly. This might be a major showstopper, and I suggest you
consider using client config files and skipping the remoteDispatch approach
if you encounter the same problem.

Nick

--
View this message in context: http://www.nabble.com/Jms-Transport-Not-able-to-send---receive-messages-tp19602535p20302558.html

PawanModi

unread,
Nov 3, 2008, 11:23:24 PM11/3/08
to us...@mule.codehaus.org


Hello Niheitz,

Thanks for posting your reply. One of the reason to use Mule2.0.3 is
Reconnection strategy. I guess reconnection is still not working with
Mule2.1.1. Reconnection means, all mule clients are up & exchanging messages
to jms broker. Suddenly jms broker goes down. Later jms broker restarts. Now
these clients should be able to make connection to jms broker to exchange
messages.

I haven't seen this functionality working with any other mule release so
far. If i am wrong then let me know.

Infact this functionality was also not working with Mule2.0.3. I have
modified the code of jms transport i.e. JmsConnector.java & made it working.
I have submitted my patch for the community.
http://mule.mulesource.org/jira/browse/MULE-3659

So in existing setup all mule clients communicate to mule server using
remote dispatcher & mule server communicate to Jms broker. If jms broker
goes down & come up then mule server successfully establish the connection
to the broker & client continue exchanging messages.


But if i go for seperate config file for individual client & dont use remote
dispatcher then all these client directly communicate to jms broker as they
all have their own jms connector. Now if jms broker goes down then all
clients keep pinging for the jms broker. All clients simultaneously try to
establish connection to jms broker as an when broker comes up. Here it
create problem. Only one mule client is able to establish connection & rest
of the clients throws error say client id already in use. Because in the
code of jms connector, client id increments with each new connection to
broker. Now all clients have their own code (jar) & all increment their
clientid & tries to register at jms broker & cause the problem.

So i want that single entity (mule server) only make connection to jms
broker & rest will only communicate to this entity (mule sever). If jms
broker goes down then it is only the responsibility of one entity (mule
sever) to make connection to broker.

Therefore i was looking for a setup where all client communicate to mule
server without using remote dispatcher & mule server will communicate to jms
broker. Idlly i dont need remote dispatcher because all my clients & mule
server are running on same machine & remote dispatcher is to get services of
mule server accross the firewall. That's way i want to avoid using remote
dispatcher with above setup.

Kindly help if you have any opinion on that.


Thanks & regards,
Pawan Modi

--
View this message in context: http://www.nabble.com/Jms-Transport-Not-able-to-send---receive-messages-tp19602535p20316057.html

NiHeitz

unread,
Nov 4, 2008, 11:46:18 AM11/4/08
to us...@mule.codehaus.org

Ok, let me see if I can add anything of value here...

In Mule 2.0.3, I managed to get the reconnection strategy working (but I
think there were differences between ActiveMQ and other brokers.) In Mule
2.1.x, however, they completely changed the reconnection framework, and made
part of it proprietary. Ultimately this works as well, but you have to
write your own retryPolicy:

package you.yourname;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.mule.api.retry.RetryPolicy;
import org.mule.retry.PolicyStatus;
import org.mule.retry.policies.AbstractPolicyTemplate;

import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger;

public class SimpleRetryPolicyFactory extends AbstractPolicyTemplate
{
protected transient final Log logger =
LogFactory.getLog(SimpleRetryPolicyFactory.class);

public static final int DEFAULT_FREQUENCY = 2000;
public static final int DEFAULT_RETRY_COUNT = 2;
public static final int RETRY_COUNT_FOREVER = -1;

protected volatile int count = DEFAULT_RETRY_COUNT;
protected volatile long frequency = DEFAULT_FREQUENCY;

public SimpleRetryPolicyFactory()
{
super();
}

public SimpleRetryPolicyFactory(long frequency, int retryCount)
{
this.frequency = frequency;
this.count = retryCount;
}

public long getFrequency()
{
return frequency;
}

public int getCount()
{
return count;
}

public void setFrequency(long frequency)
{
this.frequency = frequency;
}

public void setCount(int count)
{
this.count = count;
}

public RetryPolicy createRetryInstance()
{
return new SimpleRetryPolicy(frequency, count);
}

protected static class SimpleRetryPolicy implements RetryPolicy
{
protected transient final Log logger =
LogFactory.getLog(SimpleRetryPolicy.class);

protected static final RetryCounter retryCounter = new
RetryCounter();

private volatile int count = DEFAULT_RETRY_COUNT;
private volatile long frequency = DEFAULT_FREQUENCY;

public SimpleRetryPolicy(long frequency, int retryCount)
{
this.frequency = frequency;
this.count = retryCount;
}

public PolicyStatus applyPolicy(Throwable cause)
{

if (count != RETRY_COUNT_FOREVER && retryCounter.current().get()
>= count)
{
return PolicyStatus.policyExhausted(cause);
}
else
{

if (logger.isInfoEnabled())
{
logger.info("Waiting for "
+ frequency
+ "ms before reconnecting. Failed attempt "
+ retryCounter.current().get()
+ " of "
+ (count != RETRY_COUNT_FOREVER
? String.valueOf(count)
: "unlimited"));
}

try
{
retryCounter.current().getAndIncrement();
Thread.sleep(frequency);
return PolicyStatus.policyOk();
}
catch (InterruptedException e)
{
// If we get an interrupt exception, some one is telling
us to stop
return PolicyStatus.policyExhausted(e);
}
}
}

protected static class RetryCounter extends ThreadLocal
{
public int countRetry()
{
return ((AtomicInteger) get()).incrementAndGet();
}

public void reset()
{
((AtomicInteger) get()).set(0);
}

public AtomicInteger current()
{
return (AtomicInteger) get();
}

// @Override
protected Object initialValue()
{
return new AtomicInteger(0);
}
}
}

}

and an extension:
package you.yourname;

import org.mule.api.retry.RetryPolicy;

public class RetryForeverPolicyFactory extends SimpleRetryPolicyFactory {
public RetryForeverPolicyFactory()
{
super();
}

public RetryForeverPolicyFactory(long frequency)
{
this.frequency = frequency;
}

public RetryPolicy createRetryInstance()
{
return new SimpleRetryPolicy(frequency, RETRY_COUNT_FOREVER);
}


}

and configure it:
<spring:bean id="retryPolicyFactory"
class="you.yourname.RetryForeverPolicyFactory">
<spring:property name="frequency"
value="30000" />
</spring:bean>

<jms:activemq-connector name="enterpriseJmsConnector"
brokerURL="..." maxRedelivery="5"
specification="1.1" persistentDelivery="true" clientId="esb-backbone"
durable="true" eagerConsumer="true" cacheJmsSessions="true"
numberOfConcurrentTransactedReceivers="1">
<spring:property name="retryPolicyTemplate" ref="retryPolicyFactory" />
</jms:activemq-connector>

I've found the reconnect to work pretty well.
whew! Now, what confuses me about your description is the issue over
client-id. As far as I've experienced, the only time client id comes into
play is when you are setting up durable subscribers to topics...is this
client id part of your customisation of jms connector? Only listeners
register themselves as subscribers in ActiveMQ world, thus only listeners
need to ping the JMS queue at intervals for it being "up".

Everything you've said suggests to me that you probably want a different
protocol to bridge between your clients and your server...have you
considered webservices? This would need more config, but is not that
difficult if you've got a mule client. I'm a big fan of queues, but you
might want something a little more synchronous.

Forget Mule 2.0.3. It is a dead end, and you'll have to change your configs
to move to Mule 2.1.1 anyway.

--
View this message in context: http://www.nabble.com/Jms-Transport-Not-able-to-send---receive-messages-tp19602535p20326102.html

Reply all
Reply to author
Forward
0 new messages