on ‎2008 Aug 07 3:49 PM
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
Request clarification before answering.
Hi,
Updated:
i think You are trying to lookup the Remote home interface using the procedure of Local home Interface lookup,For local home interface lookup you have to prefix localejbs before the default Jndi name of the Bean.
Check the default name under Visual Admin.
And rest of the lookup code is fine.
But in case of Remote home lookup the lookup syntex will be different:
<BeanHome Home = (<Bean>Home) javax.rmi.PortableRemoteObject.narrow(ctx.lookup(<Default Jndi Name without localejbs prefix>),<Bean>Home.class);
Check the Following link Also See the last reply.
Regards,
Siddharth
Edited by: Siddharth Jain on Sep 4, 2008 6:36 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 13 | |
| 8 | |
| 7 | |
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.