users@glassfish.java.net

Re: JMS and glassfish ...

From: Robert Weeks <RWeeks_at_ext-inc.com>
Date: Thu, 19 Aug 2010 12:29:41 -0700

On Aug 19, 2010, at 3:14 PM, <glassfish_at_javadesktop.org> <glassfish_at_javadesktop.org> wrote:

> Hi Nigel,
>
> I plan to use the ACC, but for now would like to get this working without it. Is that possible? I think I've seen some stand-alone apps that don't use it. Anyway, this is what I've come up with so far:
>
> try
> {
> Properties env = new Properties();
> env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.appserv.naming.SerialInitContextFactory");
> env.put(Context.STATE_FACTORIES,"com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
> env.put(Context.URL_PKG_PREFIXES,"com.sun.enterprise.naming");
> String sUri = "iiop"+"://"+"127.0.0.1"+":"+"3700";
> System.out.println(sUri);
> env.put(Context.PROVIDER_URL,sUri);
>
> //Finally, the rubber meets the road.
> Context context = new InitialContext(env);
> }
> catch (Exception e)
> {
> System.out.println("JNDI Initial Context Failed: " + e.toString());
> }
>
> And I get : JNDI Initial Context Failed: javax.naming.NoInitialContextException: Cannot instantiate class: com.sun.appserv.naming.SerialInitContextFactory [Root exception is java.lang.ClassNotFoundException: com.sun.appserv.naming.SerialInitContextFactory]
>
> The Glassfish domain is up and running.
>
> It's interesting to note that I get the error even if I put in an invalid IP addr. So, is SerialInitContextFactory an object the stand-alone client is trying to get from Glassfish?
>

Hello -

I had to set something like this up as well for some testing, or if the initial JNDI call failed - and used something like:

props.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
props.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");
props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
Context context = new InitialContext(props);

But we put the 'glassfish-naming.jar' in the path to allow it (the ACC was way too big for this - once it is built it is pretty huge). This houses the 'SerialInitContextFactory' class.

HTH some.

--
Robert B. Weeks