0

I got a MQFTE job that move a file from one Agent to another Agent. Once the file has been moved, the file gets split into individual messages by the MQFTE Agent.

Once the split has been done, the messages needs to be moved form one queue to another queue by a user exit. The user exit is implemented by implementing the DestinationTransferEndExit interface.

The issue is that I can't get a handle to the QueueManager in a bindings mode. If I execute the code outside the Agent JVM it works without any issues.

I get the following error:

[01/03/2015 13:46:31:107 SAST] 0000001d StdErr        E   com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2495'.

.

.

.

[01/03/2015 13:46:31:115 SAST] 0000001d StdErr        E   Caused by: com.ibm.mq.jmqi.local.LocalMQ$3: CC=2;RC=2495;AMQ8598: Failed to load the WebSphere MQ native JNI library: 'mqjbnd'.

.

.

.

[01/03/2015 13:46:31:117 SAST] 0000001d StdErr        E   Caused by: java.lang.UnsatisfiedLinkError: mqjbnd (Library is already loaded in another ClassLoader)

The code that I execute is as follow:

  MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY, 
            MQC.TRANSPORT_MQSERIES_BINDINGS);
  MQQueueManager sourceMgr = new MQQueueManager(aQManagerName); 
  int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT ; 
  MQQueue source_queue = sourceMgr.accessQueue(aSourceQName, openOptions);
Matt
  • 14,906
  • 27
  • 99
  • 149

1 Answers1

0

The issue here is that the "mqjbnd" native library from your WebSphere MQ installation has already been loaded by by the Java ClassLoader associated with the WebSphere MQ MFT agent. The mqjbnd library contains the native JNI code that allows the agent to connect to a queue manager using the BINDINGS (shared memory) transport mode.

Your DestinationTransferEndExit code, however, is being loaded on a separate Java ClassLoader. The Java virtual machine (JVM) allows only one ClassLoader to load a particular native library. Therefore, when your exit codes attempts to load the mqjbnd library (that has already been loaded) the JVM throws an java.lang.UnsatisfiedLinkError.

You can avoid this issue by not attempting to load the native mqjbnd library in your exit code and use the CLIENT transport mode to connect to your queue manager instead.

a_cornish_pasty
  • 816
  • 4
  • 10