Unable to create InitialContext Object in My Bean class...

Discussions

EJB design: Unable to create InitialContext Object in My Bean class...

  1. Hi,

      Getting the following Exception "javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial"

      When i create InitialContext Object in My Bean class...I tried creating the context object with no argument and with argument constructors... I'm using weblogic7.0...

    --Thanks\suresh
  2. Hi,

    I make an assumption that the client which you are using to execute the bean is an external client. Incase of external clients you need to provide the properties to get the initial context as a parameter while getting the InitialContext.

    I also feel that ur getting the InitialContext in this way

    Context context = new InitialContext();

    where as u have to try using

    Properties properties = new Properties();
    properties.put(Context.INITIAL_CONTEXT_FACTORY,
                   "weblogic.jndi.WLInitialContextFactory");
    properties.put(Context.PROVIDER_URL, "t3://<server ip address>:7001");
    Context context = new InitialContext(properties);

    Hope it works.

    Bye