在将应用程序从传统的WebSphere Application Server迁移到Liberty时,如何正确重构ibm-ejb-jar-bnd.xmi文件?

时间:2018-06-21 20:17:10

标签: java-ee ejb websphere websphere-liberty open-liberty

将应用程序从WebSphere Application Server传统v9.0.0.7迁移到Liberty基本v18.0.0.1时遇到错误

控制台中的异常表明:

...
    CWWKZ0002E: An exception occurred while starting the application AP. 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: 
    CWWKC2251E: The ejbBindings element is missing the required name attribute in the /META-INF/ibm-ejb-jar-bnd.xmi deployment descriptor on line 9.
...

似乎EJB绑定存在问题。 我一直在阅读Liberty不支持WAS 9 EJB绑定,而仅将EJB绑定到 java:名称空间语法。

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_1090575365340">
  <ejbJar href="META-INF/ejb-jar.xml#ejb-jar_ID"/>
  <ejbBindings xmi:id="EnterpriseBeanBinding_1090575365340" jndiName="ejb/com/ap/ejb/AccountSessionHome">
    <enterpriseBean xmi:type="ejb:Session" href="META-INF/ejb-jar.xml#AccountSession"/>
  </ejbBindings>
  <ejbBindings xmi:id="EnterpriseBeanBinding_1047783791228" jndiName="ejb/com/ap/ejb/UtilitySessionHome">
    <enterpriseBean xmi:type="ejb:Session" href="META-INF/ejb-jar.xml#UtilitySession"/>
  </ejbBindings>
</ejbbnd:EJBJarBinding>

我应该如何精确重构ibm-ejb-jar-bnd.xmi文件? 请帮助我解决问题。

1 个答案:

答案 0 :(得分:2)

该消息有点令人困惑,因为绑定文件的两个版本都使用相同的解析器。旧的<div id="second_hand">------------</div>和新的ibm-ejb-jar-bnd.xmi。以较新的格式(XML)定义的ibm-ejb-jar-bnd.xml属性是较旧的格式(XMI)的计算值,并通过处理以下行来确定:

name

具体地说,解析器将遵循<enterpriseBean xmi:type="ejb:Session" href="META-INF/ejb-jar.xml#UtilitySession"/> 并查找相应EJB的href元素。您应该在ejb-name中查找相应的条目,如下所示:

ejb-jar.xml

要么丢失,要么可能多次出现。或者,它缺少一个<session id="UtilitySession"> 元素。

注意:在级别为3.0或更高的ejb-name文件中支持较新的XML格式,并且在{{1}的所有先前级别中均支持ejb-jar.xml格式{1}}