Getting Context.....in IPlanet App Server.

Discussions

EJB programming & troubleshooting: Getting Context.....in IPlanet App Server.

  1. Getting Context.....in IPlanet App Server. (3 messages)

    Hi Guys,
       When i called EJB from a JSP with in the scope of "iPlanet App server6.0" ..it gives following errors.
    ".............................
    Class jsp.APPS.testram.Context not found. Context initCtx; ^ /opt/IASSP2_inst/ias/APPS/modules/testram/WEB-INF/compiled_jsp/jsp/APPS/testram/testram.java:76: Class jsp.APPS.testram.Context not found. Context ctx = new InitialContext(); ^ /opt/IASSP2_inst/ias/APPS/modules/testram/WEB-INF/compiled_jsp/jsp/APPS/testram/testram.java:76
    ...........................".
    I used following code to get the context.
    "..........................
      String jndiNm = "java:/comp/ejb/hello";
      Context ctx = new InitialContext();
      HelloRamHome home = (HelloRamHome)ctx.lookup(jndiNm);
      HelloRam the_ejb = home.create();
      String retval = the_ejb.sayHello("RAMKI");
      out.print("<p><b>Hello World!</b>"+retval);.........."

    What is the wrong with the code.
    Can anybody post the proper code to get the context.
    What is the equivalent of public_html(as in case of WEBLOGIC)directory for IPlanet App Server.
    Thanks,
    Ramki.
  2. Check that you have imported javax.naming.* package.
  3. ..javax.naming..is very much there in imports.
  4. Hi
    Hmm, that's strange.
    Class jsp.APPS.testram.Context not found

    The code does not even compile. So there is all i can help.

    As for sample codes, I got it from http://developer.iplanet.com/ias-samples/j2eeguide/docs/converter.html

    Properties env = new Properties();
    env.put("java.naming.factory.initial", "com.sun.jndi.cosnaming.CNCtxFactory");
    env.put("java.naming.provider.url", "iiop://" + host + ":"+port);
    Context initial = new InitialContext(env);


    My suggestion will be to have some utility class to handle this getting of a Context, so that when you need to change application servers, etc etc, all this is encapsulated.

    Hope this helps