【问题标题】:Why is websphere saying there is no configuration for MDB为什么websphere说没有MDB配置
【发布时间】:2015-07-20 09:53:38
【问题描述】:

我正在使用 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 文件中看到配置,但它仍然会吐出这个错误。我错过了什么吗?

【问题讨论】:

  • 请同时显示来自 ejb-jar.xml 的 MDB sn-p。它应该有&lt;message-driven id="TestMDB"&gt;

标签: java ejb websphere message-driven-bean


【解决方案1】:

我在ejb-bnd.xml 中看不到任何&lt;mesage-driven&gt; 条目。为您的 MDB

添加这样的条目

对于 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 文档 here

【讨论】:

  • ejb 2.1 允许这样做吗?我在 xmi 文件中添加了这个(不是 xml,因为 xml 只与 ejb 3 一起使用),我得到了这个:org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'message-driven' not found。 (file:///D:/IBM/RAD8/WebSphere/AppServer/profiles/CWBE_66/bin/META-INF/ibm-ejb-jar-bnd.xmi, 13, 31)
  • @lemonTea 编辑了 EJB2.1 的代码。您需要在`ejb-jar-2.1.xsd`中进行更改
猜你喜欢
  • 2016-05-01
  • 2010-12-26
  • 1970-01-01
  • 2017-01-30
  • 1970-01-01
  • 1970-01-01
  • 2013-04-06
  • 1970-01-01
  • 2021-05-01
相关资源
最近更新 更多