2015-07-20 110 views
0

我正在使用ejb 2.1 MDB。我創建了bean和IBM-BND-XMI文件看起來像這樣爲什麼websphere說MDB沒有配置

<?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文件,但它仍然吐出這個錯誤。我錯過了什麼嗎?

+0

請從ejb-jar.xml中顯示MDB代碼片段。它應該有''。 –

回答

0

我無法在ejb-bnd.xml中看到任何<mesage-driven>條目。您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

+0

這是允許與ejb 2.1?我在xmi文件中添加了這個(不是xml,因爲xml只與ejb 3一起使用),並且我得到了這個:org.eclipse.emf.ecore.xmi.FeatureNotFoundException:找不到功能「消息驅動」。 (file:/// D:/IBM/RAD8/WebSphere/AppServer/profiles/CWBE_66/bin/META-INF/ibm-ejb-jar-bnd.xmi,13,31) –

+0

@lemonTea編輯了EJB2的代碼。 1。你需要在'ejb-jar-2.1.xsd'中進行修改 –

相關問題