WebSphere to OpenLiberty EJB 3 message driven beans migration from ibm-ejb-jar-bnd.xmi issue

166 views Asked by At

During the deployment of our migrated ear with 2 war's from old Websphere 8.x into OpenLiberty I get this issue regarding unexpected element in the 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 : NAMEOFJAR-1.0.0.jar : META-INF/ibm-ejb-jar-bnd.xmi deployment descriptor on line 4.

Simply removing the listenerInputPortName attribute worked, but I'm sure it will lead to problems afterwards?

The ibm-ejb-jar-bnd.xmi looks like this:

<?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_1">
  <ejbJar href="META-INF/ejb-jar.xml#ejb-jar_ID"/>
  <ejbBindings xmi:type="ejbbnd:MessageDrivenBeanBinding" xmi:id="MessageDrivenBeanBinding_1" listenerInputPortName="SMTPMessageListenerPort">
    <enterpriseBean xmi:type="ejb:MessageDriven" href="META-INF/ejb-jar.xml#MessageDriven_1"/>
    <resRefBindings xmi:id="ResourceRefBinding_1" jndiName="mail/SMTPMailSession">
  </ejbBindings>
</ejbbnd:EJBJarBinding>

Also example ejb-jar.xml:

<ejb-jar ...>
    <display-name>ejb</display-name>
    <enterprise-beans>
        <message-driven id="MessageDriven_1">
            <ejb-name>SMTPSender</ejb-name>
            <ejb-class>com.smtp.SMTPSendBean</ejb-class>
            <transaction-type>Container</transaction-type>
            <message-destination-type>javax.jms.Queue</message-destination-type>
            <activation-config>
              ...
            </activation-config>
            <resource-ref id="ResourceRef_1">
              ...
            </resource-ref>
        </message-driven>
    </enterprise-beans>
</ejb-jar>

JMS-resources.xml (I'm using config-drop ins):

<?xml version="1.0" encoding="UTF-8"?>
<server>
 ...


    <jmsQueueConnectionFactory jndiName="jms/CompanySMTPMessageConnectionFactory">
        <properties.mqJMS
                ...
                transportType="CLIENT"/>
    </jmsQueueConnectionFactory>

    <jmsQueue jndiName="jms/SMTPMessageQueue">
        <properties.mqJMS baseQueueName="Q2"/>
    </jmsQueue>
</server>

I'm not sure how to migrate it to work with EJB 3.1 and running/deploying in OpenLiberty.

1

There are 1 answers

11
Gas On

There are no listener ports in OpenLiberty. MDBs are using ActiveSpecifications. You have to do update bindings to use AS or do it in server.xml. Check docs for using mdbs in OpenLiberty (depending on jms provider you are using) - https://www.ibm.com/docs/en/was-liberty/base?topic=liberty-deploying-message-driven-beans-within

Update based on your additional info:
Looking at the resources defined, it seems that you are using WebSphere MQ and want your MDB to connect to the queue (although you didnt provide their names - you will have to check ListenerPorts configurations).
Here are a few changes you need:

<!-- jmsActivationSpec configs -->
<jmsActivationSpec id="my-app-name/MyMessageDrivenBean">
    <properties.mqJms destinationRef="jms/MyQueue"
                      destinationType="javax.jms.Queue"
                      channel="DEV.APP.SVRCONN"
                      hostName="${ibm.mq.hostname}"
                      port="1414"
                      queueManager="QM1"
                      transportType="CLIENT" />
</jmsActivationSpec>

If your QM requires authentication you need to add these additional props:

                      userName="${ibm.mq.username}"
                      password="${ibm.mq.password}"

id in the activeSpec must follow the following naming convention "application name/module name/bean name" in your case it shoiuld be for exampe id=NAMEOFEAR-1.0.0/ejb/CompanyEventLog

You should be able to define this binding also via xmi binding file, but I dont have example at hand since its very old. You would need IBM Rational Application Developer, which should still have editor for xmi files.

In xml format it would look like this:

<ejb-jar-bnd
        xmlns="http://websphere.ibm.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-ejb-jar-bnd_1_1.xsd" 
    (http://websphere.ibm.com/xml/ns/javaee/ibm-ejb-jar-bnd_1_1.xsd%27) version="1.1">
    
    <message-driven name="PriceChangeMDBBean">
            <jca-adapter activation-spec-binding-name="PriceChangeAS" destination-binding-name="jms/TriggerQ" />
    </message-driven>
</ejb-jar-bnd>

So maybe try first the binding in server.xml.