Author |
Message
|
vincent_chow |
Posted: Tue Jun 15, 2010 9:31 pm Post subject: Not able to connect Qmgr in Java Destop Application |
|
|
Novice
Joined: 22 Apr 2009 Posts: 12
|
Hi, appreciate if anyone can help me to solve the issue. I need to develop a Java desktop application to monitor MQ Qmgrs. I can connect to the Qmgr in Java application but not in Java Desktop Application. Both are using the same code. The Qmgr is running and no problem with the listener, no firewall or connectivity issue.
Code: |
MQEnvironment.hostname = "172.20.40.151";
MQEnvironment.port = 1414;
MQEnvironment.channel = "SYSTEM.DEF.SVRCONN";
qMgr = new MQQueueManager("EAIQM");//I hit exception when reach this line
|
Error Message:
MQJE011: Socket connection attempt refused
MQJE001: An MQException occurred: Completion Code 2, Reason 2059
MQJE011: Socket connection attempt refused
com.ibm.mq.MQException: MQJE001: An MQException occurred: Completion Code 2, Reason 2059
MQJE011: Socket connection attempt refused
at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:212)
at com.ibm.mq.MQClientManagedConnectionFactoryJ11._createManagedConnection(MQClientManagedConnectionFactoryJ11.java:318)
at com.ibm.mq.MQClientManagedConnectionFactoryJ11.createManagedConnection(MQClientManagedConnectionFactoryJ11.java:338)
at com.ibm.mq.StoredManagedConnection.<init>(StoredManagedConnection.java:84)
at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:168)
at com.ibm.mq.MQQueueManagerFactory.obtainBaseMQQueueManager(MQQueueManagerFactory.java:772)
at com.ibm.mq.MQQueueManagerFactory.procure(MQQueueManagerFactory.java:697)
at com.ibm.mq.MQQueueManagerFactory.constructQueueManager(MQQueueManagerFactory.java:657)
at com.ibm.mq.MQQueueManagerFactory.createQueueManager(MQQueueManagerFactory.java:153)
at com.ibm.mq.MQQueueManager.<init>(MQQueueManager.java:451)
at testmq.TestMQView.TestM(TestMQView.java:103)
at testmq.TestMQView.<init>(TestMQView.java:40)
at testmq.TestMQApp.startup(TestMQApp.java:19)
at org.jdesktop.application.Application$1.run(Application.java:171)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121) |
|
Back to top |
|
 |
calanais |
Posted: Wed Jun 16, 2010 7:27 am Post subject: |
|
|
Apprentice
Joined: 12 Mar 2010 Posts: 32
|
Can you expand on what "Java Desktop Application" implies?
How is this different from running
java MyApp
from the command line?
That error implies that you have some connectivity issue. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jun 16, 2010 8:16 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Add the transport type to the MQEnvironment variable.
It may be that your application still tries to connect in bindings mode...
And use a proper SVRCONN channel, set up for the application. You should never use the default. In a lot of shops the connection will be refused by the default channels...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
vincent_chow |
Posted: Sun Jun 20, 2010 4:27 am Post subject: |
|
|
Novice
Joined: 22 Apr 2009 Posts: 12
|
calanais wrote: |
Can you expand on what "Java Desktop Application" implies?
How is this different from running
java MyApp
from the command line?
That error implies that you have some connectivity issue. |
Java Desktop Application can't run in command prompt. It is a GUI desktop application |
|
Back to top |
|
 |
mqjeff |
Posted: Sun Jun 20, 2010 1:43 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Perhaps as a "desktop"/gui application, this code is treated differently by the firewall than when it's run from the command prompt.
Perhaps as a "desktop" application, this code is treated differently by Java security than it is when run from the command prompt.
Your error says that either the connectivity information being passed to the MQ connection factory is wrong or that the MQ connection factory is not able to open a network level socket because something it preventing it. |
|
Back to top |
|
 |
vincent_chow |
Posted: Sun Jun 20, 2010 6:43 pm Post subject: |
|
|
Novice
Joined: 22 Apr 2009 Posts: 12
|
mqjeff wrote: |
Perhaps as a "desktop"/gui application, this code is treated differently by the firewall than when it's run from the command prompt.
Perhaps as a "desktop" application, this code is treated differently by Java security than it is when run from the command prompt.
Your error says that either the connectivity information being passed to the MQ connection factory is wrong or that the MQ connection factory is not able to open a network level socket because something it preventing it. |
Is there any solution to connect to MQ server in GUI application? Because the same code can be run in Java application/class. |
|
Back to top |
|
 |
vincent_chow |
Posted: Sun Jun 20, 2010 7:16 pm Post subject: |
|
|
Novice
Joined: 22 Apr 2009 Posts: 12
|
fjb_saper wrote: |
Add the transport type to the MQEnvironment variable.
It may be that your application still tries to connect in bindings mode...
And use a proper SVRCONN channel, set up for the application. You should never use the default. In a lot of shops the connection will be refused by the default channels...  |
I had tried to create another server connection channel, still fail.
I also tried to add in Transport Type in java code, not success too.
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY , MQC.TRANSPORT_MQSERIES_CLIENT); |
|
Back to top |
|
 |
calanais |
Posted: Mon Jun 21, 2010 12:09 am Post subject: |
|
|
Apprentice
Joined: 12 Mar 2010 Posts: 32
|
To reiterate mqjeff comments it does sound like this Desktop application is adding in some layer that is intercepting or at least some 'getting in the way'.
From my experience of GUI development, the very fact there is a GUI there shouldn't affect networking code.
I would really double check the setup in terms of everything networking both client and server side.
Matthew |
|
Back to top |
|
 |
|