YK mar
YK mar

Reputation: 677

ERROR when creating a connectioFactory JMS websphere MQ

The native JNI library 'mqjbnd64' not found. please some one can help me to get mqjbnd64 this is my code

ConnectionFactory connectionFactory=null;
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory");
    env.put(Context.PROVIDER_URL, "file:/C:/CWMQv75-POT/JMS/JNDI Namespace");


    try{    
       Context ctx = new InitialContext(env);
      // MQQueueManager qm = (MQQueueManager)ctx.lookup("QM");
       MQConnectionFactory cf = (MQConnectionFactory) ctx.lookup("CF1");
     //  cf.createConnection().start();
       MQQueue q = (MQQueue) ctx.lookup("JMS1");
      connectionFactory = (ConnectionFactory)ctx.lookup("CF1");

        System.out.println("succes "+q.getBaseQueueManagerName().toString() + " " + q.getBaseQueueName()+" " +" " + cf.getChannel() );
    } catch (NamingException e)
    {
       System.err.println(e.getLocalizedMessage());
       e.printStackTrace();
    }
    Connection connection = connectionFactory.createConnection();
}

Upvotes: 0

Views: 2413

Answers (1)

Roger
Roger

Reputation: 7506

The native JNI library 'mqjbnd64' not found

Questions:

1) Are you running your JMS application on the SAME serer as the queue manager or a different server?

2) When you defined your QCF, did you include host, port #, channel name?

3) Do you understand the difference between connecting to a queue manager in bindings mode vs client mode?

You can ONLY connect in bindings mode if your application is running on the same server as the queue manager. When connecting in bindings mode the JMS/Java MQ library uses the native MQ library, hence, it needs the mqjbnd64 shared library or DLL on Windows to perform the MQ API calls.

Most MQ applications do NOT reside on the same server as the queue manager and they will use client mode to connect to the remote queue manager and your QCF would look something like:

DEFINE QCF(MYQCF) QMANAGER(MQWL1) CHANNEL(TESTCHL) HOSTNAME(10.10.10.10) PORT(1414) TRANSPORT(CLIENT) FAILIFQUIESCE(YES)

One other thing I noticed:

env.put(Context.PROVIDER_URL, "file:/C:/CWMQv75-POT/JMS/JNDI Namespace");

that should be:

env.put(Context.PROVIDER_URL, "file://C:/CWMQv75-POT/JMS/JNDI Namespace");

You should have 2 forward slashes "//" after "file:".

Upvotes: 2

Related Questions