Author |
Message
|
psiracusa |
Posted: Wed Dec 12, 2007 6:01 am Post subject: Another java.lang.UnsatisfiedLinkError: no mqjbnd05 in java |
|
|
Apprentice
Joined: 17 Nov 2006 Posts: 34
|
I'm a little stumped by this problem. I'm rolling out the mq client to some of our developer's desktops and I am able to connect to a queue manager, run the sample put/get programs (amqsputc etc.) as well as the sample java mq test program, mqivp. All ran fine so it appears all the environment variables are correct. I then ported the java source code from one of our servers to their desktops and recompiled and ran and it came back with this mqjbnd05 error. Why would the sample java program that IBM provides run but when I attempt to execute my own code, which runs fine on multiple server environments then not work? I've added all jars in the mq java lib to the classpath in an attempt to fix the problem and checked the lib_path. No dice. Any thoughts would be appreciated. |
|
Back to top |
|
 |
bower5932 |
Posted: Wed Dec 12, 2007 6:06 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
You can search here on mqjbnd05 and get numerous hits. My guess is that you are attempting to connect in bindings mode from a client and it's not working. It probably worked on your other systems because you had the full qmgr installed. |
|
Back to top |
|
 |
psiracusa |
Posted: Wed Dec 12, 2007 6:30 am Post subject: |
|
|
Apprentice
Joined: 17 Nov 2006 Posts: 34
|
Thanks for the reply. How do I change the program to connect not using binding mode? |
|
Back to top |
|
 |
Vitor |
Posted: Wed Dec 12, 2007 6:35 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
psiracusa wrote: |
Thanks for the reply. How do I change the program to connect not using binding mode? |
IIRC change the transport type and supply the client connection details. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
psiracusa |
Posted: Wed Dec 12, 2007 7:21 am Post subject: |
|
|
Apprentice
Joined: 17 Nov 2006 Posts: 34
|
Got it.
For anyone searching this in the future, to enable the client connections in a java program you must enter these lines in your code (see "Using Java" manual for more info).
MQEnvironment.hostname = "hostname";
MQEnvironment.channel = "client.channel"; |
|
Back to top |
|
 |
rashmishaw |
Posted: Wed Dec 12, 2007 11:32 pm Post subject: |
|
|
Newbie
Joined: 04 Dec 2007 Posts: 7
|
Hey I was also getting the same error and was able to resolve the problem by using
MQENviorment : Host
MQEnvironment.channel
MQEnvironment.port
in the code... But I think its not the permanent solution to the above .... It clearly shows that the enviornment variable is messed up.... As I was able to run the same program in some other computer without any error and without using
MQENviorment : Host
MQEnvironment.channel
MQEnvironment.port
So if there is any permanent solution then Pls do post it ..
Pls Note : I have gone through MQ Manaual --- chapter 2 --- Enviornment Variable --- TBL 4 |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Dec 13, 2007 6:40 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You need to specify hostname, channel and port to establish an MQ client connection in any language.
The Java API doesn't use the OS environment. It uses the MQEnvironment class.
I don't see what your confusion is? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Dec 13, 2007 12:10 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
jefflowrey wrote: |
You need to specify hostname, channel and port to establish an MQ client connection in any language.
The Java API doesn't use the OS environment. It uses the MQEnvironment class.
I don't see what your confusion is? |
Maybe he should use a channel table? _________________ MQ & Broker admin |
|
Back to top |
|
 |
rashmishaw |
Posted: Thu Dec 13, 2007 9:53 pm Post subject: |
|
|
Newbie
Joined: 04 Dec 2007 Posts: 7
|
The prob is I have hard coded the env variable .. which is not the correct way of doing it .. when we install mq the env variable are set in the system env setting .. which generally helps .. but in my case nothing seems to work ... Might be I am missing something .. I am not sure but for time being I am hard coding the env variable .. If I or nebody out there get's ne solution then pls do post it ....  |
|
Back to top |
|
 |
manicminer |
Posted: Fri Dec 14, 2007 1:08 am Post subject: |
|
|
 Disciple
Joined: 11 Jul 2007 Posts: 177
|
I assume you have read the Java manual / javadoc? (you mentioned reading it earlier)
Have you spotted the MQQueueManager constructor that takes a Hashtable of properties?
Have you then looked at page 120 (v6 online pdf version) and read about what you can do using that properties hashtable? |
|
Back to top |
|
 |
RogerLacroix |
Posted: Fri Dec 14, 2007 1:10 pm Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
rashmishaw wrote: |
The prob is I have hard coded the env variable .. which is not the correct way of doing it .. when we install mq the env variable are set in the system env setting .. which generally helps .. but in my case nothing seems to work ... Might be I am missing something .. I am not sure but for time being I am hard coding the env variable .. If I or nebody out there get's ne solution then pls do post it ....  |
OMG! Doesn't anyone buy and read books or take courses anymore? If you have a programming job then you probably have a college or university degree?
This is Java 101 programming course stuff. How in the world did you get a job programming Java when you can't simple setup code to read a property file and then use those values. OMG!
Do the following:
1) Create a property file ("myprg.properties") in the same directory as your Java source code. i.e.
Code: |
mq.qmname=MQA1
mq.hostname=10.10.10.10
mq.channelname=SYSTEM.DEF.SVRCONN
mq.port=1414 |
2) In your initialization code add the following:
Code: |
Properties props = new Properties();
FileInputStream in = new FileInputStream("myprg.properties");
props.load(in);
_qMgrName = props.getProperty("mq.qmname");
_hostname = props.getProperty("mq.hostname");
_channelName = props.getProperty("mq.channelname");
_portNumber = props.getProperty("mq.port");
props.close(); |
3) Finally, use those values:
Code: |
MQEnvironment.hostname = _hostname;
MQEnvironment.channel = _channelName;
try
{
MQEnvironment.port = Integer.parseInt(_portNumber.trim());
}
catch (Exception E)
{
MQEnvironment.port = 1414;
} |
Hope that helps and please read some sort of beginner's guide to Java manual/book.
Regards,
Roger Lacroix
Capitalware Inc. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
|