cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding connection to JNDI using Local host

Former Member
0 Kudos

Hi,

I would really appreciate, if you could provide some help to connect to localhost.

I have 6.40 and I am writing a simple EJB module using nwds with hello message.

The following things have been set up.

1. Loop back adapter 10.10.0.10

2. In the host file I have put an entry 10.10.0.10 WJDSOUZA

3. In the NWDS message serverhost localhost port 3601.

4. the NWDS show j2ee engine shows all green ( sdm.dispatcher,server)

The following java gives me JNDI error

System.out.print("\nInitializing JNDI properties ... ");

Properties jndiCtxProp = new java.util.Properties();

jndiCtxProp.put(Context.INITIAL_CONTEXT_FACTORY,

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

jndiCtxProp.put(Context.PROVIDER_URL, "WJDSOUZA:3601");

System.out.print("done");

System.out.print("\nInstantiating JNDI Context ... ");

Context jndiCtx = new InitialContext(jndiCtxProp);

System.out.print("done");

The error is

Initializing JNDI properties ... done

Instantiating JNDI Context ... com.sap.engine.services.jndi.persistent.exceptions.NamingException: Exception while trying to get InitialContext. [Root exception is com.sap.engine.interfaces.cross.DestinationException: cannot establish connection with any of the available instances:

WJDSOUZA:3601 Reason: Cannot open connection on host: 10.10.0.10 and port: 3601]

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

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 com.ibm.training.ejb.test.go(test.java:47)

at com.ibm.training.ejb.test.main(test.java:25)

Caused by: com.sap.engine.interfaces.cross.DestinationException: cannot establish connection with any of the available instances:

WJDSOUZA:3601 Reason: Cannot open connection on host: 10.10.0.10 and port: 3601

at com.sap.engine.interfaces.cross.Destination.getNextAvailableBroker(Destination.java:53)

at com.sap.engine.interfaces.cross.Destination.getRemoteBroker(Destination.java:33)

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

... 6 more

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Go to command prompt. try to establish a conenction to the host WJDSOUZA on port 3601 using telnet. i.e. <b>telnet WJDSOUZA 3601</b>

if this goes through then you dont have any network issues.

check if you have proxy settings turned on for NWDS. this can be checked in

Window>Preferences>Workbench-->Proxy Settings.

Answers (5)

Answers (5)

Former Member
0 Kudos

1. Created MS loopback adapter ip 10.10.0.10 The firewall was blocking the connectivity.

2. the file hosts should have an entry 10.10.0.10 <hostname>

3. check the connectivity to this ip address

as suggested by Amol and Vladamir to check the network. go to Run enter cmd (ms-dos) and enter telnet <HOSTNAME> 50004 must be connected.

4. check J2EE in nwds. hosts localhost port 3601. all SDM,dispatcher should be green

Former Member
0 Kudos

Amol,

I think I have fixed the problem. I am able to run the client application.

Could you let me know VA's exe file name.

thanks

Former Member
0 Kudos

if you are on windows then go.bat is the name of VA script.

it is found in

usr/sap/<SID>/.../j2ee/admin

Former Member
0 Kudos

Amol and Vladamir

The initial problem is now resolved. The network working.

I pinged and telnet WJDSOUZA 50004 -- it's connect.

Thanks to your immense help and tip. I give both full points.

Since, I am new, I am struggling to get going. I need your help

1. In local WAS what is VA's exe name

2. After connecting to the network the, the code below gives me an error. I checked everything and unable trace the problem.

jndiCtxProp.put(Context.PROVIDER_URL, "WJDSOUZA:50004");

System.out.print("done");

System.out.print("\nInstantiating JNDI Context ... ");

Context jndiCtx = new InitialContext(jndiCtxProp);

System.out.print("done");

System.out.print("\nAccessing Bean's Home Interface with JNDI lookup ... ");

Object obj =(Object) jndiCtx.lookup("ibm.com/ExDSSimpleEjbApp_01/HelloEJBBean");

System.out.print("done");

Initializing JNDI properties ... done

Instantiating JNDI Context ... done

Accessing Bean's Home Interface with JNDI lookup ... com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Path to object does not exist at ibm.com, the whole lookup name is ibm.com/ExDSSimpleEjbApp_01/HelloEJBBean.

at com.sap.engine.services.jndi.implserver.ServerContextImpl.getLastContainer(ServerContextImpl.java:258)

--- more erros

Former Member
0 Kudos

Thank you Amol and Vladamir.

Amol, telnet WJDSOUZA 3601 could not connect. So network problem. What could be the reason, can you please provide some help to fix this.

I have the following in hosts file

127.0.0.1 localhost

#NWSABAP

10.10.0.10 WJDSOUZA

Microsoft Loopback Adapter - The status is enabled.

TCP/IP address 10.10.0.10

Vladamir,

Your tip is important and appreciated. I will reply to you by tomorrow.

Thank you both and good night.

Former Member
0 Kudos

william,

as mentioned by vladimir, for connecting to your JNDI service for lookup, you need to connect to your P4 port...if you need to find out the P4 port then

Start / Log on to Visual administrator.

Go to Server / Services / P4 Provider.

In the right pane you will see Info tab where the Remote Port is mentioned.

-- Amol

Vlado
Advisor
Advisor
0 Kudos

Hi William,

When creating the InitialContext you should give the p4 port, not the message server port, e.g.

jndiCtxProp.put(Context.PROVIDER_URL, "localhost:50004");

Check <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/0736159e-0301-0010-9ea4-c63d83d0797b">this</a> article.

HTH!

-Vladimir