Getting a ClassCastException when using ActiveMQ

maghamravi's picture
Hi, I am trying the example 251 of WSO2 ESB 2.0.2 where in I swith from http to jms . I have placed the activemq-core-5.1.0.jar in the ESB_HOME/lib/extensions folder. On making a call to the proxy service, I get the following exception. ERROR Axis2Sender Unexpected error during sending message out java.lang.ClassCastException: org.apache.activemq.ActiveMQConnectionFactory at org.apache.synapse.transport.jms.JMSOutTransportInfo.getConnectionFactory(JMSOutTransportInfo.java:144) at org.apache.synapse.transport.jms.JMSOutTransportInfo.loadConnectionFactoryFromProperies(JMSOutTransportInfo.java:126) at org.apache.synapse.transport.jms.JMSSender.sendMessage(JMSSender.java:126) at org.apache.synapse.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:120) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448) at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.send(DynamicAxisOperation.java:190) at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.executeImpl(DynamicAxisOperation.java:174) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163) at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:307) at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:57) at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:232) at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:205) at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:59) at org.apache.synapse.endpoints.IndirectEndpoint.send(IndirectEndpoint.java:50) at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:77) at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:59) at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:125) at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:149) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176) at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275) at org.apache.synapse.transport.nhttp.ServerWorker.processPost(ServerWorker.java:290) at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:199) at org.apache.synapse.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:58) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) at java.lang.Thread.run(Thread.java:595) Can you please help me. Thanks Ravi.
indika's picture

Hi What is your ESB version?

Hi What is your ESB version? …JMS transport code seems somewhat old. If you are using new code, exception needs to be more descriptive. This is happened when the object returns from the JNDI lookup using the value of the ‘transport.jms.ConnectionFactoryJNDIName’ is not an instance of javax.jms.ConnectionFactory or returned naming Reference (java naming) has the name of the factory class which may not be in classpath or is not an instance of javax.jms.ConnectionFactory. Indika
maghamravi's picture

Thanks for the response

Hi Indika, The ESB version is 2.0.2. I notice the following statement in the logs when ESB starts up.  ERROR BaseUtils JNDI lookup of name TopicConnectionFactory returned a org.apache.activemq.ActiveMQConnectionFactory while a interface javax.jms.ConnectionFactory was expected I uncommented the code that was there was jms as part of the download. Can you please help me on how I solve this. Regards. Ravi.
indika's picture

Hi I have successfully run

Hi I have successfully run both 250 and 251 with activemq 5.2.0 You have to put following jars(for activemq 5.2.0) inside lib/extensions activeio-core-3.1.0.jar activemq-core-5.2.0.jar geronimo-j2ee-management_1.0_spec-1.0.jar geronimo-jms_1.1_spec-1.1.1.jar Thanks Indika
maghamravi's picture

Thanks a lot!!! It worked.

The issue is solved with replacing the jars of Active MQ 5.2 in ESB. Can you please guide me to how AMQP can be configured in ESB. Thanks Ravi.
indika's picture

You can refer

You can refer http://wso2.org/library/3663
library project main code
Learn Cloud
Learn
Cloud

The WSO2 Application Server is a reliable application server that can host your enterprise web applications. The WSO2 Application Server as a Service is offered in StratosLive, the WSO2 Platform as a Service. This article explains how a simple web application can be developed and deployed from Carbon Studio to the WSO2 Application Server...

Latest Webinar
Different groups within an organization need to monitor different Key Performance Indicators (KPIs) - An operations team will be interested in the response times of business services and loads of each service,..
Thursday, February 9th 2012, 09.00 AM (PST)

Thursday, February 9th 2012, 10.00 AM (GMT)