Sudarshan
Sudarshan

Reputation: 8664

ActiveMQ Exception Connection and domain type do not match

Hi I am getting the below exception stack trace in my application logs.

20/09/2013 22.26.49 - Caught exception in Exception Strategy: Connection and domain type do not match java.lang.IllegalArgumentException: Connection and domain type do not match at org.mule.transport.jms.Jms102bSupport.createSession(Jms102bSupport.java:108) at org.mule.transport.jms.JmsConnector.getSession(JmsConnector.java:579) at org.mule.transport.jms.JmsConnector.getSession(JmsConnector.java:558) at org.mule.transport.jms.JmsMessageDispatcher.dispatchMessage(JmsMessageDispatcher.java:141) at org.mule.transport.jms.JmsMessageDispatcher.doDispatch(JmsMessageDispatcher.java:73) at org.mule.transport.AbstractMessageDispatcher$Worker.run(AbstractMessageDispatcher.java:262) at org.mule.work.WorkerContext.run(WorkerContext.java:310) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$CallerRunsPolicy.rejectedExecution(ThreadPoolExecutor.java:1895) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:765) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1288) at org.mule.work.ScheduleWorkExecutor.doExecute(ScheduleWorkExecutor.java:41)

I cannot quite understand what it actually means,

can someone please explain what Connection and domain type do not match means

and probably a example scenario where it might occur.

Data is sent out using a mule outbound configured

<multicasting-router>

    <jms:outbound-endpoint topic="SAMPLEMESSAGES" transformer-refs="DomToXml ObjectToJms" connector-ref="jmsConnector" />

</multicasting-router>

Connector configuration can be found here cannot paste the xml here for some reason

Like archer mentioned i did look at the activeMQ source code, just pasting it here



@Override
    public Session createSession(Connection connection, boolean topic, boolean transacted,
        int ackMode, boolean noLocal) throws JMSException
    {
        if (connection == null)
        {
            throw new IllegalArgumentException("Connection is null");
        }
        if (topic && connection instanceof TopicConnection)
        {
            return ((TopicConnection) connection).createTopicSession(noLocal, ackMode);
        }
        else if (connection instanceof QueueConnection)
        {
            // for transacted sessions the ackMode is always ignored, but
            // set it for readability (SESSION_TRANSACTION is recommented
            // for this case).
            return ((QueueConnection) connection).createQueueSession(
                    transacted, (transacted ? Session.SESSION_TRANSACTED : ackMode));
        }
        else
        {
            throw new IllegalArgumentException("Connection and domain type do not match, connection is of type " + connection.getClass().getName());
        }
    }

I want to understand under what circumstances can a incoming client connect not be a topicConnection or queueConnection , what client code can i write to cause the exception to occur

Thanks

Upvotes: 0

Views: 361

Answers (2)

David Dossot
David Dossot

Reputation: 33413

You didn't specify the JMS version to use in your ActiveMQ connector so Mule, by default, uses the old and deprecated version 1.0.2b of the spec.

Configure your connector to use 1.1 and see if you still have the issue. Also, if you specify a broker URL, you do not need to provide a connection factory.

So try with:

<jms:activemq-connector name="jmsConnector" specification="1.1"
                        brokerURL="tcp://10.209.130.10:61616">
    <spring:property name="retryPolicyTemplate" ref="ThreadingPolicyTemplate" />
</jms:activemq-connector>

Upvotes: 2

Archer
Archer

Reputation: 5147

You connection should be of type TopicConnection or QueueConnection. Otherwise this exception will be thrown. More details you can find reading the source code. Line 117.

Upvotes: 0

Related Questions