I am running Tomcat which creates a DefaultMessageListenerContainer bean. For that it refers to the connectionFactory bean which uses the jndiTemplate bean which uses a path at which the imq/imq_admin_objects.
The bean definition is as follows
<bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="connectionFactory"/>
<property name="destination" ref="destination"/>
<property name="messageListener" ref="transactionMessageListener"/>
<property name="sessionTransacted" value="true"/>
<property name="concurrentConsumers" value="1"/>
</bean>
<!-- JMS configuration -->
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">
com.sun.jndi.fscontext.RefFSContextFactory
</prop>
<prop key="java.naming.provider.url">
file:///var/imq/imq_admin_objects
</prop>
</props>
</property>
</bean>
<bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref="jndiTemplate"/>
<property name="jndiName" value="factory"/>
</bean>
The problem is that no such folder is generated. I am using the Message Queue Broker 4.5 for the JMS. On running the service it only creates a var/mq directory. I am expecting it to generate an imq folder which will have the respective bindings file which will be used to create the JMS.
I believe your expectation here is incorrect. The file-system object store referenced for
com.sun.jndi.fscontext.RefFSContextFactorymust exist already. It doesn't create it for you. You have to create it and provide it so the bean can be initialized properly and the JNDI lookup can function.The binding file contains details like the JNDI lookup names as well as how to connect to the server across the network (e.g. hostname, port, etc.). Those details must be provided by an administrator. The JNDI implementation can't come up with them on its own.
If you browse the "Developer’s Guide for Java Clients" linked from the Open MQ 4.5 Documentation page and inspect chapter 2 titled "Using the Java API" you'll see this in the "Obtaining a Connection Factory" section:
Further down in the document you'll find an example of how to look up a connection factory object in the JNDI object store. This examples uses the file-system object store just as you are and it specifically notes:
In short, you must to create the administered file-system object store and make it publicly available so it can be used by JNDI clients.