MessageListener WAS 8.5中的类强制转换异常

时间:2014-05-07 13:40:24

标签: ejb websphere message-listener

当消息写入MQ时,我收到以下错误。我在WAS 8.5上部署了一个有一个EJB的耳朵。我已经验证了SyncOutboundMDB是MessageListener的子代。

有人对这个问题有任何想法吗?

LocalExceptio E   CNTR0020E: EJB threw an unexpected (non-declared) exception during invocation of method "onMessage" on bean "BeanId(sample-ear#sampleejb-1.0-SNAPSHOT.jar#SyncOutboundMDB, null)". Exception data: java.lang.ClassCastException: com.test.sync.mdb.SyncOutboundMDB incompatible with javax.jms.MessageListener
    at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:94)
    at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:131)
    at com.ibm.ejs.jms.listener.ServerSession.run(ServerSession.java:581)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1815)

[5/7/14 7:51:08:768 CDT] 00000097 ServerSession W   WMSG0031E: Exception processing JMS Message for MDB SyncOutboundMDB, JMSDestination OutboundQueue : com.ibm.ejs.container.UnknownLocalException: nested exception is: java.lang.ClassCastException: com.test.sync.mdb.SyncOutboundMDB incompatible with javax.jms.MessageListener
    at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:94)
    at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:131)
    at com.ibm.ejs.jms.listener.ServerSession.run(ServerSession.java:581)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1815)
Caused by: java.lang.ClassCastException: com.test.sync.mdb.SyncOutboundMDB incompatible with javax.jms.MessageListener
    ... 4 more

1 个答案:

答案 0 :(得分:1)

如果您在应用程序中使用PARENT_LAST并包含javax.jms类,则会发生此错误。您应该从应用程序中删除javax.jms类,并允许从应用程序服务器加载它们。