use*_*684 4 java message javabeans
我是java企业的新手,并试图理解消息驱动的bean.我已经实现了MDB和远程接口,我希望我的MDB实现MessageListener和远程接口RemoteEjbSenderInterface.就像那样:
@Remote
public interface RemoteEjbSenderInterface
{
public void sendMessage(String mess) throws JMSException;
}
Run Code Online (Sandbox Code Playgroud)
和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
{
...
}
Run Code Online (Sandbox Code Playgroud)
问题是,在部署应用程序时,我收到一条错误消息:
引起:org.jboss.as.server.deployment.DeploymentUnitProcessingException:EJB 3.1 FR 5.4.2 MessageDrivenBean com.ericsson.ejb.sender.EjbSender没有实现1接口也没有指定消息监听器接口
这让我觉得也许消息驱动的bean只能实现MessageListener接口而没有其他的东西?
在此先感谢您的帮助
如果要实现多个接口,应指定哪一个是使用属性消息监听器接口messageListenerInterface的的@MessageDriven注解.
例:
@MessageDriven(messageListenerInterface=MessageListener.class)
Run Code Online (Sandbox Code Playgroud)