5 Replies Latest reply on Apr 15, 2009 6:00 AM by uday.madigatla

    javax.naming.NameNotFoundException while looking up the sess

      Hi I'm using myeclise as IDE....,I created one EJB project. My ejb project name is Test. So my ear name is "Test", Ejb project name is "TestEJB" and werbmodule name is "TestWeb". It was deployed succesfully in Jboss 5.0GA Every thing was Ok up to this.

      In my Web module project i created a Client.java program in order access the session beans. Here is my client.java program


      package client;

      import java.util.Properties;

      import javax.naming.Context;
      import javax.naming.NamingException;

      import sessionbeans.SaveInternalUserRemote;
      import entityBeans.InternalUser;

      public class Client {
      public static void main(String args[]) throws NamingException
      {
      Properties prop=new Properties();
      prop.put(Context.PROVIDER_URL,"jnp://localhost:1099");
      prop.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
      prop.put(Context.URL_PKG_PREFIXES," org.jboss.naming:org.jnp.interfaces");
      Context jndiContext= new javax.naming.InitialContext(prop);
      System.out.println(jndiContext);
      System.out.println(jndiContext.getClass().getName());
      SaveInternalUserRemote saveInternal=(SaveInternalUserRemote)jndiContext.lookup("Test/SaveInternalUser/remote");
      InternalUser user=new InternalUser();
      user.setName("Uday");
      user.setName("ukma");
      user.setDescription("Uday");
      saveInternal.saveUser(user);


      }
      }

      When i try to run this i'm getting this exception....


      Exception in thread "main" javax.naming.NameNotFoundException: Test/SaveInternalUser/remote
      at org.jboss.ha.jndi.TreeHead.lookup(TreeHead.java:242)
      at org.jboss.ha.jndi.HAJNDI.lookup(HAJNDI.java:155)
      at sun.reflect.GeneratedMethodAccessor87.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.jboss.ha.framework.server.HARMIServerImpl.invoke(HARMIServerImpl.java:209)
      at sun.reflect.GeneratedMethodAccessor86.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
      at sun.rmi.transport.Transport$1.run(Transport.java:159)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:619)
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
      at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
      at sun.rmi.server.UnicastRef.invoke(Unknown Source)
      at org.jboss.ha.framework.server.HARMIServerImpl_Stub.invoke(Unknown Source)
      at org.jboss.ha.framework.interfaces.HARMIClient.invokeRemote(HARMIClient.java:219)
      at org.jboss.ha.framework.interfaces.HARMIClient.invoke(HARMIClient.java:321)
      at $Proxy0.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:528)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
      at javax.naming.InitialContext.lookup(Unknown Source)
      at client.Client.main(Client.java:22)

      Then bold one is the error line. What should i use as lookup name for session bean..

      Is there any jar file need to add for this.

      Please help me in this. i was really require this in order to proceed further..

      Thanks in advance