users@glassfish.java.net

JMS and glasfish ...

From: <glassfish_at_javadesktop.org>
Date: Wed, 18 Aug 2010 13:01:31 PDT

OK. I'm less than a newbie here. I'm an embedded guy trying to do JEE stuff. I have a glassfish installation on which I'm trying to subscribe to some pub/sub messages (topics). I'm doing everything localhost for now but that will change soon where the glassfish MQ et al will be running on another machine. So, I want to code my client app as a remote.
I want to use JNDI service for context and lookup whats available, but I can't seem to find any examples on the web that I recognize as being useful to me.

So let's start with JNDI:

        Hashtable env;
        
        env = new Hashtable();
        
        env.put(Context.INITIAL_CONTEXT_FACTORY, "XXX");
        env.put(Context.PROVIDER_URL,"localhost:7676");
        
        try
        {
            jndiContext = new InitialContext(env);
        }
        catch (NamingException e)
        {
            System.out.println("Could not create JNDI API context: " +
                e.toString());
            System.exit(1);
        }

I'm not sure what goes with the INITIAL_CONTEXT_FACTORY property (XXX). A class of some kind? What about PROVIDER_URL? I have access to the Glassfish admin console so I can look up whatever I need.

TIA
[Message sent by forum member 'whatsamatteru']

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