2 kunkia kunkia 于 2016.09.25 23:45 提问

在jboss7中,怎么部署消息驱动bean?

本人在学习EJB,使用的是jboss7
【环境】MyEclipse10 + jboss7.1.1
写了一个消息驱动bean发布到jboss7,并启动是报错?
代码如下:
@MessageDriven (

activationConfig = {

@ActivationConfigProperty(propertyName="destinationType",propertyValue="javax.jms.Queue"),

@ActivationConfigProperty(propertyName="destination",propertyValue="queue/myqueue")

}

)
public class MyQueueMDBean implements MessageListener {

@Override
public void onMessage(Message message) {
    TextMessage msg  = (TextMessage) message;
    try {
        System.out.println("消息bean: MyQueueMDBean被调用了" + msg.getText());
    } catch (JMSException e) {
        e.printStackTrace();
    }
}

}
报错内容如下:
23:22:18,024 ERROR org.jboss.msc.service.fail MSC00001: Failed to start service jboss.deployment.unit."ejbLearn03.jar".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."ejbLearn03.jar".PARSE: Failed to process phase PARSE of deployment "ejbLearn03.jar"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_13]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_13]
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_13]
Caused by: org.jboss.msc.service.ServiceNotFoundException: Service service jboss.ejb.default-resource-adapter-name-service not found
at org.jboss.msc.service.ServiceContainerImpl.getRequiredService(ServiceContainerImpl.java:447) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.as.ejb3.deployment.processors.MessageDrivenComponentDescriptionFactory.getDefaultResourceAdapterName(MessageDrivenComponentDescriptionFactory.java:273)
at org.jboss.as.ejb3.deployment.processors.MessageDrivenComponentDescriptionFactory.processMessageBeans(MessageDrivenComponentDescriptionFactory.java:153)
at org.jboss.as.ejb3.deployment.processors.MessageDrivenComponentDescriptionFactory.processAnnotations(MessageDrivenComponentDescriptionFactory.java:81)
at org.jboss.as.ejb3.deployment.processors.AnnotatedEJBComponentDescriptionDeploymentUnitProcessor.processAnnotations(AnnotatedEJBComponentDescriptionDeploymentUnitProcessor.java:58)
at org.jboss.as.ejb3.deployment.processors.AbstractDeploymentUnitProcessor.deploy(AbstractDeploymentUnitProcessor.java:81)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 5 more

1个回答

devmiao
devmiao   Ds   Rxr 2016.09.25 23:56
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!