This is my code fragment, after the jndi lookup conectionfactory and the 
destination are both null :-( :


  | // initialize jndi connection (jboss specific configuration)
  |             Properties props = new Properties();
  |             props.setProperty(Context.INITIAL_CONTEXT_FACTORY, 
"org.jnp.interfaces.NamingContextFactory");
  |             props.setProperty(Context.URL_PKG_PREFIXES, 
"org.jboss.naming.client");
  |             props.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
  |             //props.setProperty("j2ee.clientName", "TestClient");
  |             
  |             // this is from http://activemq.apache.org/jndi-support.html
  |             
//props.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.apache.activemq.jndi.ActiveMQInitialContextFactory");
  |             
//props.setProperty(Context.PROVIDER_URL,"tcp://localhost:61616");
  |             
  |             
  |             // declare all variables for jndi and message transfer needed
  |             Context ctx = null;
  |             ActiveMQConnectionFactory queueConnectionFactory = null;
  |             QueueConnection queueConnection = null;
  |             QueueSession queueSession = null;
  |             Queue stationInfoQueue = null;
  |             MessageProducer msgProducer = null;
  |             TextMessage textMessage = null;
  |             
  |             //  create new initial context from jndi
  |             try
  |             {
  |                     ctx = new InitialContext(props);
  |             }
  |             catch (NamingException e)
  |             {
  |                     System.out.println("Could not create JNDI API context: 
" + e);
  |             System.exit(1);
  |             }
  |             
  |             // Look up connection factory and destination
  |             try
  |             {
  |                     ConnectionFactory factory = (ConnectionFactory) 
ctx.lookup("activemq/QueueConnectionFactory");
  |                     //queueConnectionFactory = new 
ActiveMQConnectionFactory(ActiveMQConnection.DEFAULT_BROKER_URL);
  | 
  |                     stationInfoQueue = (Queue) 
ctx.lookup("stationInfoQueue");
  |                     
  |                     if (factory == null)
  |                     {
  |                             System.out.println("NULL for 
queueConnectionFactory");
  |                     }
  |                     
  |                     if (stationInfoQueue == null)
  |                     {
  |                             System.out.println("NULL for stationInfoQueue");
  |                     }       
  |             }
  |             catch (NamingException e)
  |             {
  |                     System.out.println("JNDI API lookup failed:" + e);
  |                     System.exit(1);
  |             }
  | 

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

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4251659
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to