Using Websphere MQ Explorer, I have created a new file system
based initial context
for JMS. Using the new initial context, I have created a JMS queue to connect to an existing queue (currently accessed using a non java based framework).
Within the application code, I can succesfully connect to the context, as follows:
properties.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory");
properties.put(Context.PROVIDER_URL, "file:C://folder-name//");
try {
val ctx = new InitialContext(properties)
Next, I create a QueueConnectionFactory:
val qcf = (ctx.lookup("com.ibm.mq.jms.MQQueueFactory")).asInstanceOf[QueueConnectionFactory]
However, this throws the following exception:
javax.naming.NameNotFoundException: com.ibm.mq.jms.MQQueueFactory
at com.sun.jndi.fscontext.RefFSContext.getObjectFromBindings(RefFSContext.java:400)
at com.sun.jndi.fscontext.RefFSContext.lookupObject(RefFSContext.java:327)
at com.sun.jndi.fscontext.RefFSContext.lookup(RefFSContext.java:146)
at com.sun.jndi.fscontext.FSContext.lookup(FSContext.java:127)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
I used com.ibm.mq.jms.MQQueueFactory
as the connection factory name, because in the .bindings
file, there is the following line:
MY.QUEUE/FactoryName=com.ibm.mq.jms.MQQueueFactory
But that throws an exception.
Where would the correct connection factory name be defined?
Thanks