我是java新手并且尝试理解消息驱动的bean。我已经实现了MDB和远程接口,我希望我的MDB实现MessageListener和远程接口RemoteEjbSenderInterface。就像那样:
@Remote
public interface RemoteEjbSenderInterface
{
public void sendMessage(String mess) throws JMSException;
}
和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
{
...
}
问题是,在部署应用程序时,我收到错误消息:
引起:org.jboss.as.server.deployment.DeploymentUnitProcessingException:EJB 3.1 FR 5.4.2 MessageDrivenBean com.ericsson.ejb.sender.EjbSender没有实现1接口也没有指定消息监听器接口
这让我觉得也许消息驱动的bean只能实现MessageListener接口而没有别的吗?
提前感谢您的帮助
答案 0 :(得分:8)
如果实现多个接口,则应使用messageListenerInterface
注释的属性@MessageDriven
指定哪个是消息侦听器接口。
示例:
@MessageDriven(messageListenerInterface=MessageListener.class)