cancel
Showing results for 
Search instead for 
Did you mean: 

Problem getting InitialContext

Former Member
0 Kudos

Hi all,

unfortunately I am getting the following exception, while trying to get an InitialContext from a WebAS for remote calling an ejb:

com.sap.engine.services.jndi.persistent.exceptions.NamingException: Exception while trying to get InitialContext. [Root exception is com.sap.engine.services.security.exceptions.BaseLoginException: Cannot create new RemoteLoginContext instance.]

at com.sap.engine.services.jndi.InitialContextFactoryImpl.getInitialContext(InitialContextFactoryImpl.java:532)

at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)

at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)

at javax.naming.InitialContext.init(InitialContext.java:219)

at javax.naming.InitialContext.<init>(InitialContext.java:195)

at src.EJBRemoteClient.main(EJBRemoteClient.java:24)

Caused by: com.sap.engine.services.security.exceptions.BaseLoginException: Cannot create new RemoteLoginContext instance.

at com.sap.engine.services.security.remote.login.RemoteLoginContext.<init>(RemoteLoginContext.java:98)

at com.sap.engine.services.jndi.implclient.LoginHelper.clientSideLogin(LoginHelper.java:78)

at com.sap.engine.services.jndi.InitialContextFactoryImpl.getInitialContext(InitialContextFactoryImpl.java:396)

... 5 more

Caused by: com.sap.engine.services.rmi_p4.P4RuntimeException: Unexpected exception.Nested exception is:

java.io.EOFException: End of stream is reached unexpectedly during input from Socket[addr=/10.62.145.243,port=50104,localport=1310]

at com.sap.engine.services.rmi_p4.P4ObjectBrokerClientImpl.getException(P4ObjectBrokerClientImpl.java:591)

at com.sap.engine.services.rmi_p4.P4ObjectBrokerClientImpl.getException(P4ObjectBrokerClientImpl.java:561)

at com.sap.engine.services.security.remote.RemoteSecurity_Stub.getRemoteLoginContext(RemoteSecurity_Stub.java:674)

at com.sap.engine.services.security.remote.login.RemoteLoginContext.<init>(RemoteLoginContext.java:93)

... 7 more

Does anybody know how to solve this problem?

Thank you for your help.

Kind regards, Patrick.

Accepted Solutions (0)

Answers (2)

Answers (2)

sridhar_k2
Active Contributor
0 Kudos

Patrick,

Use the below code to get inital context for system.

Properties p = new Properties();

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

p.put(Context.PROVIDER_URL,"epserver:50204");

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

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

p.put("force_remote", "true");

InitialContext context = new InitialContext(p);

Object o = context.lookup("sap.com/BAPIServiceEAR/BAPIClientEJBBean");

I guess you are not pointing to correct Name from Intial Context, Give correct EJB - JNDI Name. You can get correct name from EJB container -> beans -> From your <ejbear> file -> <ejb>.jar -> EJBBean -> JNDI Name.

Regards,

Sridhar

Former Member
0 Kudos

Hello

maybe there is something wrong with username / password

if not could you please post (parts of) your code

regards franz