我在文件my-hornetq-jms.xml中有一个简单的JMS-Queue定义
<configuration xmlns="urn:hornetq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">
<queue name="my.test.queue">
<entry name="/queue/myTest"/>
</queue>
</configuration>队列被正确激活,现在我想在我的@Stateless Bean中添加一个依赖项。这个问题类似于How can I ensure that the hornet queues are there when my webapp starts in JBOSS 6.0?,但是我想用注解来定义依赖关系。我尝试了一下(在几种排列中),但没有找到正确的方法:
@Depends(value="org.hornetq:module=JMS,type=Queue,name=my.test.queue")我总是得到这样的错误:
Dependency "<UNKNOWN jboss.j2ee:jar=my.war,name=MyBean,service=EJB3>"
(should be in state "Installed", but is actually in state "** UNRESOLVED Demands
'org.hornetq:module=JMS,name=my.test.queue,type=Queue' **")顺便说一下:在JBoss-5中,我这样定义它:@Depends(value = "jboss.messaging.destination:service=Queue,name=my.test.queue")
发布于 2011-07-29 18:47:20
出现上述错误是因为我导入了错误的@Depends
import org.jboss.ejb3.annotation.Depends; //WRONG
import org.jboss.beans.metadata.api.annotations.Depends; //CORRECT发布于 2011-07-22 03:13:03
您应该能够使用以下Bean名称定义依赖项:
org.hornetq:module=JMS,type=Topic,name=“您的主题名称”
或
org.hornetq:module=JMS,type=Queue,name=“您的主题名称”
有关更多信息,请查看org.hornetq.api.core.management.ObjectNameBuilder,的实现,因为部署人员在这里使用方法来定义名称。
另外:这种MBeans之间的依赖关系只适用于AS6或EAP 5.1.1+。这不适用于AS5或任何其他手动安装,因为在手动安装中没有安装AS部署程序。
另外: AS7有一个不同的注入依赖。这可能在AS7上也不起作用。(我认为这是不必要的,因为您可以直接注入JNDI名称。也就是说,在AS7以一种更好的方式完成)
https://stackoverflow.com/questions/6774292
复制相似问题