1

I am experiencing issue when migrating from WAS 7.0 to WAS Liberty Base. I have deployed EAR file in WAS Liberty Base. When I add the mdb-3.2 to server.xml for JMS Messaging, I get the following run-time error on EJB MDB Bean.

[ERROR   ] CNTR5007E: The com.companyname.appname.AdminMDBBean bean class for the AppEAR#AppEJB.jar#AdminMDBBean bean does not have a public constructor that does not take parameters.
[ERROR   ] CNTR4002E: The AppEJB.jar EJB module in the AppEAR application failed to start. Exception: com.ibm.ws.exception.RuntimeError: com.ibm.ejs.container.EJBConfigurationException: EJB class com.companyname.appname.AdminMDBBean must have a public constructor that takes no parameters : AppEAR#AppEJB.jar#AdminMDBBean
    at com.ibm.ws.ejbcontainer.runtime.AbstractEJBRuntime.startModule(AbstractEJBRuntime.java:641)
    at [internal classes]
Caused by: com.ibm.ejs.container.EJBConfigurationException: EJB class com.companyname.appname.AdminMDBBean must have a public constructor that takes no parameters : AppEAR#AppEJB.jar#AdminMDBBean
    at com.ibm.ws.ejbcontainer.jitdeploy.EJBUtils.validateEjbClass(EJBUtils.java:350)
    ... 1 more
Caused by: java.lang.NoClassDefFoundError: com.companyname.appname.domain.HealthMonitorMessage
    at java.lang.J9VMInternals.prepareClassImpl(Native Method)
    at java.lang.J9VMInternals.prepare(J9VMInternals.java:291)
    at java.lang.Class.getConstructor(Class.java:531)
    at com.ibm.ws.ejbcontainer.jitdeploy.EJBUtils.validateEjbClass(EJBUtils.java:341)
    ... 1 more

Server.xml

<server description="new server">
    <featureManager>
        <feature>jsp-2.3</feature>
        <feature>adminCenter-1.0</feature>
        <feature>jdbc-4.1</feature>
        <feature>jndi-1.0</feature>
        <feature>wasJmsServer-1.0</feature>
        <feature>wasJmsClient-2.0</feature>
        <feature>mdb-3.2</feature>
    </featureManager>

AdminMDBBean.Java

@MessageDriven(name = "AdminMDBBean", activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue") })
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public class AdminMDBBean implements MessageListener {
    private Logger logger;
    public AdminMDBBean()
    {
        logger = Logger.getLogger(this.getClass().getName());
    }

    /**
     * Method to receive and process the messages from the queue.
     */

public void onMessage(Message message) {....}
Siv
  • 21
  • 1
  • 8
  • it seems that you have redacted some relevant information from your `AdminMDBBean`. The stack trace indicates the root cause is that the class `com.companyname.appname.domain.HealthMonitorMessage` cannot be found. Does the real copy of `AdminMDBBean` reference the `HealthMonitorMessage` class? – Andy Guibert May 11 '17 at 03:12
  • Thanks Andy for helping. Yes, the real copy of AdminMDBBean reference the HealthMonitorMessage class. I have updated the code and provided the complete method. Thanks for your time. – Siv May 11 '17 at 06:22
  • Where the `HealthMonitorMessage` class is located? Same jar as your mdb class? – Gas May 11 '17 at 08:19
  • HealthMonitorMessage is in a different jar file. This issue resolved by adding < defaultLibBundleDir >lib< / defaultLibBundleDir > to the EAR POM.XML. Thanks Gas and Andy for your time to respond my issue. – Siv May 11 '17 at 16:28

1 Answers1

1

This issue solved. The Solution provided here Maven EJB packaging with dependent libraries

This is working by adding

 <defaultLibBundleDir>lib</defaultLibBundleDir>

to the EAR POM.XML

Thanks.

Community
  • 1
  • 1
Siv
  • 21
  • 1
  • 8