on 04-05-2005 7:12 PM
Hi there,
apparently I'm too dumb to use JNDI, and I would really appreciate if someone could help me out:
I have a WebDynpro that will be deployed to WAS instance A and that has to lookup an EJB that will be deployed to WAS instance B. A and B do not form a cluster.
I initialize my context like this:
prop.put(InitialContext.INITIAL_CONTEXT_FACTORY,"com.sap.engine.services.jndi.InitialContextFactoryImpl");
prop.put(InitialContext.PROVIDER_URL,remoteHost);
where remoteHost is a String variable containing the host name and port ("blablabla:50004").
Then I try to lookup a bean like this:
Object remoteReference = ctx.lookup("<vendor-prefix>/<application>/<bean>");
The lookup fails with a NamingException, telling me that there are no elements under <vendor-prefix>.
The JNDI tree of WAS B does contain the appropriate entry for the bean, and I have not problems looking it up if both applications reside on B.
What is it I'm missing here? Any hint appreciated!
Regards
Nils
Hi Nils,
Hope this link will help you....
http://help.sap.com/saphelp_nw04/helpdata/en/8b/2e2c4142aef623e10000000a155106/frameset.htm
Regards,
Vijith
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nils,
Anyway, have you tried with the "force_remote" property and with specifying the security credentials?
> the problem is not that the lookup
> is done on the wrong node, but that it is not done at all.
Why do you think so? If the lookup operation throws an exception then it is done but fails because the object cannot be found on the local node.
> By the way, I got the exception wrong; it's not a
> NamingException, but a NameNotFoundException.
NameNotFoundException extends NamingException and "is thrown when a component of the name cannot be resolved because it is not bound."
Best regards,
Vladimir
Dear Vladimir,
as to your posting this morning: by saying that the lookup is not done at all I merely meant to say that the link Vijith posted does not fit to my problem description.
As to your posting this afternoon: Yes, I did add "force_remote" and the credentials. And yes, it <i>is</i> a NamingException. Forget everything I said about the NameNotFoundException (seems I got puzzled by my own debugging attempts).
Actually I also got a NamingException when I tried the remote lookup from a "regular" J2EE component (servlet); it seems this is rather a security issue:
If I <i>don't</i> pass the credentials, the root exception is a
"P4BaseConnectionException: Incorrect client ID. The stub is not connected yet"
If I <i>do</i> pass the credentials, the root exception is a
"BaseLoginException: Cannot create new RemoteLoginContext instance"
Does that sound familiar to anyone? Do I have to tweak the configuration of the target WAS? Do I have to throw in any additional DCs?
Regards
Nils
Hi,
I tried working on your scenario..
Let me tell you what I did.
I created an ejb(say TestEjb) and deployed it on a server (say serverA) and created an application (say TestApp) and deployed it on a server (say serverB).
The JNDI name that I gave is <project name>/<some name>
The code for look up was as below
Hashtable ht=new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,"com.sap.engine.services.jndi.InitialContextFactoryImpl");
ht.put(Context.PROVIDER_URL,"serverA:50004");
Context ctx=new InitialContext(ht);
TestEjbHome myHome = (TestEjbHome)ctx.lookup("<package name>/<some name>");
TestEjb local=myHome.create();
now local.add(a,b); add() is a method in my TestEjb its working..
Regards
Noufal
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.