Discussions

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
    equest.java:85)
            at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
    ef.java:262)
            at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
    ef.java:229)
            at weblogic.rmi.internal.ProxyStub.invoke(ProxyStub.java:35)
            at $Proxy0.lookup(Unknown Source)
            at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:339)
            at javax.naming.InitialContext.lookup(Unknown Source)
            at client.main(client.java:40)

    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 }
     finally
    {
      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 }


    More...
    http://e-docs.bea.com/wls/docs81/jndi/index.html