| Author | 
		  Message
		 | 
		
		  | mq_pm | 
		  
		    
			  
				 Posted: Tue Aug 17, 2004 2:02 pm    Post subject: JMS Error | 
				     | 
			   
			 
		   | 
		
		
		   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 | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | fjb_saper | 
		  
		    
			  
				 Posted: Tue Aug 17, 2004 6:42 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 18 Nov 2003 Posts: 20768 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 | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | vennela | 
		  
		    
			  
				 Posted: Wed Aug 18, 2004 8:26 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    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 | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mq_pm | 
		  
		    
			  
				 Posted: Wed Aug 18, 2004 10:56 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   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 | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | bower5932 | 
		  
		    
			  
				 Posted: Thu Aug 19, 2004 6:32 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    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 | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mq_pm | 
		  
		    
			  
				 Posted: Thu Aug 19, 2004 8:04 am    Post subject: still the problem exists | 
				     | 
			   
			 
		   | 
		
		
		   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 | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | fjb_saper | 
		  
		    
			  
				 Posted: Thu Aug 19, 2004 9:34 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 18 Nov 2003 Posts: 20768 Location: LI,NY 
  | 
		  
		    
			  
				| What are the values of your command line ?? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mq_pm | 
		  
		    
			  
				 Posted: Thu Aug 19, 2004 11:32 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   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 | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | fjb_saper | 
		  
		    
			  
				 Posted: Thu Aug 19, 2004 2:41 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 18 Nov 2003 Posts: 20768 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 | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |