| Author | Message | 
		
		  | hyperspike | 
			  
				|  Posted: Thu Jul 01, 2010 7:31 am    Post subject: null pointer when new MQConnectionFactory |   |  | 
		
		  | Novice
 
 
 Joined: 24 May 2010Posts: 18
 
 
 | 
			  
				| I am trying to exicute the following command [code] MQConnectionFactory connFactory = new MQConnectionFactory(); [/code]
 
 and i get a null pointer that i can't seem to track down, i have attached the stack trace, any help would be greatly appreciated.
 java.lang.NullPointerException
 at com.ibm.msg.client.jms.internal.JmsFactoryFactoryImpl.getInstance(JmsFactoryFactoryImpl.java:169)
 at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.setProviderFactory(JmsConnectionFactoryImpl.java:165)
 at com.ibm.mq.jms.MQConnectionFactory.<init>(MQConnectionFactory.java:271)
 at com.foundation.agent.plugin.JMSClient.createConnection(JMSClient.java:154)
 at com.foundation.agent.plugin.JMSClient.launch(JMSClient.java:108)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | calanais | 
			  
				|  Posted: Thu Jul 01, 2010 7:54 am    Post subject: |   |  | 
		
		  | Apprentice
 
 
 Joined: 12 Mar 2010Posts: 32
 
 
 | 
			  
				| What have you got on your classpath? What JARs and from what version of MQ?
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | hyperspike | 
			  
				|  Posted: Thu Jul 01, 2010 7:58 am    Post subject: |   |  | 
		
		  | Novice
 
 
 Joined: 24 May 2010Posts: 18
 
 
 | 
			  
				| com.ibm.mq.runtime_7.0.1.0\lib 
 jars
 com.ibm.mq.headers.jar
 com.ibm.mqjms.jar
 jms.jar
 com.ibm.mq.jar
 connector.jar
 jta.jar
 com.ibm.mq.jmqi.jar
 dhbcore.jar
 providerutil.jar
 com.ibm.mq.pcf.jar
 fscontext.jar
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | hyperspike | 
			  
				|  Posted: Thu Jul 01, 2010 11:32 am    Post subject: |   |  | 
		
		  | Novice
 
 
 Joined: 24 May 2010Posts: 18
 
 
 | 
			  
				| additional info... 
 i am attempting to bootstrap this class and it is possible that i am clobbering something.
  but i have no clue what i could be overriding... |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | fjb_saper | 
			  
				|  Posted: Thu Jul 01, 2010 2:25 pm    Post subject: |   |  | 
		
		  |  Grand High Poobah
 
 
 Joined: 18 Nov 2003Posts: 20767
 Location: LI,NY
 
 | 
			  
				| 
   
	| hyperspike wrote: |  
	| additional info... 
 i am attempting to bootstrap this class and it is possible that i am clobbering something.
  but i have no clue what i could be overriding... |  
 If you are running this on a J2EE server, I'd drop the jms.jar and jta.jar...
  _________________
 MQ & Broker admin
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | calanais | 
			  
				|  Posted: Thu Jul 01, 2010 11:43 pm    Post subject: |   |  | 
		
		  | Apprentice
 
 
 Joined: 12 Mar 2010Posts: 32
 
 
 | 
			  
				| Is this a Java EE environment of some type? You mentioned "bootstraping" this class - could you expand on that please.. not sure what exactly you mean. 
 Thanks.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | hyperspike | 
			  
				|  Posted: Fri Jul 02, 2010 5:32 am    Post subject: |   |  | 
		
		  | Novice
 
 
 Joined: 24 May 2010Posts: 18
 
 
 | 
			  
				| It is running in jboss, however removing those two jars still resulted in the same error 
 [code]at com.ibm.msg.client.jms.internal.JmsFactoryFactoryImpl.getInstance(JmsFactoryFactoryImpl.java:169)
 at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.setProviderFactory(JmsConnectionFactoryImpl.java:165)
 at com.ibm.mq.jms.MQConnectionFactory.<init>(MQConnectionFactory.java:271)[/code]
 
 when i call new MQConnectionFactory();
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | fjb_saper | 
			  
				|  Posted: Fri Jul 02, 2010 10:57 am    Post subject: |   |  | 
		
		  |  Grand High Poobah
 
 
 Joined: 18 Nov 2003Posts: 20767
 Location: LI,NY
 
 | 
			  
				| 
   
	| hyperspike wrote: |  
	| It is running in jboss, however removing those two jars still resulted in the same error 
 
 
   
	| Code: |  
	| at com.ibm.msg.client.jms.internal.JmsFactoryFactoryImpl.getInstance(JmsFactoryFactoryImpl.java:169) at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.setProviderFactory(JmsConnectionFactoryImpl.java:165)
 at com.ibm.mq.jms.MQConnectionFactory.<init>(MQConnectionFactory.java:271)
 |  
 when i call new MQConnectionFactory();
 |  Which version of MQ are you running with which version of Jboss?
 Check out the forums there are some problems.
 V 6.0.2.9 of MQ should work. Are you using the resource adapter?
 
 Have fun
  _________________
 MQ & Broker admin
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | hyperspike | 
			  
				|  Posted: Fri Jul 02, 2010 11:08 am    Post subject: |   |  | 
		
		  | Novice
 
 
 Joined: 24 May 2010Posts: 18
 
 
 | 
			  
				| I am not using the resource adapter.... or at least i don't believe i am. 
 I am just trying to call the connection factory and then configure it and connect... i will try using the other version of MQ...thanks
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | hyperspike | 
			  
				|  Posted: Fri Jul 02, 2010 11:11 am    Post subject: |   |  | 
		
		  | Novice
 
 
 Joined: 24 May 2010Posts: 18
 
 
 | 
			  
				| wait i think you misunderstood me, i am just connecting out to a MQ server using the MQ jars... the MQ server is hosted by a third party and i have no access to it, however i can connect to it using a standalone jar that i wrote...but i cant get past instantiating the MQConnectionFactory when i try to connect from within jboss.... |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | fjb_saper | 
			  
				|  Posted: Fri Jul 02, 2010 11:18 am    Post subject: |   |  | 
		
		  |  Grand High Poobah
 
 
 Joined: 18 Nov 2003Posts: 20767
 Location: LI,NY
 
 | 
			  
				| 
   
	| hyperspike wrote: |  
	| wait i think you misunderstood me, i am just connecting out to a MQ server using the MQ jars... the MQ server is hosted by a third party and i have no access to it, however i can connect to it using a standalone jar that i wrote...but i cant get past instantiating the MQConnectionFactory when i try to connect from within jboss.... |  Make sure Jboss is not trying to instanciate an "XA" Connection factory unless you are licenced for the "Extended Transactional Client".
 
 Have fun
  _________________
 MQ & Broker admin
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | hyperspike | 
			  
				|  Posted: Fri Jul 02, 2010 11:30 am    Post subject: |   |  | 
		
		  | Novice
 
 
 Joined: 24 May 2010Posts: 18
 
 
 | 
			  
				| I think you may have found my silver bullet... 
 in deploy/jms/jms-ds.xml file it contains
 
 <!-- The combined connection factory -->
 <attribute name="FactoryRef">java:/XAConnectionFactory</attribute>
 <!-- The queue connection factory -->
 <attribute name="QueueFactoryRef">java:/XAConnectionFactory</attribute>
 <!-- The topic factory -->
 <attribute name="TopicFactoryRef">java:/XAConnectionFactory</attribute>
 
 so i guess that would be a yes... how would i go about correcting that??
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | fjb_saper | 
			  
				|  Posted: Fri Jul 02, 2010 5:24 pm    Post subject: |   |  | 
		
		  |  Grand High Poobah
 
 
 Joined: 18 Nov 2003Posts: 20767
 Location: LI,NY
 
 | 
			  
				| 
   
	| hyperspike wrote: |  
	| I think you may have found my silver bullet... 
 in deploy/jms/jms-ds.xml file it contains
 
 <!-- The combined connection factory -->
 <attribute name="FactoryRef">java:/XAConnectionFactory</attribute>
 <!-- The queue connection factory -->
 <attribute name="QueueFactoryRef">java:/XAConnectionFactory</attribute>
 <!-- The topic factory -->
 <attribute name="TopicFactoryRef">java:/XAConnectionFactory</attribute>
 
 so i guess that would be a yes... how would i go about correcting that??
 |  
 What happens if you take the XA out of your attributes?
  _________________
 MQ & Broker admin
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | calanais | 
			  
				|  Posted: Mon Jul 05, 2010 12:08 am    Post subject: |   |  | 
		
		  | Apprentice
 
 
 Joined: 12 Mar 2010Posts: 32
 
 
 | 
			  
				| Quick note on the subject of accessing WMQ from within JBOSS. 
 The really supported way of using it is via the Resource Adapter.
 http://www-01.ibm.com/support/docview.wss?rs=171&uid=swg27009524
 
 Please don't bundle the JARs either JMS and definitely not the WMQ Java classes in with your application. This won't be a supported configuration.
 
 Remember as well that the Transactional Client requires a purchasable license - if you do need that XA functionality over a TCP/IP connection.
 
 Sorry if this is well known stuff to you; but worth repeating I feel.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | hyperspike | 
			  
				|  Posted: Tue Jul 06, 2010 6:54 am    Post subject: |   |  | 
		
		  | Novice
 
 
 Joined: 24 May 2010Posts: 18
 
 
 | 
			  
				| Taking XA out of the references didn't work. 
 I am not trying to use XA functionality, I am not sure that i am using a resource adapter because i am not defining or deploying and EJBs.
 
 Basically i am starting a thread within jboss that will build out the connection using the connection factory...
 
 it seems to me, and i could be mistaken, that some jms property its causing the MQConnectionfactory to try to instantiate itself as an XA transaction factory which i don't have the license to do.
 
 that being said i am not sure what or how to overide this...
  |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  |  |