users@glassfish.java.net

Re: JNDI lookup problem for standalone client : NameNotFoundException

From: <glassfish_at_javadesktop.org>
Date: Fri, 19 Sep 2008 00:23:47 PDT

Hi,

I have modified the below code in CartClient.java to use Properties.
-------------------------------------------------------------------------------------------------------------------------
try {
Context context = getInitialContext();
CartRemote cart = (CartRemote)context.lookup("java:comp/env/CartBean");
-------------------------------------------------------------------------------------------------------------------------

I uses the below code & it's working fine now.
-------------------------------------------------------------------------------------------------------------------------
     Properties jndiProp = new Properties();

//javax.naming.Context.INITIAL_CONTEXT_FACTORY for SUN Java Glassfish V2 is 'com.sun.enterprise.naming.SerialInitContextFactory'
//javax.naming.Context.PROVIDER_URL, "iiop://localhost:3920/" or ports: 3700,3820

jndiProp.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,"com.sun.enterprise.naming.SerialInitContextFactory");
jndiProp.put(javax.naming.Context.PROVIDER_URL, "iiop://localhost:3920/");

        try {
            InitialContext context =new InitialContext(jndiProp);
            CartRemote cart = (CartRemote)context.lookup("CartBean");

----------------------------------------------------------------------------------------------------------------------

____________________________
Thanks,
Rajeev R.
[Message sent by forum member 'rajeev_tumkur' (rajeev_tumkur)]

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