Topic
  • 1 reply
  • Latest Post - ‏2013-01-16T15:22:57Z by mbw
raefkandeel
raefkandeel
1 Post

Pinned topic Cannot connect to WebSphere MQ through WAS connection factor

‏2013-01-16T08:58:23Z |
I have the following code :-

code
import java.util.Properties;
import javax.jms.ConnectionFactory;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class LoanAccountFactory {
public static ConnectionFactory connectionFactoryWebSphereMQ()
{
java.util.Properties config = new Properties();
config.setProperty("java.naming.provider.url", "iiop:localhost:2809");//url malformed because of forum restrictions
config.setProperty("java.naming.factory.initial", "com.ibm.websphere.naming.WsnInitialContextFactory");
config.setProperty("java.naming.security.authentication", "none");
config.setProperty("java.naming.security.credentials", "");
config.setProperty("java.naming.security.principal", "");
javax.naming.InitialContext context = null;
try {
System.out.println("hello1");
context = new InitialContext(config);
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace(System.out);
}
ConnectionFactory connectionFactory = null;
try {
System.out.println("hello2");
System.out.println (context.lookup("jms/sitConnectionFactory"));
System.out.println("hello3");
connectionFactory = (ConnectionFactory) context.lookup("jms/custAcctInfoReq");
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace(System.out);
}// connection factory name

return connectionFactory;
}
public static void main (String [] args) {
connectionFactoryWebSphereMQ();
}
}
[/code]
I have the following jars included in the classpath:-


com.ibm.jaxws.thinclient_7.0.0.jar
com.ibm.mq.commonservices.jar
com.ibm.mq.headers.jar
com.ibm.mq.jar
com.ibm.mq.jmqi.jar
com.ibm.jmqi.system.jar
com.ibm.mqjms.jar
com.ibm.msg.client.commonservices.jar
com.ibm.msg.client.jms.internal.jar
com.ibm.msg.client.jms.jar
com.ibm.msg.client.provider.jar
com.ibm.ws.admin.client_7.0.0.jar
com.ibm.ws.ejb.thinclient_7.0.0.jar
com.ibm.ws.jpa.thinclient_7.0.0.jar
com.ibm.ws.messagingClient.jar
com.ibm.ws.orb_7.0.0.jar
com.ibm.ws.messagingClient.jar
com.ibm.ws.orb_7.0.0.jar
com.ibm.ws.sib.client.thin.jms_7.0.0.jar
com.ibm.ws.webservices.thinclient_7.0.0.jar
ejb3exceptions.jar

I have the following Connection Factory defined on the Cell Level:-

jms/sitConnectionFactory: Testing Connection Successful

I have the following Activation Specification defined on the Cell Level:-

jms/sitActivationSpecification Test Connection Successful

I have the following Queue defined on the Cell Level:-

jms/custAcctInfoReq

It produces the following logs and exceptions:-

code
hello1
hello2
FFDC called in uninitialized Trace module

FDCTitle
Product :- ProductName
Date/Time :- Tue Jan 15 15:53:30 AST 2013
System time :- 1358254410127
Operating System :- Windows 7
UserID :- user
Java Vendor :- Sun Microsystems Inc.
Java Version :- 20.8-b03

Source Class :- com.ibm.msg.client.commonservices.nls.PINLSServices
Source Method :- createException(String,HashMap)
ProbeID :- XC003001
Thread :- name=P=409425:O=0:CT priority=5 group=main ccl=sun.misc.Launcher$AppClassLoader@35ce36

Data
----

Data :- none

Version information


Java Message Service Client
7.0.1.6
k701-106-110721
Production

WebSphere MQ classes for Java Message Service
7.0.0.0
k700-L080820
Production

Stack trace


Stack trace to show the location of the FFST call
| FFST Location :- java.lang.Exception
| at com.ibm.msg.client.commonservices.trace.Trace.getCurrentPosition(Trace.java:1854)
| at com.ibm.msg.client.commonservices.trace.Trace.createFFSTString(Trace.java:1793)
| at com.ibm.msg.client.commonservices.trace.Trace.ffstInternal(Trace.java:1674)
| at com.ibm.msg.client.commonservices.trace.Trace.ffst(Trace.java:1491)
| at com.ibm.msg.client.commonservices.nls.PINLSServices.createException(PINLSServices.java:115)
| at com.ibm.msg.client.commonservices.nls.NLSServices.createException(NLSServices.java:388)
| at com.ibm.msg.client.jms.internal.JmsErrorUtils.createException(JmsErrorUtils.java:104)
| at com.ibm.msg.client.jms.internal.JmsFactoryFactoryImpl.getInstance(JmsFactoryFactoryImpl.java:167)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
| at java.lang.reflect.Method.invoke(Unknown Source)
| at com.ibm.msg.client.jms.JmsFactoryFactory.getInstance(JmsFactoryFactory.java:177)
| at com.ibm.mq.jms.MQConnectionFactory.initialiseMQConnectionFactory(MQConnectionFactory.java:3234)
| at com.ibm.mq.jms.MQConnectionFactory.<init>(MQConnectionFactory.java:233)
| at com.ibm.mq.jms.MQXAConnectionFactory.<init>(MQXAConnectionFactory.java:72)
| at com.ibm.mq.jms.MQXAConnectionFactoryFactory.getObjectInstance(MQXAConnectionFactoryFactory.java:77)
| at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
| at com.ibm.ejs.jms.JMSConnectionFactoryFactory.getObjectInstance(JMSConnectionFactoryFactory.java:191)
| at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
| at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:927)
| at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookup(Helpers.java:730)
| at com.ibm.ws.naming.jndicos.CNContextImpl.processResolveResults(CNContextImpl.java:3691)
| at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1861)
| at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1762)
| at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1513)
| at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:645)
| at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:166)
| at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:180)
| at javax.naming.InitialContext.lookup(Unknown Source)
| at LoanAccountFactory.connectionFactoryWebSphereMQ(LoanAccountFactory.java:33)
| at LoanAccountFactory.main(LoanAccountFactory.java:44)
|

Property Store Contents


All currently set properties
| MQJMS_TRACE_DIR :-
| MQJMS_TRACE_LEVEL :-
| awt.toolkit :- sun.awt.windows.WToolkit
| com.ibm.mq.localAddress :-
| com.ibm.msg.client.commonservices.ffst.suppress :- 0
| file.encoding :- Cp1252
| file.encoding.pkg :- sun.io
| file.separator :- \
| java.awt.graphicsenv :- sun.awt.Win32GraphicsEnvironment
| java.awt.printerjob :- sun.awt.windows.WPrinterJob
| java.class.path :- C:\Users\user\xxxWSnew\Test\bin;C:\DocumentationAndResources\XXX\Code\Jars\MQjars\ThinClientJMS\com.ibm.jaxws.thinclient_7.0.0.jar;C:\DocumentationAndResources\XXX\Code\Jars\MQjars\ThinClientJMS\com.ibm.mq.commonservices.jar;C:\DocumentationAndResources\XXX\Code\Jars\MQjars\ThinClientJMS\com.ibm.mq.jmqi.system.jar;C:\DocumentationAndResources\XXX\Code\Jars\MQjars\ThinClientJMS\com.ibm.mq.jmqi.jar;C:\DocumentationAndResources\XXX\Code\Jars\MQjars\ThinClientJMS\com.ibm.mq.jar;C:\DocumentationAndResources\XXX\Code\Jars\MQjars\ThinClientJMS\com.ibm.mq.headers.jar;C:\DocumentationAndResources\XXX\Code\Jars\MQjars\ThinClientJMS\com.ibm.msg.client.jms.jar;C:\DocumentationAndResources\XXX\Code\Jars\MQjars\ThinClientJMS\com.ibm.msg.client.provider.jar;C:\DocumentationAndResources\XXX\Code\Jars\MQjars\ThinClientJMS\com.ibm.msg.client.jms.internal.jar;C:\DocumentationAndResources\XXX\Code\Jars\MQjars\ThinClientJMS\com.ibm.msg.client.commonservices.jar;C:\DocumentationAndResources\XXX\Code\Jars\MQjars\ThinClientJMS\com.ibm.mqjms.jar;C:\DocumentationAndResources\XXX\Code\Jars\MQjars\ThinClientJMS\com.ibm.ws.admin.client_7.0.0.jar;C:\DocumentationAndResources\XXX\Code\Jars\MQjars\ThinClientJMS\com.ibm.ws.ejb.thinclient_7.0.0.jar;C:\DocumentationAndResources\XXX\Code\Jars\MQjars\ThinClientJMS\com.ibm.ws.jpa.thinclient_7.0.0.jar;C:\DocumentationAndResources\XXX\Code\Jars\MQjars\ThinClientJMS\com.ibm.ws.messagingClient.jar;C:\DocumentationAndResources\XXX\Code\Jars\MQjars\ThinClientJMS\com.ibm.ws.orb_7.0.0.jar;C:\DocumentationAndResources\XXX\Code\Jars\MQjars\ThinClientJMS\com.ibm.ws.sib.client.thin.jms_7.0.0.jar;C:\DocumentationAndResources\XXX\Code\Jars\MQjars\ThinClientJMS\com.ibm.ws.sib.client_ExpeditorDRE_7.0.0.jar;C:\DocumentationAndResources\XXX\Code\Jars\MQjars\ThinClientJMS\com.ibm.ws.webservices.thinclient_7.0.0.jar;C:\DocumentationAndResources\XXX\Code\Jars\MQjars\ThinClientJMS\ejb3exceptions.jar
| java.class.version :- 50.0
| java.endorsed.dirs :- D:\java\jre6\lib\endorsed
| java.ext.dirs :- D:\java\jre6\lib\ext;C:\Windows\Sun\Java\lib\ext
| java.home :- D:\java\jre6
| java.io.tmpdir :- C:\Users\user\AppData\Local\Temp\
| java.library.path :- D:\java\jre6\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;D:/java/jre6/bin/client;D:/java/jre6/bin;D:/java/jre6/lib/i386;C:\Program Files\IBM\WebSphere MQ\java\lib;D:\Oracle\product\11.2.0\RBhome\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\DMIX;D:\java\jdk1.6.0_33\bin;C:\Software\apache-maven-3.0.4-bin\apache-maven-3.0.4\bin;C:\Program Files\IBM\WebSphere MQ\bin;C:\Program Files\IBM\WebSphere MQ\tools\c\samples\bin;C:\Software\xxx-pegasus-sdk\xxx-pegasus-sdk;.
| java.runtime.name :- Java(TM) SE Runtime Environment
| java.runtime.version :- 1.6.0_33-b05
| java.specification.name :- Java Platform API Specification
| java.specification.vendor :- Sun Microsystems Inc.
| java.specification.version :- 1.6
| java.vendor :- Sun Microsystems Inc.
| java.vendor.url :- http:java.sun.com/
| java.vendor.url.bug :- http:java.sun.com/cgi-bin/bugreport.cgi
| java.version :- 1.6.0_33
| java.vm.info :- mixed mode, sharing
| java.vm.name :- Java HotSpot(TM) Client VM
| java.vm.specification.name :- Java Virtual Machine Specification
| java.vm.specification.vendor :- Sun Microsystems Inc.
| java.vm.specification.version :- 1.0
| java.vm.vendor :- Sun Microsystems Inc.
| java.vm.version :- 20.8-b03
| javax.rmi.CORBA.UtilClass :- com.ibm.ws.orb.WSUtilDelegateImpl
| line.separator :-

| os.arch :- x86
| os.name :- Windows 7
| os.version :- 6.1
| path.separator :- ;
| sun.arch.data.model :- 32
| sun.boot.class.path :- D:\java\jre6\lib\resources.jar;D:\java\jre6\lib\rt.jar;D:\java\jre6\lib\sunrsasign.jar;D:\java\jre6\lib\jsse.jar;D:\java\jre6\lib\jce.jar;D:\java\jre6\lib\charsets.jar;D:\java\jre6\lib\modules\jdk.boot.jar;D:\java\jre6\classes
| sun.boot.library.path :- D:\java\jre6\bin
| sun.cpu.endian :- little
| sun.cpu.isalist :- pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86
| sun.desktop :- windows
| sun.io.unicode.encoding :- UnicodeLittle
| sun.java.command :- LoanAccountFactory
| sun.java.launcher :- SUN_STANDARD
| sun.jnu.encoding :- Cp1252
| sun.management.compiler :- HotSpot Client Compiler
| sun.os.patch.level :- Service Pack 1
| user.country :- US
| user.dir :- C:\Users\user\XxxWSnew\Test
| user.home :- C:\Users\user
| user.language :- en
| user.name :- user
| user.timezone :- Asia/Riyadh
| user.variant :-

WorkQueueMananger Contents


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

Runtime properties


| Available processors :- 4
| Free memory in bytes (now) :- 11243720
| Max memory in bytes :- 259522560
| Total memory in bytes (now) :- 16252928

Component Manager Contents


Common Services Components:
Messaging Provider Components:
FFDC called in uninitialized Trace module

FDCTitle
Product :- ProductName
Date/Time :- Tue Jan 15 15:53:30 AST 2013
System time :- 1358254410128
Operating System :- Windows 7
UserID :- user
Java Vendor :- Sun Microsystems Inc.
Java Version :- 20.8-b03

Source Class :- JmsFactoryFactory
Source Method :- getIntance(int)
ProbeID :- XI001005
Thread :- name=P=409425:O=0:CT priority=5 group=main ccl=sun.misc.Launcher$AppClassLoader@35ce36

Data
----

| connectionTypeName :- com.ibm.msg.client.wmq
| exception :- ExceptionDepth is 3
| exception :-
| | Cause:1 :- java.lang.reflect.InvocationTargetException
| | Cause:2 :- java.lang.NullPointerException
| | StackTrace:1 :- java.lang.reflect.InvocationTargetException
| | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| | at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
| | at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
| | at java.lang.reflect.Method.invoke(Unknown Source)
| | at com.ibm.msg.client.jms.JmsFactoryFactory.getInstance(JmsFactoryFactory.java:177)
| | at com.ibm.mq.jms.MQConnectionFactory.initialiseMQConnectionFactory(MQConnectionFactory.java:3234)
| | at com.ibm.mq.jms.MQConnectionFactory.<init>(MQConnectionFactory.java:233)
| | at com.ibm.mq.jms.MQXAConnectionFactory.<init>(MQXAConnectionFactory.java:72)
| | at com.ibm.mq.jms.MQXAConnectionFactoryFactory.getObjectInstance(MQXAConnectionFactoryFactory.java:77)
| | at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
| | at com.ibm.ejs.jms.JMSConnectionFactoryFactory.getObjectInstance(JMSConnectionFactoryFactory.java:191)
| | at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
| | at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:927)
| | at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookup(Helpers.java:730)
| | at com.ibm.ws.naming.jndicos.CNContextImpl.processResolveResults(CNContextImpl.java:3691)
| | at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1861)
| | at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1762)
| | at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1513)
| | at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:645)
| | at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:166)
| | at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:180)
| | at javax.naming.InitialContext.lookup(Unknown Source)
| | at LoanAccountFactory.connectionFactoryWebSphereMQ(LoanAccountFactory.java:33)
| | at LoanAccountFactory.main(LoanAccountFactory.java:44)
| | Caused by: java.lang.NullPointerException
| | at com.ibm.msg.client.jms.internal.JmsFactoryFactoryImpl.getInstance(JmsFactoryFactoryImpl.java:169)
| | ... 24 more
| |
| | StackTrace:2 :- java.lang.NullPointerException
| | at com.ibm.msg.client.jms.internal.JmsFactoryFactoryImpl.getInstance(JmsFactoryFactoryImpl.java:169)
| | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| | at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
| | at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
| | at java.lang.reflect.Method.invoke(Unknown Source)
| | at com.ibm.msg.client.jms.JmsFactoryFactory.getInstance(JmsFactoryFactory.java:177)
| | at com.ibm.mq.jms.MQConnectionFactory.initialiseMQConnectionFactory(MQConnectionFactory.java:3234)
| | at com.ibm.mq.jms.MQConnectionFactory.<init>(MQConnectionFactory.java:233)
| | at com.ibm.mq.jms.MQXAConnectionFactory.<init>(MQXAConnectionFactory.java:72)
| | at com.ibm.mq.jms.MQXAConnectionFactoryFactory.getObjectInstance(MQXAConnectionFactoryFactory.java:77)
| | at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
| | at com.ibm.ejs.jms.JMSConnectionFactoryFactory.getObjectInstance(JMSConnectionFactoryFactory.java:191)
| | at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
| | at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:927)
| | at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookup(Helpers.java:730)
| | at com.ibm.ws.naming.jndicos.CNContextImpl.processResolveResults(CNContextImpl.java:3691)
| | at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1861)
| | at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1762)
| | at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1513)
| | at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:645)
| | at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:166)
| | at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:180)
| | at javax.naming.InitialContext.lookup(Unknown Source)
| | at LoanAccountFactory.connectionFactoryWebSphereMQ(LoanAccountFactory.java:33)
| | at LoanAccountFactory.main(LoanAccountFactory.java:44)
 

[/code]

Version information
Name: WebSphere MQ
Version: 7.1.0.0
Level: p000-L111019

Name: IBM Message Service Client for .NET (XMS .NET)
Version: 2.1.0.0

Name IBM WebSphere Application Server - ND
Version 7.0.0.21
ID ND

What could be the cause of the problem?
Updated on 2013-01-16T15:22:57Z at 2013-01-16T15:22:57Z by mbw
  • mbw
    mbw
    50 Posts

    Re: Cannot connect to WebSphere MQ through WAS connection factor

    ‏2013-01-16T15:22:57Z  
    Could you give some more context please about what you are trying to achieve? Are you trying to use WAS as a JNDI Provider but running an application in a Java SE (command-line style) context.

    Be advised that some of the JAR files you've there are not from a standard WMQ JMS Client installation.
    Matthew B White
    http://about.me/matthewbwhite