Naming Exception


EJB design: Naming Exception

  1. Naming Exception (1 messages)

    I am trying to create a stateless session bean. When I run the client, I am getting the following exception. Can anyone help me out please.

    javax.naming.NameNotFoundException: Unable to resolve test. Resolved:'' Unresolved:'test' ; remaining name ''
            at weblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutboundR
            at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
            at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
            at weblogic.rmi.internal.ProxyStub.invoke(
            at $Proxy0.lookup(Unknown Source)
            at weblogic.jndi.internal.WLContextImpl.lookup(
            at javax.naming.InitialContext.lookup(Unknown Source)
            at client.main(

    Thanks in advance
  2. Naming Exception[ Go to top ]

    make sure you have all the Naming Context properties set right for your app server. Generally this is the case. Also follow the weblogic lookup convention to specifiy the JNDI names. You also should be able to see the published JNDI name on your server console.

    here is how to obtain the context

     Context ctx = null;
     Hashtable ht = new Hashtable();
     ht.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); ht.put(Context.PROVIDER_URL, "t3://localhost:7001");
     try { ctx = new InitialContext(ht); // Use the context in your program
     } catch (NamingException e) { // a failure occurred }
      try {ctx.close();
    } catch (Exception e) { // a failure occurred }

     Looking Up a Named Object
      try { ServiceBean bean = (ServiceBean)ctx.lookup("ejb.serviceBean"); }catch (NameNotFoundException e) { // binding does not exist }catch (NamingException e) { // a failure occurred }