cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

JNDI InitialContext Error

Former Member
0 Likes
2,270

Hello Experts,

I have a little problem with my Java programm:

Test remote = null;

* try {*

// Create a new intial context, which loads from jndi.properties file.

* *

* Context ctx = new InitialContext();*

* System.out.println("Context:" + ctx);*

// Look up the home interface using the JNDI name.

// This JNDI lookup returns a reference to an EJBHome instance.

* TestHome home = (TestHome) ctx.lookup("sap.com/TestWorldEar/TestBean");*

* System.out.println("TestHome:" + home);*

// Create a session object.

* remote = home.create();*

* System.out.println("Remote:" + remote);*

// Invoke the remote EJB methods, test and debug.

* System.out.println("Result:" + remote.getWert());*

* } catch (Exception e) {*

* System.out.println("Exception: " + e.getLocalizedMessage());*

* }*

I always get the following error and I don't know how to solve the problem.

Exception: 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

I hope anybody of you can help me solving this problem.

Additional information:

The Java program is running on a XI (Netweaver 7.0).

I want to get information from a deployed EJB. The Bean still works.

Thank you for your answers in advance!!!

Greetings, Alexander

View Entire Topic
siddharth_jain
Active Contributor
0 Likes

Hi Alexander,

If you are not sure about the JNDI name of the Bean ,You should check its JNDI Name fom the ejb-j2ee-engine.xml file and if the JNDI name is not there you can specify any valid name,deploy the EJB Proj again.

Then try to lookup the EJB with its JNDI name instead of its Path on server.

Regards,

Siddharth