在将我们的 2 场迁移 Ear 从旧的 Websphere 8.x 部署到 OpenLiberty 期间,我遇到了有关 xmi 中意外元素的问题:
[ERROR ] CWWKZ0002E: An exception occurred while starting the application NAMEOFEAR-1.0.0. The exception message was: com.ibm.ws.container.service.metadata.MetaDataException: com.ibm.wsspi.adaptable.module.UnableToAdaptException: com.ibm.ejs.container.EJBConfigurationException: com.ibm.wsspi.adaptable.module.UnableToAdaptException: com.ibm.ws.javaee.ddmodel.DDParser$ParseException: CWWKC2256E: Unexpected attribute listenerInputPortName encountered parsing element ejbBindings in the NAMEOFEAR-1.0.0.ear : ejbMdb-1.0.0.jar : META-INF/ibm-ejb-jar-bnd.xmi deployment descriptor on line 4.
ibm-ejb-jar-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_1112712559736">
<ejbJar href="META-INF/ejb-jar.xml#ejb-jar_ID"/>
<ejbBindings xmi:type="ejbbnd:MessageDrivenBeanBinding" xmi:id="MessageDrivenBeanBinding_1112712559736" listenerInputPortName="CompanyEventLogListenerPort">
<enterpriseBean xmi:type="ejb:MessageDriven" href="META-INF/ejb-jar.xml#MessageDriven_1112712559736"/>
<resRefBindings xmi:id="ResourceRefBinding_1112712559752" jndiName="mail/SMTPMailSession">
<bindingResourceRef href="META-INF/ejb-jar.xml#ResourceRef_1112712559752"/>
</resRefBindings>
<resRefBindings xmi:id="ResourceRefBinding_1112712559753" jndiName="mail/SMTPMailSession_backup">
<bindingResourceRef href="META-INF/ejb-jar.xml#ResourceRef_1112712559753"/>
</resRefBindings>
</ejbBindings>
<ejbBindings xmi:type="ejbbnd:MessageDrivenBeanBinding" xmi:id="MessageDrivenBeanBinding_1112712559752" listenerInputPortName="CompanySMTPMessageListenerPort">
<enterpriseBean xmi:type="ejb:MessageDriven" href="META-INF/ejb-jar.xml#MessageDriven_1112712559752"/>
<resRefBindings xmi:id="ResourceRefBinding_1112712559754" jndiName="mail/SMTPMailSession">
<bindingResourceRef href="META-INF/ejb-jar.xml#ResourceRef_1112712559754"/>
</resRefBindings>
<resRefBindings xmi:id="ResourceRefBinding_1112712559755" jndiName="mail/SMTPMailSession_backup">
<bindingResourceRef href="META-INF/ejb-jar.xml#ResourceRef_1112712559755"/>
</resRefBindings>
<resRefBindings xmi:id="ResourceRefBinding_1112712559767" jndiName="mail/SMTPMailSession_fax">
<bindingResourceRef href="META-INF/ejb-jar.xml#ResourceRef_1112712559767"/>
</resRefBindings>
</ejbBindings>
</ejbbnd:EJBJarBinding>
还有 ejb-jar.xml 示例:
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar id="ejb-jar_ID" version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
<display-name>ejb</display-name>
<enterprise-beans>
<message-driven id="MessageDriven_1112712559736">
<ejb-name>CompanyEventLog</ejb-name>
<ejb-class>company.ejs.log.CompanyEventLogBean</ejb-class>
<transaction-type>Bean</transaction-type>
<message-destination-type>javax.jms.Queue</message-destination-type>
<activation-config>
<activation-config-property>
<activation-config-property-name>acknowledgeMode</activation-config-property-name>
<activation-config-property-value>Auto-acknowledge</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destinationType</activation-config-property-name>
<activation-config-property-value>javax.jms.Queue</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>
<resource-ref id="ResourceRef_1112712559752">
<res-ref-name>mail/SmtpMailRef</res-ref-name>
<res-type>javax.mail.Session</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<resource-ref id="ResourceRef_1112712559753">
<res-ref-name>mail/SmtpMailBackupRef</res-ref-name>
<res-type>javax.mail.Session</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</message-driven>
<message-driven id="MessageDriven_1112712559752">
<ejb-name>CompanySMTPSender</ejb-name>
<ejb-class>company.ejs.smtp.CompanySMTPSenderBean</ejb-class>
<transaction-type>Container</transaction-type>
<message-destination-type>javax.jms.Queue</message-destination-type>
<activation-config>
<activation-config-property>
<activation-config-property-name>acknowledgeMode</activation-config-property-name>
<activation-config-property-value>Auto-acknowledge</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destinationType</activation-config-property-name>
<activation-config-property-value>javax.jms.Queue</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>
<resource-ref id="ResourceRef_1112712559754">
<res-ref-name>mail/SmtpMailRef</res-ref-name>
<res-type>javax.mail.Session</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<resource-ref id="ResourceRef_1112712559755">
<res-ref-name>mail/SmtpMailBackupRef</res-ref-name>
<res-type>javax.mail.Session</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<resource-ref id="ResourceRef_1112712559767">
<res-ref-name>mail/SmtpMailFaxRef</res-ref-name>
<res-type>javax.mail.Session</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</message-driven>
</enterprise-beans>
</ejb-jar>
我不确定如何将其迁移到 EJB 3.1 升级并在 OpenLiberty 中运行/部署。 简单地删除listenerInputPortName属性是可行的,但我确信它会导致之后出现问题?
OpenLiberty 中没有
listener port
。 MDB 正在使用 ActiveSpecifications
。此外,Liberty 不使用 xmi
文件。您必须在 xml
或 server.xml
中进行绑定。检查在 OpenLiberty 中使用 mdb 的文档(取决于您使用的 jms 提供程序) - https://www.ibm.com/docs/en/was-liberty/base?topic=liberty-deploying-message-driven-beans-内