I have problem with a JMS MessageListener. My bean (MessageQueueListener) implements the MessageListener interface. I then have a remote queue that my bean should listen for new messages on. However, when I start my application (a webapp in JBoss 4), I get a the following error:
The strange thing is that when I do all the lookup programmatically (with the same values as below) and query the queue synchronously, everything works. My Spring configuration for the asynchronous message listener looks like this:Code:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsDestination' defined in ServletContext resource [/WEB-INF/applicationContext-hibernate.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: not bound Caused by: javax.naming.NameNotFoundException: not bound at org.jnp.server.NamingServer.getBinding(NamingServer.java:529) at org.jnp.server.NamingServer.getBinding(NamingServer.java:537) at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
Anyone have any idea what I'm doing wrong?Code:<bean id="messageListener" class="com.company.jms.MessageQueueListener"> <property name="chId" value="84527"/> <property name="manager" ref="managerProxy"/> </bean> <bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiEnvironment"> <props> <prop key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop> <prop key="java.naming.provider.url">jnp://remote.server.com:1099</prop> <prop key="java.naming.factory.url.pkgs">org.jnp.interfaces:org.jboss.naming</prop> <prop key="java.naming.security.principal">username</prop> <prop key="java.naming.security.credentials">password</prop> </props> </property> <property name="jndiName" value="java:/ConnectionFactory"/> <property name="resourceRef" value="true"/> </bean> <bean id="jmsDestination" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="/queue/RemoteQueue"/> <property name="resourceRef" value="true"/> </bean> <bean id="listenerContainer" class="org.springframework.jms.listener.SimpleMessageListenerContainer"> <property name="concurrentConsumers" value="1"/> <property name="connectionFactory" ref="connectionFactory"/> <property name="destination" ref="jmsDestination"/> <property name="messageListener" ref="messageListener"/> </bean>
Thanks in advance!
// Erik


Reply With Quote
