Hello all, 

I have a small problem in my first JMS client program. I have installed a fresh and 
clean JBoss 3.2.4 server, and without any further configuration, tried a little 
program, that is posted next.

Can anybody please tell me why do i always get a null reference on 
context.lookup("ConnectionFactory") instruction ?

I notice that ConnectionFactory appears on the JNDI object list of the Jmx Console.

Regards
Pedro F.



QueueConnectionFactory queueFactory    = null;
QueueConnection        queueConnection = null;
QueueSession           queueSession    = null;
QueueSender            queueSender     = null;
Queue                  queue           = null;
Context                context         = null;
Hashtable              prop            = new Hashtable();
boolean                bReply          = false;
Object                 factory         = null;


String sCommand = "Hello MSG!!";

prop.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
prop.put("java.naming.factory.url", "localhost:1099");
prop.put("javax.naming.rmi.security.manager", "no");    
prop.put(Context.URL_PKG_PREFIXES, "org.jboss.naming");    
prop.put(Context.PROVIDER_URL, "localhost:1099");  
context = new InitialContext(prop);

factory = context.lookup("ConnectionFactory");
if (factory == null) {
        throw new Exception("ConnectionFactory is null ...");
}

queue = (Queue)context.lookup("queue/A");
if (queue == null) {
        throw new Exception("queue/A is null ...");
}

queueFactory = (QueueConnectionFactory)factory;
queueConnection = queueFactory.createQueueConnection();
queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

queueSender = queueSession.createSender(queue);


TextMessage message = queueSession.createTextMessage();
message.setText(sCommand);
queueSender.send(queue, message);
queueSession.close();
queueConnection.close();

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

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


-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X.
>From Windows to Linux, servers to mobile, InstallShield X is the
one installation-authoring solution that does it all. Learn more and
evaluate today! http://www.installshield.com/Dev2Dev/0504
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to