I?m trying to get JBoss v4.0.3SP1 to read/write to/from MQSeries v5.3. I can successfully write to the MQSeries queue, but am failing when I attempt to read from it. Specifically, I get:
java.lang.ClassCastException: com.ibm.mq.jms.MQQueue at org.jboss.mq.SpyConnectionConsumer.<init>(SpyConnectionConsumer.java:91) at org.jboss.mq.SpyConnection.createConnectionConsumer(SpyConnection.java:168) at org.jboss.ejb3.mdb.MDB.innerCreateQueue(MDB.java:308) at org.jboss.ejb3.mdb.MDB.innerCreate(MDB.java:232) at org.jboss.ejb3.mdb.MDB.start(MDB.java:136) at org.jboss.ejb3.mdb.MessageDrivenManager.startService(MessageDrivenManager.java:90) ...
Looking at the SpyConnectionConsumer code, it appears that it is assuming that whatever it gets off the queue is a SpyDestination. I am trying to figure out how to tell JBoss that it?s actually something else.
Here is what I?ve tried so far:
1. I spent a lot of time with the http://wiki.jboss.org/wiki/Wiki.jsp?page=UsingWebSphereMQSeriesWithJBossASPartI (and part 2). Using the downloadable examples that come with it, I was able to modify the configuration to get it to successfully read and write from my MQSeries queue. This success occurred while running the tutorial examples in the stand-alone mode that they are written in. However, when I transferred that knowledge over into my real application, I am still getting the ClassCastException. The difference being that my real application is configured as an MDB that launches as JBoss is coming up. So I get the ClassCastException before it the logic ever gets to my code. This contrasts with the tutorial example that does not attempt to read the queue until I start the test program.
2. So I deduced that the problem is with the way I have my queue configured in the JBoss configuration files. I then spent a lot of time studying the ?MQSeries/JBoss MDB/3rd Party Messaging? thread in the forum. Specifically, this post http://www.jboss.org/index.html?module=bb&op=viewtopic&t=1070&start=18. It seems pcallies had a problem very similar to mine (and in fact, after spending the last three days trolling the web, it is the only reference I found that describes my problem). Several posts later, he describes a solution. The solution he describes involves the use of org.jboss.jms.jndi.JBossMQProvider. However, that class has since been deprecated and JNDIProviderAdapter is recommended instead. I?ve been studying that, and can?t figure out how to make it work. To make matters even harder, the XML files that pcallies describes in his solution don?t seem to exist in my version of JBoss.
So I conclude that I need to configure JBoss to tell it that my queue needs to be processed as a wsmq destination, instead of as a SpyDestination. I just can?t figure out how to do it. Can anybody point me to some straightforward documentation that explains how to tell JBoss that the queue is an MQSeries queue?
In the interest of full disclosure, I should admit I?m new to both JBoss and JMS, so I?m definitely hampered by my lack of experience.