Discussions

EJB programming & troubleshooting: [EJB-JNDI] NameNotFoundException

  1. [EJB-JNDI] NameNotFoundException (2 messages)

    Hi,

    I'd like to call EJB B (resides on computer Y) from EJB A (resides on
    computer X).
    To be exact, I want to simulate that they reside on different machines.
    In bean A I use Context.PROVIDER_URL this way.

     public String sayHello() {
      try {
       Properties props = new Properties();

    props.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.cosnami
    ng.CNCtxFactory");
       props.put(javax.naming.Context.PROVIDER_URL,"iiop://oleander:1050");
       Context jndi = new javax.naming.InitialContext(props);
       InitialContext initial = new javax.naming.InitialContext(props);
       MySession2Home home =
    (MySession2Home)javax.rmi.PortableRemoteObject.narrow(initial.lookup("java:c
    omp/env/ejb/MySession2"), MySession2Home.class);
      }
      catch (Exception e) {e.printStackTrace();}
     }

    But I get this exception:
    javax.naming.NameNotFoundException: No object bound to name
    java:comp/env/ejb/MySession2

    I deployed bean B on my machine using a JNDI name 'MySession2'. Doesn't it
    get bound to
    java:comp/env/ejb/MySession2 automatically?

    TIA
    Frank


  2. [EJB-JNDI] NameNotFoundException[ Go to top ]

    What's your EJB Server?
  3. [EJB-JNDI] NameNotFoundException[ Go to top ]

    Unfortunately I have to use J2EE RI 1.3.1

    Frank