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 » null pointer when new MQConnectionFactory

Post new topic  Reply to topic Goto page 1, 2  Next
 null pointer when new MQConnectionFactory « View previous topic :: View next topic » 
Author Message
hyperspike
PostPosted: Thu Jul 01, 2010 7:31 am    Post subject: null pointer when new MQConnectionFactory Reply with quote

Novice

Joined: 24 May 2010
Posts: 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
View user's profile Send private message
calanais
PostPosted: Thu Jul 01, 2010 7:54 am    Post subject: Reply with quote

Apprentice

Joined: 12 Mar 2010
Posts: 32

What have you got on your classpath?
What JARs and from what version of MQ?
Back to top
View user's profile Send private message
hyperspike
PostPosted: Thu Jul 01, 2010 7:58 am    Post subject: Reply with quote

Novice

Joined: 24 May 2010
Posts: 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
View user's profile Send private message
hyperspike
PostPosted: Thu Jul 01, 2010 11:32 am    Post subject: Reply with quote

Novice

Joined: 24 May 2010
Posts: 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
View user's profile Send private message
fjb_saper
PostPosted: Thu Jul 01, 2010 2:25 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
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
View user's profile Send private message Send e-mail
calanais
PostPosted: Thu Jul 01, 2010 11:43 pm    Post subject: Reply with quote

Apprentice

Joined: 12 Mar 2010
Posts: 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
View user's profile Send private message
hyperspike
PostPosted: Fri Jul 02, 2010 5:32 am    Post subject: Reply with quote

Novice

Joined: 24 May 2010
Posts: 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
View user's profile Send private message
fjb_saper
PostPosted: Fri Jul 02, 2010 10:57 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
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
View user's profile Send private message Send e-mail
hyperspike
PostPosted: Fri Jul 02, 2010 11:08 am    Post subject: Reply with quote

Novice

Joined: 24 May 2010
Posts: 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
View user's profile Send private message
hyperspike
PostPosted: Fri Jul 02, 2010 11:11 am    Post subject: Reply with quote

Novice

Joined: 24 May 2010
Posts: 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
View user's profile Send private message
fjb_saper
PostPosted: Fri Jul 02, 2010 11:18 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
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
View user's profile Send private message Send e-mail
hyperspike
PostPosted: Fri Jul 02, 2010 11:30 am    Post subject: Reply with quote

Novice

Joined: 24 May 2010
Posts: 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
View user's profile Send private message
fjb_saper
PostPosted: Fri Jul 02, 2010 5:24 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
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
View user's profile Send private message Send e-mail
calanais
PostPosted: Mon Jul 05, 2010 12:08 am    Post subject: Reply with quote

Apprentice

Joined: 12 Mar 2010
Posts: 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
View user's profile Send private message
hyperspike
PostPosted: Tue Jul 06, 2010 6:54 am    Post subject: Reply with quote

Novice

Joined: 24 May 2010
Posts: 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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » IBM MQ Java / JMS » null pointer when new MQConnectionFactory
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.