aspose file tools*
The moose likes JBoss/WildFly and the fly likes ClassCastException in JMS ConnectionFactory lookup in JNDI. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "ClassCastException in JMS ConnectionFactory lookup in JNDI." Watch "ClassCastException in JMS ConnectionFactory lookup in JNDI." New topic
Author

ClassCastException in JMS ConnectionFactory lookup in JNDI.

Subash Karuppaiah
Greenhorn

Joined: Apr 27, 2012
Posts: 6
am new to Queues. I had setup my queue in JBOSS 5.1 EAP and now while trying to inject in tho the queue am getting a ClassCastException (in lookup of JNDI), I use flex on my front end and use Springframework for flex. When injected into the queue using quartz job it runs well and good. The quartz job is a separate project and has nothing to do with flex and spring.

I read over some where that this could be a jar issue, I had JMS jars in my spring and i tried removing, replacing all types of jars, no luck.






This is my piece of coding to inject into the queue. I get the Exception in "//Step 3. Perform a lookup on the Connection Factory" and this is my stack trace.



09:22:20,730 ERROR [STDERR] java.lang.ClassCastException: org.jboss.jms.client.JBossConnectionFactory cannot be cast to javax.jms.QueueConnectionFactory 09:22:20,731 ERROR [STDERR] at com.cat.clv.util.InQueueReinjectMessage.sendMessage(InQueueReinjectMessage.java:63) 09:22:20,731 ERROR [STDERR] at com.cat.clv.util.RejectedMessageReinject.reProcessedMessage(RejectedMessageReinject.java:65) 09:22:20,731 ERROR [STDERR] at com.cat.clv.service.ReinjectMessagesServiceImpl.reinjectRejectedMessages(ReinjectMessagesServiceImpl.java:106) 09:22:20,731 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 09:22:20,731 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 09:22:20,732 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 09:22:20,732 ERROR [STDERR] at java.lang.reflect.Method.invoke(Unknown Source) 09:22:20,732 ERROR [STDERR] at flex.messaging.services.remoting.adapters.JavaAdapter.invoke(JavaAdapter.java:421) 09:22:20,732 ERROR [STDERR] at flex.messaging.services.RemotingService.serviceMessage(RemotingService.java:183) 09:22:20,732 ERROR [STDERR] at flex.messaging.MessageBroker.routeMessageToService(MessageBroker.java:1503)



Any serious help would be appriciated as i need a very urgent solution. Thanks!!
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

Is this code in an app deployed to JBoss AS, or is it in a standalone app? If in an app deployed to JBoss AS, you probably have some JBoss JARs packaged with your app, remove them. If you are not sure which ones to remove, post the full list of JARs packaged with your app.


JBoss In Action
Subash Karuppaiah
Greenhorn

Joined: Apr 27, 2012
Posts: 6
Hi Peter, Thanks a lot for your quick reply and your help. I had a geronimo-j2ee-management_1.0_spec-1.0.jar, I tried removing it and now my app runs well and Good. This isn't a standalone app, i had deployed it in JBOSS EAP 5.1 in default profile.

I knew its a jar issue, but never thought it would be this one and hence never tried with this one, so fool of me!!

Raju Varla
Greenhorn

Joined: Oct 26, 2013
Posts: 2
HI team,

I have the similar problem " java.lang.ClassCastException: org.jboss.jms.client.JBossConnectionFactory cannot be cast to javax.jms.QueueConnectionFactory". but i am using JBOSS 5.1.0 as my server and i know the culprit is jms.jar which is added by my application deployed in the server. but i need JMS.jar to be in as there are many dependencies in my application. i am trying to delete the jars from 'jboss-5.1.0.GA\client' and deleted the 'jboss-messaging-client.jar' to get rid of this error but no use. please suggest me to get rid of this. Thanks a ton. - Raju Varla
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42278
    
  64
Raju Varla wrote:i know the culprit is jms.jar which is added by my application deployed in the server. but i need JMS.jar to be in as there are many dependencies in my application.

You may need it at compile time, but probably not at runtime, because it's also part of JBoss. What happens if you remove it from your app?


Ping & DNS - my free Android networking tools app
Raju Varla
Greenhorn

Joined: Oct 26, 2013
Posts: 2
Hi Marshal,

Thanks for the reply. If i remove jms.jar from my application(packaged with deployed ear) i am not getting this error and its working fine but jms.jar is needed as its used by other part of application. Is there any way to get rid of this without deleting the jms.jar from my application?

Thanks,
Raju Varla
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42278
    
  64
Hi Marshal

My name is Ulf.

I'm not following - what is "other part of application"? If it's part of the web app, then all required classes are in the classpath, and there should be no problem. If it's some other kind of app, then it needs the jar file in its classpath during runtime.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ClassCastException in JMS ConnectionFactory lookup in JNDI.