[mule-user] JMS client fails to connect to Mule using ActiveMQ

42 views
Skip to first unread message

torarnek

unread,
Oct 10, 2007, 6:53:32 AM10/10/07
to us...@mule.codehaus.org

Hello!

I have a simple inbound jms endpoint that I try to send a message to. When I
use the Mule client it goes good, but when I use my own JMS client it get
horrible error messages. Is this a bug, or am i doing something wrong?

I use activemq-core-4.1.0-incubator.jar and
activeio-core-3.0.0-incubator.jar on both sides.

On the client side I get:
log4j:WARN No appenders could be found for logger
(org.apache.activemq.transport.WireFormatNegotiator).
log4j:WARN Please initialize the log4j system properly.
Caught: javax.jms.JMSException: Wire format negociation timeout: peer did
not send his wire format.
javax.jms.JMSException: Wire format negociation timeout: peer did not send
his wire format.
at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:58)
at
org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1181)
at
org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(ActiveMQConnection.java:1259)
at
org.apache.activemq.ActiveMQConnection.createSession(ActiveMQConnection.java:274)
at ActiveMQtest.main(ActiveMQtest.java:24)
Caused by: java.io.IOException: Wire format negociation timeout: peer did
not send his wire format.
at
org.apache.activemq.transport.WireFormatNegotiator.oneway(WireFormatNegotiator.java:88)
at
org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:43)
at
org.apache.activemq.transport.ResponseCorrelator.asyncRequest(ResponseCorrelator.java:69)
at
org.apache.activemq.transport.ResponseCorrelator.request(ResponseCorrelator.java:74)
at
org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1171)
... 3 more

and the error message on the mule-side is:

**********************************************************************
* Mule ESB and Integration Platform version 1.4.3 *
* MuleSource, Inc. *
* For more information go to http://mule.mulesource.org *
* *
* Server started: 10.10.07 12:46 *
* Server ID: test *
* JDK: 1.5.0_10 (mixed mode) *
* OS: Windows Vista - (6.0, x86) *
* Host: tar9torkva (10.47.9.115) *
* *
* Agents Running: *
* Mule Admin: accepting connections on tcp://localhost:60504 *
**********************************************************************
INFO 2007-10-10 12:46:27,122 [main] org.mule.MuleServer: Mule Server
initialized.
ERROR 2007-10-10 12:46:31,953 [_muleManagerComponent.2]
org.mule.impl.DefaultComponentExceptionStrategy:
********************************************************************************
Message : Failed to transform from "byte[]" to "Object"
Type : org.mule.umo.transformer.TransformerException
Code : MULE_ERROR-65110
Transformer : ByteArrayToSerializable{this=15d252d,
name='ByteArrayToSerializable', ignoreBadInput=false, returnClass=null,
sourceTypes=[class [B, class java.io.InputStream]}
JavaDoc :
http://mule.mulesource.org/docs/apidocs/org/mule/umo/transformer/TransformerException.html
********************************************************************************
Exception stack is:
1. invalid stream header (java.io.StreamCorruptedException)
java.io.ObjectInputStream:-1
(http://java.sun.com/j2se/1.5.0/docs/api/java/io/StreamCorruptedException.html)
2. java.io.StreamCorruptedException: invalid stream header
(org.apache.commons.lang.SerializationException)
org.apache.commons.lang.SerializationUtils:167 (null)
3. Failed to transform from "byte[]" to "Object"
(org.mule.umo.transformer.TransformerException)
org.mule.transformers.simple.ByteArrayToSerializable:50
(http://mule.mulesource.org/docs/apidocs/org/mule/umo/transformer/TransformerException.html)
********************************************************************************
Root Exception stack trace:
java.io.StreamCorruptedException: invalid stream header
at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
at java.io.ObjectInputStream.<init>(Unknown Source)
at
org.apache.commons.lang.SerializationUtils.deserialize(SerializationUtils.java:161)
at
org.mule.transformers.simple.ByteArrayToSerializable.doTransform(ByteArrayToSerializable.java:44)
at
org.mule.transformers.AbstractTransformer.transform(AbstractTransformer.java:250)
at
org.mule.transformers.wire.TransformerPairWireFormat.read(TransformerPairWireFormat.java:51)
at
org.mule.impl.internal.admin.MuleManagerComponent.onCall(MuleManagerComponent.java:88)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.mule.impl.model.resolvers.DynamicEntryPoint.invokeMethod(DynamicEntryPoint.java:312)
at
org.mule.impl.model.resolvers.DynamicEntryPoint.invoke(DynamicEntryPoint.java:259)
at
org.mule.impl.DefaultLifecycleAdapter.intercept(DefaultLifecycleAdapter.java:194)
at org.mule.impl.InterceptorsInvoker.execute(InterceptorsInvoker.java:47)
at org.mule.impl.model.DefaultMuleProxy.run(DefaultMuleProxy.java:467)
at org.mule.impl.work.WorkerContext.run(WorkerContext.java:310)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:987)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:528)
at java.lang.Thread.run(Unknown Source)


Mule config file:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE mule-configuration PUBLIC "-//MuleSource //DTD mule-configuration
XML V1.0//EN"

"http://mule.mulesource.org/dtds/mule-configuration.dtd">

<mule-configuration id="test" version="1.0">

<connector name="jmsConnector"
className="org.mule.providers.jms.JmsConnector">
<properties>
<property name="specification" value="1.1" />
<property name="connectionFactoryJndiName" value="ConnectionFactory" />
<property name="jndiInitialFactory"
value="org.apache.activemq.jndi.ActiveMQInitialContextFactory" />
<map name="connectionFactoryProperties">
<property name="brokerURL"
value="vm://localhost?broker.persistent=false&amp;broker.useJmx=false" />
<property name="brokerXmlConfig"
value="classpath:conf/activemq-config.xml" />
</map>
</properties>
</connector>


<transformers>
<transformer name="JMSMessageToObject"
className="org.mule.providers.jms.transformers.JMSMessageToObject" />
</transformers>


<model name="jmsTest">
<mule-descriptor name="TestUMO"
implementation="org.mule.components.simple.EchoComponent">
<inbound-router>
<endpoint address="jms://test.in" connector="jmsConnector"
transformers="JMSMessageToObject" />
</inbound-router>

<outbound-router>
<router className="org.mule.routing.outbound.OutboundPassThroughRouter">
<endpoint address="stream://System.out" />
</router>
</outbound-router>
</mule-descriptor>
</model>
</mule-configuration>

And my JMS client file:
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.TextMessage;

import org.apache.activemq.ActiveMQConnectionFactory;


public class ActiveMQtest {

public static void main(String[] args) {

String url =
"tcp://localhost:60504";//ActiveMQConnection.DEFAULT_BROKER_URL;

Connection connection=null;
try {


ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(url);
connection = connectionFactory.createConnection();
//connection.start();
Session session = connection.createSession(false,
Session.CLIENT_ACKNOWLEDGE);

Queue destination = session.createQueue("test.in");

MessageProducer producer = session.createProducer(destination);

String s = "hallo";

TextMessage message = session.createTextMessage(s);
producer.send(message);

System.out.println("Done.");


} catch (Exception e) {
System.out.println("Caught: " + e);
e.printStackTrace();
} finally {
try {
connection.close();
} catch (Throwable ignore) {
}
}
}

}

Thank you very much for your help.

Greetings,
Tor Arne

--
View this message in context: http://www.nabble.com/JMS-client-fails-to-connect-to-Mule-using-ActiveMQ-tf4600036.html#a13133447
Sent from the Mule - User mailing list archive at Nabble.com.


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

http://xircles.codehaus.org/manage_email

Andrew Perepelytsya

unread,
Oct 10, 2007, 8:20:51 AM10/10/07
to us...@mule.codehaus.org
"tcp://localhost:60504";/
/ActiveMQConnection.DEFAULT_BROKER_URL;

The above is a Mule's admin agent port. AMQ's default broker is at tcp://localhost:61616

Andrew

torarnek

unread,
Oct 10, 2007, 10:10:04 AM10/10/07
to us...@mule.codehaus.org

Thanks! That was it!

For the community, this is how to configure mule for the following setup:
JMS Client -> ActiveMQ -> Mule JMS endpoint


I have ActiveMQ running(default config) , and changed my connector to:

<connector name="jmsConnector"
className="org.mule.providers.jms.activemq.ActiveMqJmsConnector">


<properties>
<property name="specification" value="1.1" />
<property name="connectionFactoryJndiName" value="ConnectionFactory" />

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


<property name="jndiInitialFactory"
value="org.apache.activemq.jndi.ActiveMQInitialContextFactory" />
<map name="connectionFactoryProperties">

<property name="brokerURL" value="tcp://localhost:61616" />
</map>
</properties>
</connector>

I wish this information was on the mule web-pages! :)

Tor


Andrew Perepelytsya wrote:
>
> "tcp://localhost:60504";//ActiveMQConnection.DEFAULT_BROKER_URL;


>
> The above is a Mule's admin agent port. AMQ's default broker is at
> tcp://localhost:61616
>
> Andrew
>
>

--
View this message in context: http://www.nabble.com/JMS-client-fails-to-connect-to-Mule-using-ActiveMQ-tf4600036.html#a13136606

Reply all
Reply to author
Forward
0 new messages