users@glassfish.java.net

Re: JMS Authentication from remote standalone JSE appliation.

From: <glassfish_at_javadesktop.org>
Date: Mon, 02 Jun 2008 09:22:49 PDT

I might get a slap for resurrecting an old thread here, but I've seen this question asked a number of times on these forums and I've yet to see an answer.

Here's what I just discovered with the following code in a standalone J2SE app:

    Hashtable env = new Hashtable();
    env.put("org.omg.CORBA.ORBInitialHost", "localhost");
    env.put("org.omg.CORBA.ORBInitialPort", "3700");
    InitialContext ctx = new InitialContext(env);
    ConnectionFactory factory = (ConnectionFactory) ctx.lookup("jms/myCF");
    Destination destination = (Destination) ctx.lookup("jms/myDest");
    Connection connection = factory.createConnection("user", "password");

This results in the MC2001 warning, and I find user/password is ignored. However, if I change the connection factory creation as follows:

     ConnectionFactory factory = new com.sun.messaging.ConnectionFactory();

It works.

What this means with regards to not using a server-defined connection pool, I've to figure out, but at least it's a start!

Hope that helps someone...
[Message sent by forum member 'sennen' (sennen)]

http://forums.java.net/jive/thread.jspa?messageID=277864