Can Message Driven bean implements other interface than MessageListener?

java, javabeans, message

Solution

If you implement multiple interfaces, you should specify which one is the message listener interface using the attribute `messageListenerInterface` of the `@MessageDriven` annotation.

Example:

@MessageDriven(messageListenerInterface=MessageListener.class)

Problem

I am new to java enterprise and trying to understand message driven beans. I have implemented a MDB, together with a remote interface, willing my MDB to implement both MessageListener and the remote interface RemoteEjbSenderInterface. Just like that: ``` @Remote public interface RemoteEjbSenderInterface { public void sendMessage(String mess) throws JMSException; } ``` and the MDB ``` @MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "messageSelector", propertyValue = "SenderType = Receiver"), @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/test")}) public class EjbSender implements MessageListener, RemoteEjbSenderInterface { ... } ``` the problem is that when deploying the application, I get an error saying: Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: EJB 3.1 FR 5.4.2 MessageDrivenBean com.ericsson.ejb.sender.EjbSender does not implement 1 interface nor specifies message listener interface this makes me think maybe message driven bean can ONLY implement MessageListener interface and nothing else? Thanks in advance for your help

Original source