Jndi Provider Url not working

Hi,

I got the following exception message when i run the given JNDI example on Sun Java Application Server8.1.

Please help me in resolving this issue;

Exception:

javax.naming.CommunicationException: localhost:389 [Root exception is java.net.ConnectException: Connection refused: connect]

import javax.naming.*;

import java.util.*;

public class JndiExample {

public static void main(String[] args) {

try{

Properties props = new Properties();

props.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");

props.put(Context.PROVIDER_URL,"ldap://localhost:389");

Context ctx = new InitialContext(props);

}catch(Exception ex) { ex.printStackTrace();}

}

[766 byte] By [raghav_apia] at [2007-11-27 10:21:40]
# 1

Do you have an LDAP Server running and listening on port 389 on localhost ?

It seems that the application cannot open the network connection to the LDAP server.

Ludovic.

ludovicpa at 2007-7-28 17:11:22 > top of Java-index,Core,Core APIs...
# 2

Hi Ludovic,

I dont have ldap server running on my system. I thought sun application server may include ldap server (like weblogic includes t3 ) that starts as soon as app server starts

.

How do i know that ldap server running on 389 port. is there any way to find. i typed ldap://localhost:389 on ie browser. it did not work out.

Please reply me .

Thanks.

raghav_apia at 2007-7-28 17:11:22 > top of Java-index,Core,Core APIs...
# 3

dude you can port scan if there is an open port in that area.

friendly post :)

GOOD DAY

2pinga at 2007-7-28 17:11:22 > top of Java-index,Core,Core APIs...
# 4

try the command telnet, for example:

telnet xxx.xxx.xxx.xxx 389

if there is none service on port 389 ,you will see an error:

can't open xxx.xxx.xxx.xxx on port 389

heartOfOaka at 2007-7-28 17:11:22 > top of Java-index,Core,Core APIs...
# 5

Its working fine.

Through telnet i am able to know the status of service on port 389. Earlier i tried with ping , here i can not specify port number.

Thanks.

raghav_apia at 2007-7-28 17:11:22 > top of Java-index,Core,Core APIs...