如何配置JBoss服务的启动顺序(JmsActivation)

时间:2009-03-24 20:20:02

标签: jboss ejb-3.0 jbossmq

当我在JBoss 5上部署我的应用程序时,会在QueueService启动之前创建EJB。现在,消息驱动bean的创建失败了,因为队列尚不可用:

17:11:29,151 INFO  [EJBContainer] STARTED EJB: .....
17:11:29,266 INFO  [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:
..
..
17:11:29,928 WARN  [JmsActivation] Failure in jms activation org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@11694c ...
javax.naming.NameNotFoundException: ... not bound
    at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
    at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
    at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
    at org.jnp.server.NamingServer.lookup(NamingServer.java:443)
    at org.jnp.server.NamingServer.lookup(NamingServer.java:399)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:722)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:682)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at org.jboss.util.naming.Util.lookup(Util.java:222)
    at org.jboss.resource.adapter.jms.inflow.JmsActivation.setupDestination(JmsActivation.java:464)
    at org.jboss.resource.adapter.jms.inflow.JmsActivation.setup(JmsActivation.java:352)
    at org.jboss.resource.adapter.jms.inflow.JmsActivation$SetupActivation.run(JmsActivation.java:729)
    at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:213)
    at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:260)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)
17:11:30,027 INFO  [QueueService] Queue[/queue/....] started, fullSize=200000, pageSize=2000, downCacheSize=2000

如何配置部署顺序?

2 个答案:

答案 0 :(得分:1)

自己找到答案。我在消息驱动bean中添加了以下注释:

@Depends({"jboss.messaging.destination:service=Topic,name=XxxxTopic"})

答案 1 :(得分:1)

<?xml version="1.0" encoding="UTF-8"?>

<!--
     Null persistence config.

     Use this if you don't actually want to persist anything

     $Id$
 -->

<server>

   <!-- Persistence Manager MBean configuration
       ======================================== -->

   <mbean code="org.jboss.messaging.core.jmx.NullPersistenceManagerService"
      name="jboss.messaging:service=PersistenceManager"
      xmbean-dd="xmdesc/NullPersistenceManager-xmbean.xml"/>

   <!-- Messaging Post Office MBean configuration
        ========================================= -->

   <mbean code="org.jboss.messaging.core.jmx.MessagingPostOfficeService"
      name="jboss.messaging:service=PostOffice"
      xmbean-dd="xmdesc/MessagingPostOffice-xmbean.xml">

      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
      <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends>

      <!-- The name of the post office -->

      <attribute name="PostOfficeName">JMS post office</attribute>

      <!-- This post office is clustered. If you don't want a clustered post office then set to false -->

      <attribute name="Clustered">false</attribute>

   </mbean>

   <!-- Messaging JMS User Manager MBean config
        ======================================= -->

   <mbean code="org.jboss.jms.server.plugin.JDBCJMSUserManagerService"
      name="jboss.messaging:service=JMSUserManager"
      xmbean-dd="xmdesc/JMSUserManager-xmbean.xml">
        <depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager</depends> 
   </mbean>

</server>

将其保存为'null-persistence-service.xml'并将此部署/消息传递/

现在它将起作用