Discussions

General J2EE: J2ee spec for JNDI initial context for java clients

  1. J2ee spec for JNDI initial context for java clients (6 messages)

    Hi All
     According to the J2ee 1.2 spec, a server object should be getting the initial context using the "no argument constructor" : new InitialContext(). This works fine for a server object. But when it comes to normal java client application(for example a batch program using an EJB), this doesnt work. How do we get the initial context for this kind of clients(running on a different JVM)? Whats the J2ee spec for this situation?


    Thanks in advance
  2. j2ee client[ Go to top ]

    I dont know what the spec says..( do I care? ). But this is what we use and this is very similar to what WebSphere launchClient uses.

    Hashtable env = new Hashtable();
    env.put(Context.PROVIDER_URL,"iiop://192.168.0.1");
    ic = new InitialContext(env);

    where 192.168.0.1 is the ip address of the JNDI provider(usually same as the appserver)
  3. j2ee client[ Go to top ]

    Thanks Saji.
  4. Use an application client - see the J2EE spec - this will allow you top use the default initial context and a whole bunch of other goodies
  5. Thanks Aaron. Could you explain in detail what you meant by "application client"??

    Thanks
  6. Take a look at the J2EE spec, I think it's covered in there. Basically it's a client that is shipped within the ear, and then extracted out at deployment time. POJO clients are not covered by the specs at all, application clients get access to limited container stuff, like default initial context, and I think maybe even UserTransaction.
  7. Thanks Aaron!