Help regarding JNDI lookup

View: New views
4 Messages — Rating Filter:   Alert me  

Help regarding JNDI lookup

by gembin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

@Local
@Remote
@Stateless( mappedName="UserManagerBean")
public class UserManagerBean implements IUserManager {

    @Override
    public void createUser(String userName, String password) {
         System.out.println("Create user:"+userName+" password:" +password);
    }

}


Client.java  lookup by using jndi

  Hashtable<String, Object> env = new Hashtable<String, Object>();
        env.put(Context.INITIAL_CONTEXT_FACTORY, "org.objectweb.carol.jndi.spi.MultiOrbInitialContextFactory");
        env.put(Context.PROVIDER_URL, "rmi://localhost:1099");
        //env.put("carol.start.ns", Boolean.FALSE);

        Context initialContext = new InitialContext(env);

        IUserManager businessItf = (IUserManager) initialContext.lookup("UserManagerBean");

        businessItf.createUser("gembin","1234");

i got an Exception:

Exception in thread "main" javax.naming.NameNotFoundException: UserManagerBean
at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:99)
    at javax.naming.InitialContext.lookup(InitialContext.java:396)
    at org.ow2.carol.jndi.spi.AbsContext.lookup(AbsContext.java:142)
    at org.ow2.carol.jndi.spi.AbsContext.lookup(AbsContext.java:152)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
--
Gembin
 


Re: Help regarding JNDI lookup

by Guillaume Sauthier :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

What is the version of easybeans you're using ?
--G

张斌 a écrit :

> @Local
> @Remote
> @Stateless( mappedName="UserManagerBean")
> public class UserManagerBean implements IUserManager {
>
>     @Override
>     public void createUser(String userName, String password) {
>          System.out.println("Create user:"+userName+" password:"
> +password);
>     }
>
> }
>
>
> Client.java  lookup by using jndi
>
>   Hashtable<String, Object> env = new Hashtable<String, Object>();
>         env.put(Context.INITIAL_CONTEXT_FACTORY,
> "org.objectweb.carol.jndi.spi.MultiOrbInitialContextFactory");
>         env.put(Context.PROVIDER_URL, "rmi://localhost:1099");
>         //env.put("carol.start.ns", Boolean.FALSE);
>
>         Context initialContext = new InitialContext(env);
>
>         IUserManager businessItf = (IUserManager)
> initialContext.lookup("UserManagerBean");
>
>         businessItf.createUser("gembin","1234");
>
> i got an Exception:
>
> *Exception in thread "main" javax.naming.NameNotFoundException:
> UserManagerBean*
> at
> com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:99)
>     at javax.naming.InitialContext.lookup(InitialContext.java:396)
>     at org.ow2.carol.jndi.spi.AbsContext.lookup(AbsContext.java:142)
>     at org.ow2.carol.jndi.spi.AbsContext.lookup(AbsContext.java:152)
>     at javax.naming.InitialContext.lookup(InitialContext.java:392)
>     at javax.naming.InitialContext.lookup(InitialContext.java:392)
> --
> Gembin
>  
>

[Guillaume_Sauthier.vcf]

begin:vcard
fn:Guillaume Sauthier
n:Sauthier;Guillaume
org:<a href="http://www.ow2.org"><img title="OW2" alt="OW2 Consortium" border="0" src="http://www.ow2.org/xwiki/bin/skin/XWiki/DefaultSkin/logoOW2.png" /></a>
adr:;;;;;;France
email;internet:guillaume.sauthier@...
title:<a href="http://jonas.ow2.org">JOnAS Application Server</a>
x-mozilla-html:TRUE
url:http://jonas.ow2.org
version:2.1
end:vcard



Re: Re: Help regarding JNDI lookup

by gembin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

the version i use is easybeans 1.1.0-RC1;
finally, i got this problem solved. :-)
there are some packages missing on the client side. but i don't understand why the Expcetion is : javax.naming.NameNotFoundException.

--
Gembin

2009/4/6 Guillaume Sauthier <Guillaume.Sauthier@...>
What is the version of easybeans you're using ?
--G

张斌 a écrit :

@Local
@Remote
@Stateless( mappedName="UserManagerBean")
public class UserManagerBean implements IUserManager {

   @Override
   public void createUser(String userName, String password) {
        System.out.println("Create user:"+userName+" password:" +password);
   }

}


Client.java  lookup by using jndi

 Hashtable<String, Object> env = new Hashtable<String, Object>();
       env.put(Context.INITIAL_CONTEXT_FACTORY, "org.objectweb.carol.jndi.spi.MultiOrbInitialContextFactory");
       env.put(Context.PROVIDER_URL, "rmi://localhost:1099");
       //env.put("carol.start.ns", Boolean.FALSE);

       Context initialContext = new InitialContext(env);

       IUserManager businessItf = (IUserManager) initialContext.lookup("UserManagerBean");

       businessItf.createUser("gembin","1234");

i got an Exception:

*Exception in thread "main" javax.naming.NameNotFoundException: UserManagerBean*
at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:99)
   at javax.naming.InitialContext.lookup(InitialContext.java:396)
   at org.ow2.carol.jndi.spi.AbsContext.lookup(AbsContext.java:142)
   at org.ow2.carol.jndi.spi.AbsContext.lookup(AbsContext.java:152)
   at javax.naming.InitialContext.lookup(InitialContext.java:392)
   at javax.naming.InitialContext.lookup(InitialContext.java:392)
--
Gembin
 




--
Gembin
My Blog: http://www.blogjava.net/gembin


Re: Re: Re: Help regarding JNDI lookup

by Guillaume Sauthier :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

张斌 a écrit :
> the version i use is easybeans 1.1.0-RC1;
> finally, i got this problem solved. :-)

nice to hear !

> there are some packages missing on the client side. but i don't
> understand why the Expcetion is : *javax.naming.NameNotFoundException.
> *

JNDI API have very few Exceptions in method's signatures so it's a
possibility that the real Exception's cause has been wrapped (or
swallowed) in a root exception ...

--G

> *
> --
> Gembin
> *
> 2009/4/6 Guillaume Sauthier <Guillaume.Sauthier@...
> <mailto:Guillaume.Sauthier@...>>
>
>     What is the version of easybeans you're using ?
>     --G
>
>     张斌 a écrit :
>
>         @Local
>         @Remote
>         @Stateless( mappedName="UserManagerBean")
>         public class UserManagerBean implements IUserManager {
>
>            @Override
>            public void createUser(String userName, String password) {
>                 System.out.println("Create user:"+userName+"
>         password:" +password);
>            }
>
>         }
>
>
>         Client.java  lookup by using jndi
>
>          Hashtable<String, Object> env = new Hashtable<String, Object>();
>                env.put(Context.INITIAL_CONTEXT_FACTORY,
>         "org.objectweb.carol.jndi.spi.MultiOrbInitialContextFactory");
>                env.put(Context.PROVIDER_URL, "rmi://localhost:1099");
>                //env.put("carol.start.ns", Boolean.FALSE);
>
>                Context initialContext = new InitialContext(env);
>
>                IUserManager businessItf = (IUserManager)
>         initialContext.lookup("UserManagerBean");
>
>                businessItf.createUser("gembin","1234");
>
>         i got an Exception:
>
>         *Exception in thread "main"
>         javax.naming.NameNotFoundException: UserManagerBean*
>         at
>         com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:99)
>            at javax.naming.InitialContext.lookup(InitialContext.java:396)
>            at
>         org.ow2.carol.jndi.spi.AbsContext.lookup(AbsContext.java:142)
>            at
>         org.ow2.carol.jndi.spi.AbsContext.lookup(AbsContext.java:152)
>            at javax.naming.InitialContext.lookup(InitialContext.java:392)
>            at javax.naming.InitialContext.lookup(InitialContext.java:392)
>         --
>         Gembin
>          
>
>
>
>
>
> --
> Gembin
> My Blog: http://www.blogjava.net/gembin
>

[Guillaume_Sauthier.vcf]

begin:vcard
fn:Guillaume Sauthier
n:Sauthier;Guillaume
org:<a href="http://www.ow2.org"><img title="OW2" alt="OW2 Consortium" border="0" src="http://www.ow2.org/xwiki/bin/skin/XWiki/DefaultSkin/logoOW2.png" /></a>
adr:;;;;;;France
email;internet:guillaume.sauthier@...
title:<a href="http://jonas.ow2.org">JOnAS Application Server</a>
x-mozilla-html:TRUE
url:http://jonas.ow2.org
version:2.1
end:vcard