cancel
Showing results for 
Search instead for 
Did you mean: 

Local Vs Remote EJB

Former Member
0 Kudos

Hi All,

Local Ejb works but Remote EJB Fails to work in lookup.

I am facing Remote EJB problem, I am able to look ejb locally on same server, but remotely it is not working.

here is the sample code!

env.put(Context.PROVIDER_URL, "10.48.121.207:53004"); //p4 port

// env.put("force_remote", "true");

env.put(Context.SECURITY_PRINCIPAL, "Administrator");

env.put(Context.SECURITY_CREDENTIALS, "sapxxx");

InitialContext ctx = new InitialContext(env);

//Object obj = ctx.lookup("RiskAnalysis");

Object obj = ctx.lookup("java:comp/env/ejb/RiskAnalysisBean");

Please advise, what could be the problem, I did all possible things, adding ejb-ref and updating the .xml files with required ref attributes on both EJB and client applications, but still remote lookup is failing!

Please send me sample working ejb and client example for remote lookup, I am working on NW700 with sp12.

Thanks for your information,

Anil

Accepted Solutions (0)

Answers (3)

Answers (3)

Vlado
Advisor
Advisor
0 Kudos

Hi Anil,

Since you're on NW 7.0 this article should be helpful:

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/java/accessing%20e...

HTH!

-- Vladimir

Former Member
0 Kudos

Hi Vladimir,

Good day to you!

I am still facing the remote lookup issue, I created a sample project to test Remote lookup, but it fails to lookup, what could be the reason.

How to see JDNI server is running or not, when I did telnet and try to exeute ADD NAMING, its giving error

Telnet Administration

SAP J2EE Engine v7.00

Login: administrator

Password:

>add naming

There aren't commands from NAMING group in the CommandContext.

>

>lsp

LSP: Used Ports by the current cluster element

Ports used by the ClusterManager:

53000 --> http

53001 --> http|ssl

53002 --> iiop

53003 --> iiop|ssl

53004 --> p4

53005 --> p4|httptunneling

53006 --> p4|ssl

53007 --> iiop

53008 --> telnet

53010 --> jms_provider

I suspect the JNDI server is not running, and that’s why I could not do remote lookup! How to start the JNDI servie when I went to Visual Admin Tool, when I right click on JNDI Service Node, the Start and Stop button on the context menu are disabled!

Please advise your valueable suggestions on this!

I will be waiting for your reply.

Thanks

Anil

Vlado
Advisor
Advisor
0 Kudos

Hi Anil,

Have you followed the article I mentioned above?

What do you mean "remote lookup fails", what is the exception you get? Eneko already asked you about that. W/o any details nobody can tell "what could be the reason"...

Regards,

\-- Vladimir

P.S. ADD NAMING gives you an error because when you login to telnet you go to a dispatcher node, and jndi service is running on the server nodes. You cannot start/stop it in VA because it's a core service.

P.P.S. Please don't cross-post by mail. Have you already read the [Rules of Engagement|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]?

Former Member
0 Kudos

Hi Anil,

Which exception is thrown?

Here is an example:

Properties p = new Properties();

p.put(Context.INITIAL_CONTEXT_FACTORY,

"com.sap.engine.services.jndi.InitialContextFactoryImpl");

p.put(Context.PROVIDER_URL, "url:port");

p.put(Context.SECURITY_PRINCIPAL, "myuser");

p.put(Context.SECURITY_CREDENTIALS, "mypass");

javax.naming.Context context = new javax.naming.InitialContext(p);

Object ob=context.lookup("RiskAnalysis");

MiClass_PortTypeHome home= (MiClass_PortTypeHome) PortableRemoteObject.narrow(ob,MiClass_PortTypeHome.class);

MyClass_PortTypeRemote remote=home.create();

remote.method();

The main differences between local and remote calling are the narrow method, and the removal of the localejb from JNDI string at lookup.

Sorry for my english,

Hope this helps you.

Eneko.

Former Member
0 Kudos