从WAS 7.0迁移到WAS Liberty Base时遇到问题。我在WAS Liberty Base中部署了EAR文件。当我将mdb-3.2添加到用于JMS消息传递的server.xml时,我在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) {....}