[jboss-user] [Messaging, JMS & JBossMQ] - Jboss MQ ConnectionFactory being returned null

PrashantSehgal do-not-reply at jboss.com
Wed Apr 16 04:04:30 EDT 2008


Hi,

My connection factory is setup in my Jboss 4.0.4 server like this:



  | <tx-connection-factory>    
  | <jndi-name>jms/queue/ControlConnectionFactory</jndi-name>    
  | <use-java-context>false</use-java-context>    
  | <xa-transaction/>    
  | <rar-name>jms-ra.rar</rar-name>    
  | <connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>    
  | <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>    
  | <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property>
  | <max-pool-size>100</max-pool-size>  
  | </tx-connection-factory>  
  | 


I'm accessing this from outside of Jboss, using a stand alone client with from it's main method like so:



  | public void initializeListener () 
  | {						
  |   String url = "lonrs03004:1099";
  |   Properties props = new Properties();
  |   props.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
  |   props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
  |   props.setProperty("java.naming.provider.url", url);		
  | 
  |   try {
  |     Context ctx = new InitialContext(props);	
  |     QueueConnectionFactory qConFactory = 
  |              (QueueConnectionFactory) ctx.lookup("jms/queue/ControlConnectionFactory"); 		
  | 
  |   if(qConFactory == null) {			
  |      System.out.println("qConFactory is null ");		
  |      System.exit(0); 
  |   }				
  | } 
  | 


The connection factory is being returned as null. I read somewhere that this might be because my connection factory is setup using jboss-ra and in such cases standalone clients cant access connection factories. One needs to access them from inside the server.

a) Is this correct? 
b) If I want to retain my stand-alone client, how should I setup my connection factories?

Thanks,
Prashant.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4144397#4144397

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4144397



More information about the jboss-user mailing list