on 2007 Dec 20 1:06 PM
Dear Experts,
I'm trying to access an EJB which has been deployed on SAP J2EE Engine from a J2SE client by following the guide Link: [Accessing Enterprise JavaBeans Using JNDI in SAP NetWeaver Application Server|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/605ff5f2-e589-2910-3ead-e558376e6f3d].
When the program lauch to Context ctx = new InitialContext(props);
A ClassNotFoundException is throw out.
I found the error is caused by the property entry:
props.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sap.engine.services.jndi.InitialContextFactoryImpl");
So which JAR file contains the InitialContextFactoryImpl class? How can I solve this problem?
I copied my code as follow, hope you can help me.
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sap.engine.services.jndi.InitialContextFactoryImpl");
props.put(Context.PROVIDER_URL, "localhost:50004");
props.put(Context.SECURITY_PRINCIPAL, "administrator");
props.put(Context.SECURITY_CREDENTIALS, "abcd1234");
try{
Context ctx = new InitialContext(props);
Object o = ctx.lookup(
"sap.com/CartEAR/REMOTE/CartBean/cart.ejb.CartRemote");
cartRemote = (CartRemote) PortableRemoteObject.narrow(o, CartRemote.class);
Hi YiNing,
I assume you're working with a CE 7.1 version. In this case, please refer to this [article|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/605ff5f2-e589-2910-3ead-e558376e6f3d]. And for the lookup string, even better check the new [EJB Lookup Scheme|http://help.sap.com/saphelp_nwce10/helpdata/en/45/e692b2cfaa5591e10000000a1553f7/frameset.htm].
HTH!
-- Vladimir
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Problem solved.
D:\usr\sap\CE1\J00\j2ee\j2eeclient\sap.comtcjeclientlibimpl.jar
should be addes as external library.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
71 | |
11 | |
10 | |
10 | |
10 | |
8 | |
7 | |
7 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.