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

JNDI InitialContext Error

Former Member
0 Likes
2,277

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
Former Member
0 Likes

Hi Alexander,

For accessing the EJBs with a Java Client you can refer to the following [link.|http://help.sap.com/saphelp_nwce10/helpdata/en/45/e692b2cfaa5591e10000000a1553f7/frameset.htm]

Though the link is for the CE Version, you can use the information to set up your Initial Context.

Regards,

Alka.

Former Member
0 Likes

Hello Alka,

thank you for the link. I still know that link but it doesn't work.

I still have problems to register to the JNDI. And I have also read that I will not need these parameters if my application is running on the same instance.

Greetings, Alexander