Warm tip: This article is reproduced from serverfault.com, please click

javax.naming.NameNotFoundException: java:jboss/jms/exampleApp/SampleQueueIn

发布于 2020-12-03 09:52:26

We are migrating from JBoss EAP 6.4 to JBoss EAP 7.0. Our earlier JMS configuration is not working with JBoss 7.0 where it is throwing NameNotFoundException for my JMS beans

my jms.xml

<beans profile="jboss">
    <bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
      <property name="jndiName" value="java:jboss/jms/exampleApp/ConnectionFactory" />
      <property name="resourceRef" value="true" />
    </bean>

    <bean id="SampleQueueIn" class="org.springframework.jndi.JndiObjectFactoryBean">
      <property name="jndiName" value="java:jboss/jms/exampleApp/SampleQueueIn" />
      <property name="resourceRef" value="true" />
    </bean>

  </beans>

My messageListener.xml

<beans profile="jboss">
    <!-- Abstract MessageListener -->
    <bean id="messageListener" abstract="true" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
      <property name="connectionFactory" ref="connectionFactory" />
      <property name="transactionManager" ref="transactionManager" />
      <property name="sessionTransacted" value="true" />
      <!-- Receive timeout determines the duration of JMS session. Increase from default 1sec to 5sec, to lower the traffic to Queue managers -->
      <property name="receiveTimeout" value="5000" />
    </bean>

  </beans>

my proxy-domain componentContext.xml which has listener beans

  <beans profile="jboss">
     <bean id="jmsContainer" parent="messageListener">
      <property name="destination" ref="SampleQueueIn" />
      <property name="messageListener" ref="sampleInformationListenerImpl" />
    </bean> 
  </beans>

commands.cli part for adding admin objects for wmq

/subsystem=resource-adapters/resource-adapter=${wmq_deploy_name}:activate
    /subsystem=resource-adapters/resource-adapter=${wmq_deploy_name}/admin-objects=SampleQueueIn:add(class-name=com.ibm.mq.connector.outbound.MQQueueProxy,jndi-name=java:jboss/jms/exampleApp/SampleQueueIn)
    /subsystem=resource-adapters/resource-adapter=${wmq_deploy_name}/admin-objects=SampleQueueIn/config-properties=baseQueueName/:add(value=${filter_jms_queue_config_SampleQueueIn_basequeuename})
    /subsystem=resource-adapters/resource-adapter=${wmq_deploy_name}/admin-objects=SampleQueueIn/config-properties=baseQueueManagerName/:add(value=${filter_jms_queue_config_basequeuemanager})

I can see my admin objects in the JBoss for wmq under sub resources with correct jndi-name also.

I am using IBM wmq v9.1.0.2.

[EDIT] Once I deploy my WAR file, I am getting the below exception

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SampleQueueIn' defined in class path resource [jms.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: jms/exampleApp/SampleQueueIn-- service jboss.naming.context.java.jboss.jms.exampleApp.SampleQueueIn

This configuration was working(still working) in jboss eap 6.4.

I have scourged jboss developer sites & stackoverflow sites but no avail till now!

I can see that my

Questioner
user1734698
Viewed
0
user1734698 2020-12-07 16:44:19

I resolved the error with reload of JBoss server after running the CLI commands. I automated the execution of both jboss cli commands & reload commands to make sure that the JNDI objects lookup is successful.