on 03-07-2007 9:36 AM
Hi,
I've got a problem with JNDI lookup. I am running the Preview of NetWeaver Application Server JEE 5 Edition and have created a stateless Session Bean SupplierAgentBean with local am remote interface (SupplierAgentLocal, SupplierAgentRemote). To test it from an external client I am using the following code:
public static Context getInitialContext() throws javax.naming.NamingException {
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
props.put(Context.PROVIDER_URL, "localhost:50004");
Context jndiContext = new InitialContext(props);
return jndiContext;
}
/**
* @param args
*/
public static void main(String[] args) {
try {
Supplier supplier = new Supplier();
supplier.setSupplierName("Testname");
supplier.setSupplierStreet("Teststreet");
supplier.setSupplierZipcode(12345);
supplier.setSupplierCity("Testcity");
Context jndiContext = getInitialContext();
//SupplierAgentLocal supplierAgentLocal = (SupplierAgentLocal) jndiContext.lookup("localejbs/SupplierAgent");
SupplierAgentRemote supplierAgentRemote = (SupplierAgentRemote) PortableRemoteObject.narrow(jndiContext.lookup("SupplierAgent"), SupplierAgentRemote.class);
supplierAgentLocal.createSupplier(supplier);
} catch (NamingException ex) {
ex.printStackTrace();
}
}
I am getting a NameNotFoundException (Object not found in lookup of SupplierAgent.) Calling the local interface (which has been commented out) does not work either. Any ideas?
Thanks
Arne
Hi Arne,
Hopefully this article gets your questions answered: <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/605ff5f2-e589-2910-3ead-e558376e6f3d">Accessing Enterprise JavaBeans Using JNDI in SAP NetWeaver AS, Java EE 5 Edition</a>.
Cheers,
Vladimir
PS: I'll move this thread to the forum dedicated to Java EE 5 @ SAP.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.