我有一个 java EE 应用程序,它有一个消息驱动 bean,它在 JBoss 4 上运行良好,但是当我为 JBoss 6 配置项目并在其上部署时,我收到此错误;
WARN [org.jboss.ejb.deployers.EjbDeployer.verifier] EJB spec violation:
...
The message driven bean must declare one onMessage() method.
...
org.jboss.deployers.spi.DeploymentException: Verification of Enterprise Beans failed, see above for error messages.
但是我的 bean 有 onMessage 方法!那时它也不会在 jboss 4 上工作。
为什么我会收到这个错误!?
编辑:
有问题的课程看起来像这样
package ...
imports ...
public class MyMDB implements MessageDrivenBean, MessageListener {
AnotherSessionBean a;
OneMoreSessionBean b;
public MyMDB() {}
public void onMessage(Message message) {
if (message instanceof TextMessage) {
try {
//Lookup sessionBeans by jndi, create them
lookupABean();
// check message-type, then invokie
a.handle(message);
// else
b.handle(message);
} catch (SomeException e) {
//handling it
}
}
}
public void lookupABean() {
try {
// code to lookup session beans and create.
} catch (CreateException e) { // handling it and catching NamingException too }
}
}
编辑 2: 这是 jboss.xml 相关部分
<message-driven>
<ejb-name>MyMDB</ejb-name>
<destination-jndi-name>topic/A_Topic</destination-jndi-name>
<local-jndi-name>A_Topic</local-jndi-name>
<mdb-user>user</mdb-user>
<mdb-passwd>pass</mdb-passwd>
<mdb-client-id>MyMessageBean</mdb-client-id>
<mdb-subscription-id>subid</mdb-subscription-id>
<resource-ref>
<res-ref-name>jms/TopicFactory</res-ref-name>
<jndi-name>jms/TopicFactory</jndi-name>
</resource-ref>
</message-driven>
编辑3:
我刚刚从项目中删除了我所有的 jar,并且只重新添加了相关的(也来自新版本)以消除 NoClassDefFound 错误。问题仍然存在。
编辑: 任何方向,我应该看哪个区域?我的项目,或 jboss-configration,或部署设置?