0
votes

Using Websphere MQ Explorer, I have created a new file system based initial contextfor 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

1
What MQ jar files are in the class path?Matt Pavlovich
com.ibm.mqmqjms-7.5.0.2, com.ibm.mq,jmqi.7.5.0.2, com.ibm.mq.commonservices.jar.7.0.1.4user1052610
Mix and matching MQ jars is not advisable (7.5.0.2 mixed with 7.0.1.4). Be sure to use jar files from the same revision-- e.g. 7.5.0.2 all the way.Matt Pavlovich

1 Answers

0
votes

Problem solved - under the file based context (under JMS Administered Objects), a Connection Factory must be defined.