on 10-06-2004 8:25 AM
I can't seem to be able to lookup a LocalHome interface.
I have a session bean, TestEJBBean, created with both Local and Remote interfaces.
In both ejb-jar.xml and ejb-j2ee-engine.xml, I've created ejb-ref and ejb-local-ref entries. For ejb-ref, I specified the JNDI name as "test/TestEJBBean" whereas for ejb-local-ref, the name is "test/LocalTestEJBBean".
This is the code i used to lookup:
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
properties.put(Context.PROVIDER_URL, "localhost:50004");
properties.put(Context.SECURITY_PRINCIPAL, "Administrator");
properties.put(Context.SECURITY_CREDENTIALS, "sap");
InitialContext ctx = new InitialContext(properties);
TestEJBLocalHome home = (TestEJBLocalHome) ctx.lookup("test/LocalTestEJBBean");
TestEJBLocal local = home.create();
I have no problem looking up the Remote interface using "test/TestEJBBean" but looking up the Local interface throws the following error.
com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Object not found in lookup of LocalTestEJBBean.
at com.sap.engine.services.jndi.implserver.ServerContextImpl.lookup(ServerContextImpl.java:646)
at com.sap.engine.services.jndi.implserver.ServerContextRedirectableImpl.lookup(ServerContextRedirectableImpl.java:80)
at com.sap.engine.services.jndi.implserver.ServerContextImplp4_Skel.dispatch(ServerContextImplp4_Skel.java:555)
at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:292)
at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:183)
at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:118)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:151)
-
predecessor system -
com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Object not found in lookup of LocalTestEJBBean.
at com.sap.engine.services.jndi.implserver.ServerContextImpl.lookup(ServerContextImpl.java:646)
at com.sap.engine.services.jndi.implserver.ServerContextRedirectableImpl.lookup(ServerContextRedirectableImpl.java:80)
at com.sap.engine.services.jndi.implserver.ServerContextImplp4_Skel.dispatch(ServerContextImplp4_Skel.java:555)
at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:292)
at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:183)
at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:118)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:151)
The localhome lookup is resolved.
It was a user problem. Haha. The EJBs are deployed on the J2EE server jvm but the accessing client is not part of that jvm, that's why i cannot get the localhome. Localhomes can only be looked up by clients if they are in the SAME jvm.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi there,
> Localhomes can only be looked up by clients
> if they are in the SAME jvm.
Sure. I didn't have the idea that you are trying to access a localHome not the local way...
Best regards
Detlev
PS: Nevertheless, if you will try to access a localHome the local way sometimes, remember to use the right prefix like "localejbs". This and the trick where to look for have been helpful, haven't they?! (KnickKnack, it seems you haven't ever had the great experience to press the yellow star button at the replies?! Try it! It's great! Flowers are immediately raining from heaven, really. And even if you are the unlucky guy of the day for whom this magic doesn't work, at least you will be able to honor the guys who helped you by awarding some points.)
tried that. still does not work
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi there,
at the moment, I have no 6.40 running at hand. So I just would advise you to look for this prefix ("localejbs") which may differ at your site, but for sure is configurable, at your J2EEE server.
This should be the right path to the solution (my coding came from an own project, and it did work).
Hope it helps
Detlev
Hi,
in addition to what Detlev said, you can use the Visual Administrator and open the JNDI Registry Service runtime screen to browse the whole JNDI tree. There you can see where the local reference is bound (and hence, derive the exact lookup string to use).
However, I have a question for you - where do you lookup your bean from? Is it another bean that has a reference to your session bean? If so, why don't you look the bean up relative to the java:comp/env context, rather than the JNDI root? E.g. use the following code:
TestEJBLocalHome home = (TestEJBLocalHome) ctx.lookup("java:comp/env/test/LocalTestEJBBean");
For more info on that, see this page in the documentation:
http://help.sap.com/saphelp_nw04/helpdata/en/56/c8633e0084e946e10000000a114084/frameset.htm
Hope this will be of some help.
Hi there,
please try
TestEJBLocalHome home = (TestEJBLocalHome) ctx.lookup("localejbs/test/LocalTestEJBBean");
Hope it helps
Detlev
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.