1 Reply Latest reply: Mar 13, 2009 7:19 AM by 807581 RSS

    lookup code for local ejb in oc4j server

    807581
      Hi all,
      I am unable to get the lookup for local ejb while deploying my application in oc4j 10.1.3. I, getting null pointer exception. I wrote below code. can any body help me out regarding this.

      thanks in advance,

      Hashtable env = new Hashtable();
      env.put(Context.INITIAL_CONTEXT_FACTORY,"oracle.j2ee.rmi.RMIInitialContextFactory");
      env.put(Context.SECURITY_PRINCIPAL, "oc4jadmin");
      env.put(Context.SECURITY_CREDENTIALS, "welcome");
      env.put(Context.PROVIDER_URL, "ormi://dpanda-us:23792/ejbsamples");

      Context context = new InitialContext(env);
      Object homeObject = context.lookup("MyCart");
      CartHome home =
      (CartHome)PortableRemoteObject.narrow(homeObject,CartHome.class);
        • 1. Re: lookup code for local ejb in oc4j server
          807581
          check these properties are correct and given correct application name and port number.

          Hashtable env = new Hashtable();
          env.put("java.naming.factory.initial","oracle.j2ee.rmi.RMIInitialContextFactory");
          env.put(java.naming.provider.url","ormi://localhost:23791/");
          env.put(java.naming.security.principal","oc4jadmin");
          env.put(java.naming.security.credentials","welcome1");

          or else try with jndi.properties approach.

          check this blog for more information

          [http://www.javafundu.com/2008/10/jndi-access-outside-oc4j-container.html]

          Edited by: proveindia on Mar 13, 2009 12:18 PM