为什么websphere说MDB没有配置

时间:2015-07-20 09:53:39

标签: java ejb websphere message-driven-bean

我使用的是ejb 2.1 MDB。我创建了bean,ibm-bnd-xmi文件看起来像这样

<?xml version="1.0" encoding="UTF-8"?>
<ejbbnd:EJBJarBinding xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ejb="ejb.xmi" xmlns:ejbbnd="ejbbnd.xmi" xmi:id="EJBJarBinding_1436860079989">
<ejbJar href="META-INF/ejb-jar.xml#ejb-jar_ID"/>
<ejbBindings xmi:type="ejbbnd:MessageDrivenBeanBinding" xmi:id="MessageDrivenBeanBinding_1436860521292">
<enterpriseBean xmi:type="ejb:MessageDriven" href="META-INF/ejb-jar.xml#TestMDB"/>
<resRefBindings xmi:id="ResourceRefBinding_1436860842233" jndiName="jms/qcf.QCF">
  <bindingResourceRef href="META-INF/ejb-jar.xml#ResourceRef_1436860842233"/>
</resRefBindings>
<resRefBindings xmi:id="ResourceRefBinding_1436861092345" jndiName="jms/ccqueue">
  <bindingResourceRef href="META-INF/ejb-jar.xml#ResourceRef_1436861092345"/>
</resRefBindings>
</ejbBindings>
</ejbbnd:EJBJarBinding>

当我在websphere 8中部署MDB时,我得到以下异常

Caused by: com.ibm.ejs.jms.listener.MDBException: MDB TestMDB has no MessageDrivenBeanBinding in ibm-ejb-jar-bnd.xmi
at com.ibm.ejs.jms.listener.MDBListenerManagerImpl.create(MDBListenerManagerImpl.java:480)
at com.ibm.ejs.container.MDBHomeBean.activateEndpoint(MDBHomeBean.java:167)
... 74 more

我可以在xmi文件中看到配置,但它仍然会发出此错误。我错过了什么吗?

1 个答案:

答案 0 :(得分:0)

我无法在<mesage-driven>中看到任何ejb-bnd.xml条目。为 MDB

添加这样的条目

FOR EJB 3.1

<message-driven
        name="StatusUpdateMDB">
    <jca-adapter activation-spec-binding-name="jms/MC_StatusUpdateActivationSpec" destination-binding-name="jms/MobileClaimStatusQueue"/></message-driven>

对于EJB 2.1

    <message-driven id="Mdb21">
  <ejb-name>Foo/ejb-name>
  <ejb-class>ejbs.FooBean</ejb-class>
   <messaging-type>javax.jms.MessageListener</messaging-type>
   <transaction-type>Bean/transaction-type>
   <message-destination-type>javax.jms.Topic</message-destination-type>
    <activation-config>
     <activation-config-property>
       <activation-config-property-name>destinationType</activation-config-property-name>
       <activation-config-property-value>javax.jms.Topic</activation-config-property-value>
     </activation-config-property>
     <activation-config-property>
       <activation-config-property-name>subscriptionDurability</activation-config-property-name>
         <activation-config-property-value>Durable</activation-config-property-value>
      </activation-config-property>
      <activation-config-property>
         <activation-config-property-name>acknowledgeMode</activation-config-property-name>
         <activation-config-property-value>AutoAcknowledge</activation-config-property-value>
      </activation-config-property>
      <activation-config-property>
        <activation-config-property-name>messageSelector</activation-config-property-name>
        <activation-config-property-value>fooSelector</activation-config-property-value>
      </activation-config-property>
</activation-config>
</message-driven>

对于EJB 2.1参考,请参阅IBM doc here