cancel
Showing results for 
Search instead for 
Did you mean: 

calling a bean method which is residing in different server

brahmanandam_ausali
Participant
0 Kudos

hi all.

I have two j2ee servers let's say S1,S2.

in server S1 i am deploying webdynpro application,

from this webdynpro applicatition i want to call

bean method which is deployed in server S2.

presently i am using below code.

Properties props = new Properties();

props.put(Context.INITIAL_CONTEXT_FACTORY,"com.sap.engine.services.jndi.InitialContextFactoryImpl");

props.put(Context.PROVIDER_URL,"172.25.8.195:50004");

Context con = new InitialContext(props);

Object obj = con.lookup("MESSAGEJNDI");

MessageGetHome mhome = (MessageGetHome)PortableRemoteObject.narrow(obj,MessageGetHome.class);

MessageGet bean = (MessageGet)mhome.create();

String rs = bean.recievemessage(1);

BUT NOT WORKING PROPERLY.

GIVING NAMING EXCEPTION.

WAITING FOR UR VALUABLE RESPONSES.

thanks in advance.

regards

brahm,anandam ausali

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos

Hi brahm,

1) try to specify

Context.SECURITY_PRINCIPAL with username and

Context.SECURITY_CREDENTIALS with password

2) to check JNDI name of EJB go to Visual Administrator->Services->EJB Container, choose your EJB and check "JNDI name" property.

Best regards, Maksim Rashchynski.

brahmanandam_ausali
Participant
0 Kudos

hi Maksim,

what is the username and password, is it same as

WAS user name and password,

i am confusing with the username and password.

thanks,

regards ,

brahmanandam

former_member182372
Active Contributor
0 Kudos

Hi brahm,

Yes, you are right. It is user name and password from UME on WAS. Same as you use to login to WD application.

Best regards, Maksim Rashchynski.

brahmanandam_ausali
Participant
0 Kudos

hi Maksim ,

thanks for your immediate reply .

i have provided all the details for the intial context.

like,

Properties props = new Properties();

props.put(Context.INITIAL_CONTEXT_FACTORY,"com.sap.engine.services.jndi.InitialContextFactoryImpl");

props.put(Context.PROVIDER_URL,"172.17.51.25:50004");

props.put(Context.SECURITY_PRINCIPAL, "administrator");

props.put(Context.SECURITY_CREDENTIALS, "Hamper1*");

i am getting the following error, can you please see and

tell me what could be the reason.

Error getting the server-side naming service functionality during getInitialContext operation

regards ,

Brahmanandam Ausali

former_member182372
Active Contributor
0 Kudos

Hi Brahmanandam,

Try to replace IP addres with hostname.

Best regards, Maksim Rashchynski.

brahmanandam_ausali
Participant
0 Kudos

hi Maksim,

i tried with hostname,

still it is not working.

i appreciate your intrest in solving my problem.

thank you.

regards.

Brahmanandam

former_member182372
Active Contributor
0 Kudos

Hi Brahmanandam,

Check username/password and hostname/port for P4 service (you can check it in Visual Administrator - it appears by logging in) and check this http://help.sap.com/saphelp_nw04/helpdata/en/a2/f9d7fed2adc340ab462ae159d19509/frameset.htm . May be you have more than one instance on your server. For me, port is for example - 50204. The rest seems to be OK. Could you post the whole stacktrace of exception?

Best regards, Maksim Rashchynski.

brahmanandam_ausali
Participant
0 Kudos

hello Maksim ,

i am getting the following exception trace,

can u please look into it and tell me what could be the problem.

com.sap.engine.services.jndi.persistent.exceptions.NoPermissionException: Exception during getInitialContext operation. Wrong security principle/credentials. [Root exception is com.sap.engine.services.security.exceptions.BaseLoginException: User not authorized.]

please suggest solution for it.

thank you,

regards,

Brahmanandam Ausali

former_member182372
Active Contributor
0 Kudos

Hi Brahmanandam,

Seems like your user is not authorized to call EJB, or username and/or password are not correct.

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Hi,

I am facing the same 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

Answers (0)