Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I ensure that the hornet queues are there when my webapp starts in JBOSS 6.0?
    text
    copied!<p>previous title was:</p> <p><strong>How do I get a JNDI reference to a queue within JBOSS 6 using Spring?</strong></p> <p>I configured a JMS queue like this, which is in a file mytopic-hornetq-jms.xml:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;configuration xmlns="urn:hornetq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd"&gt; &lt;topic name="mytopic"&gt; &lt;entry name="mytopic"/&gt; &lt;/topic&gt; &lt;/configuration&gt; </code></pre> <p>My applicationContext.xml looks like this:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"&gt; &lt;jee:jndi-lookup id="jmsConnectionFactory" jndi-name="java:/JmsXA" /&gt; &lt;jee:jndi-lookup id="jmsDestination" jndi-name="mytopic" expected-type="javax.jms.Topic" /&gt; &lt;/beans&gt; </code></pre> <p>This is the output using the JMX Console org.jboss.naming.JNDIView:</p> <pre><code> +- UserTransactionSessionFactory (proxy: $Proxy103 implements interface org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory) +- UUIDKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactory) +- HiLoKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.hilo.HiLoKeyGeneratorFactory) +- SecureDeploymentManager (class: org.jnp.interfaces.NamingContext) | +- remote[link -&gt; DeploymentManager] (class: javax.naming.LinkRef) +- SecureManagementView (class: org.jnp.interfaces.NamingContext) | +- remote[link -&gt; ManagementView] (class: javax.naming.LinkRef) +- mytopic (class: org.hornetq.jms.client.HornetQTopic) +- DeploymentManager (class: org.jboss.aop.generatedproxies.AOPProxy$4) +- XAConnectionFactory (class: org.hornetq.jms.client.HornetQConnectionFactory) +- ProfileService (class: org.jboss.aop.generatedproxies.AOPProxy$2) +- SecureProfileService (class: org.jnp.interfaces.NamingContext) | +- remote[link -&gt; ProfileService] (class: javax.naming.LinkRef) +- queue (class: org.jnp.interfaces.NamingContext) | +- DLQ (class: org.hornetq.jms.client.HornetQQueue) | +- ExpiryQueue (class: org.hornetq.jms.client.HornetQQueue) +- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction) +- ConnectionFactory (class: org.hornetq.jms.client.HornetQConnectionFactory) +- jmx (class: org.jnp.interfaces.NamingContext) | +- invoker (class: org.jnp.interfaces.NamingContext) | | +- RMIAdaptor (class: javax.management.MBeanServerConnection) | +- rmi (class: org.jnp.interfaces.NamingContext) | | +- RMIAdaptor (class: javax.management.MBeanServerConnection) +- BeanValidatorFactories (class: org.jnp.interfaces.NamingContext) +- TomcatAuthenticators (class: java.util.Properties) +- XAThroughputConnectionFactory (class: org.hornetq.jms.client.HornetQConnectionFactory) +- ManagementView (class: org.jboss.aop.generatedproxies.AOPProxy$3) +- ThroughputConnectionFactory (class: org.hornetq.jms.client.HornetQConnectionFactory) </code></pre> <p>which in my book means, the topic is bound to the JNDI name "mytopic"</p> <p>Nevertheless does Spring throw </p> <pre><code>18:45:29,636 ERROR [ContextLoader] Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsDestination': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: mytopic not bound ... Caused by: javax.naming.NameNotFoundException: mytopic not bound at org.jnp.server.NamingServer.getBinding(NamingServer.java:771) [:5.0.5.Final] at org.jnp.server.NamingServer.getBinding(NamingServer.java:779) [:5.0.5.Final] at org.jnp.server.NamingServer.getObject(NamingServer.java:785) [:5.0.5.Final] at org.jnp.server.NamingServer.lookup(NamingServer.java:443) [:5.0.5.Final] </code></pre> <p><strong>UPDATE</strong></p> <p>It seems, that it is not actually a problem looking up the JNDI reference, but actually that the hornet queues are not configured at the time when the application starts.</p> <p>If I deploy the application some time later, it will run just fine, because at this time the hornet queues <em>are</em> configured.</p> <p>Is there a way to specify that the application will not start untill the queues are, or is the a configuration option for the jboss to hold of deployment until the rest is started?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload