ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » JMS Error

Post new topic  Reply to topic
 JMS Error « View previous topic :: View next topic » 
Author Message
mq_pm
PostPosted: Tue Aug 17, 2004 2:02 pm    Post subject: JMS Error Reply with quote

Centurion

Joined: 27 Aug 2003
Posts: 132

Hi,

I am trying to write a JMS program using file system as directory server and connecting to MQ to put a message. I am getting an error of :

request to put message 'Test Message '
Exception in thread "main" java.lang.UnsatisfiedLinkError: no mqjbnd05 in java.l
ibrary.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1344)
at java.lang.Runtime.loadLibrary0(Runtime.java:744)
at java.lang.System.loadLibrary(System.java:815)
at com.ibm.mq.MQSESSION.loadLib(MQSESSION.java:490)
at com.ibm.mq.server.MQSESSION$1.run(MQSESSION.java:201)
at java.security.AccessController.doPrivileged(Native Method)
at com.ibm.mq.server.MQSESSION.<clinit>(MQSESSION.java:197)
at com.ibm.mq.MQSESSIONServer.getMQSESSION(MQSESSIONServer.java:67)
at com.ibm.mq.MQSESSION.getSession(MQSESSION.java:363)
at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:
150)
at com.ibm.mq.MQBindingsManagedConnectionFactoryJ11._createManagedConnec
tion(MQBindingsManagedConnectionFactoryJ11.java:141)
at com.ibm.mq.MQBindingsManagedConnectionFactoryJ11.createManagedConnect
ion(MQBindingsManagedConnectionFactoryJ11.java:159)
at com.ibm.mq.StoredManagedConnection.<init>(StoredManagedConnection.jav
a:80)
at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConne
ctionManager.java:150)
at com.ibm.mq.MQQueueManager.obtainBaseMQQueueManager(MQQueueManager.jav
a:682)
at com.ibm.mq.MQQueueManager.construct(MQQueueManager.java:620)
at com.ibm.mq.MQQueueManager.<init>(MQQueueManager.java:437)
at com.ibm.mq.MQSPIQueueManager.<init>(MQSPIQueueManager.java:52)
at com.ibm.mq.jms.MQConnection.createQM(MQConnection.java:1383)
at com.ibm.mq.jms.MQConnection.createQMNonXA(MQConnection.java:960)
at com.ibm.mq.jms.MQQueueConnection.<init>(MQQueueConnection.java:159)
at com.ibm.mq.jms.MQQueueConnection.<init>(MQQueueConnection.java:77)
at com.ibm.mq.jms.MQQueueConnectionFactory.createQueueConnection(MQQueue
ConnectionFactory.java:142)
at JMSTest.putMessage(JMSTest.java:72)
at JMSTest.main(JMSTest.java:37)


could any one tell me why I am getting this bind error.
Any suggestion is appreciated. Thanks in advance.
Back to top
View user's profile Send private message Send e-mail
fjb_saper
PostPosted: Tue Aug 17, 2004 6:42 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

If you're on windows the library (dll) is in <mq install>\java\lib and this directory needs to be on your path...
I guess that you're using bindings mode and that your qmgr is local.

On Unix make sure that your LD_LIB_PATH or LD_LIBRARY etc... Check out exact spelling of variable with your admin contains the proper path/library...

Enjoy
Back to top
View user's profile Send private message Send e-mail
vennela
PostPosted: Wed Aug 18, 2004 8:26 am    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

On various flavours of Unix
Code:
AIX         LD_LIBRARY_PATH=/usr/mqm/java/lib 
HP-UX         SHLIB_PATH=/opt/mqm/java/lib 
Sun Solaris      LD_LIBRARY_PATH=/opt/mqm/java/lib 
z/OS & OS/390      LIBPATH=install_dir/mqm/java/lib 
Linux         LD_LIBRARY_PATH=install_dir/mqm/java/lib 
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mq_pm
PostPosted: Wed Aug 18, 2004 10:56 am    Post subject: Reply with quote

Centurion

Joined: 27 Aug 2003
Posts: 132

Thanks for the suggestion.

Now it is working when i changed it to client mode. I don't know why it is not working in binding mode even though both are on same machine.

Meanwhile, I have one more doubt.

I have changed the code in this way.....

java.util.Hashtable props = new java.util.Hashtable();

String initialContextFactory = System.getProperty(Context.INITIAL_CONTEXT_FACTORY);

if(initialContextFactory != null)
props.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);

String providerUrl = System.getProperty(Context.PROVIDER_URL);
if(providerUrl != null)
props.put(Context.PROVIDER_URL, providerUrl);

InitialContext ctx = new InitialContext(props);

If I use this way, I am getting errors:

failed with javax.naming.NoInitialContextException: Need to specify class name i
n environment or system property, or as an applet parameter, or in an applicatio
n resource file: java.naming.factory.initial
javax.naming.NoInitialContextException: Need to specify class name in environmen
t or system property, or as an applet parameter, or in an application resource f
ile: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
3
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:241
)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.jav
a:278)
at javax.naming.InitialContext.lookup(InitialContext.java:345)
at JMSTest.putMessage(JMSTest.java:69)
at JMSTest.main(JMSTest.java:40)

But if I directly specify the initial context value and provider url, then it is working. we can't hard code the values in the pgm.

Could anyone tell why Iam getting the above errors.
Any help is appreciated. Thanks in advance.
Back to top
View user's profile Send private message Send e-mail
bower5932
PostPosted: Thu Aug 19, 2004 6:32 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

The reason that it worked in client mode is because client mode doesn't require the bindings DLL/shared library.

As far as not wanting to hard-code values, go to:

http://www.developer.ibm.com/tech/sampmq.html

and take a look at mqjmspub.java/mqjmssub.java. They get their values off of a command line.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
mq_pm
PostPosted: Thu Aug 19, 2004 8:04 am    Post subject: still the problem exists Reply with quote

Centurion

Joined: 27 Aug 2003
Posts: 132

I was doing in the same manner as mentioned in the pgm taking the parameter values from the commandline..... and then using them like shown below which i mentioned previously also...

java.util.Hashtable props = new java.util.Hashtable();


String initialContextFactory = System.getProperty(Context.INITIAL_CONTEXT_FACTORY);
if(initialContextFactory != null)
props.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);

String providerUrl = System.getProperty(Context.PROVIDER_URL);
if(providerUrl != null)
props.put(Context.PROVIDER_URL, providerUrl);

InitialContext ctx = new InitialContext(props);

But when i execute this, the value of intialContextFactory is null due to which I was getting error. I am not sure why System.getProperty(...) is giving the value as null. As far I know this is the only way that can be performed to remove the hard coding. Any suggestions please.

Thanks.
Back to top
View user's profile Send private message Send e-mail
fjb_saper
PostPosted: Thu Aug 19, 2004 9:34 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

What are the values of your command line ??
Back to top
View user's profile Send private message Send e-mail
mq_pm
PostPosted: Thu Aug 19, 2004 11:32 am    Post subject: Reply with quote

Centurion

Joined: 27 Aug 2003
Posts: 132

java JMSsample -W -M "Test message 1" -C "ivtQCF" -Q "JQueue"

If I hard code the context and provider values, then it is working with these command line parameters.
Back to top
View user's profile Send private message Send e-mail
fjb_saper
PostPosted: Thu Aug 19, 2004 2:41 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

PTPSample01 says: with jndi lookup:
Quote:
* Usage:
*
* java PTPSample01 -nojndi [ -m qmgr ] [ -t ]
* or java PTPSample01 -url providerURL [ -icf initialContextFactory ] [ -t ]
*
* where:
*
* -nojndi - specify this to disable JNDI lookup of
* the two required administered objects
* -m qmgr - specify the name of the queue manager to
* connect to, if not the default one
* -t - enabled tracing
* -url providerURL - specify the URL of the JNDI initial
* context (this parameter is obligatory
* unless the -nojndi switch is supplied,
* in which case it is ignored
* -icf initialContextFactory - specify the initialContextFactory for
* JNDI [com.sun.jndi.ldap.LdapCtxFactory]

The icf and url give here are given as sample info. You will have to enter the right url and the right class name for the icf.

You should not have to hard code it but then you will have to interpret the variables correctly

Enjoy
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » JMS Error
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.