jesse reim
jesse reim

Reputation: 21

new MQConnectionFactory() throws NullPointerException in JBoss

I am trying to execute the following command:

MQConnectionFactory connFactory = new MQConnectionFactory();

I get a null pointer exception that I can't seem to track down. I have attached the stack trace below.

java.lang.NullPointerException
  at com.ibm.msg.client.jms.internal.JmsFactoryFactoryImpl.getInstance(JmsFactoryFactoryImpl.java:169)
  at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.setProviderFactory(JmsConnectionFactoryImpl.java:165)
  at com.ibm.mq.jms.MQConnectionFactory.<init>(MQConnectionFactory.java:271)
  at com.foundation.agent.plugin.JMSClient.createConnection(JMSClient.java:154)
  at com.foundation.agent.plugin.JMSClient.launch(JMSClient.java:108)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)

I am loading the class that calls the new MQConectionFactory() using a class loader so I suspect that some JBoss JMS library is possibly causing this.

More info:

Jars:

Upvotes: 2

Views: 5145

Answers (3)

Pradeep Chintam
Pradeep Chintam

Reputation: 1

I faced the same issue even after adding all the required JARs. Finally the issue is resolved after changing my JDK from IBM JDK to Oracle/Sun JDK. looks like IBM JDK (standing alone) doesnt have enough things to create connection factory.

Upvotes: 0

Chris W.
Chris W.

Reputation: 2376

Decompiling the code for JmsFactoryFactoryImpl at line 169, you can see that there is a trace output some lines above. On my system with the same Exception as you had, the trace output on system err (Tomcat's catalina.out in my case) revealed the folllowing:

      WorkQueueMananger Contents
                           --------------------------

|   Maintain ThreadPool size     :-  false
|   Maximum ThreadPool size      :-  -1
|   ThreadPool inactive timeout  :-  0
|   unavailable -                :-  com.ibm.msg.client.commonservices.CSIException: JMSCS0002

And with that code you can go to: http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=%2Fcom.ibm.mq.javadoc.doc%2FWMQJMSClasses%2Ferrorcodes.html

Upvotes: 1

T.Rob
T.Rob

Reputation: 31832

You appear to be using v7.0.1.0 of WMQ. Have you configured your CLASSPATH as described in the v7 WMQ Using Java manual? Assuming a standard install, the only jar you need in the CLASSPATH at runtime is com.ibm.mqjms.jar. There's about 10 jars in the standard install I don't see in your list so I'm not sure if you listed what's in your CLASSPATH variable or what's in the java/lib but it's not the list I'd expect in either case. If you grabbed the jar files from somewhere, try using the full client install

Upvotes: 1

Related Questions