Using windowxp ,jboss3.0 and jbuilder7 IDE. It samed that the problem happened at the code:
DirContext ctx=new InitialDirContext(ht);
/////without this code,nothing errors happen.
My intention is just to confirm I can connect to the jnp server in jboss,of cource,I run jboss first.
the original code is:
import javax.naming.*;
import javax.naming.directory.*;
import java.util.*;
public class test {
public test() {
}
public static void main(String arg[]){
System.out.println("begin");
System.out.println(Context.INITIAL_CONTEXT_FACTORY);
Hashtable ht=new Hashtable();
try{
ht.put (Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
ht.put(Context.PROVIDER_URL,"jnp://localhost:9901/");
ht.put(Context.URL_PKG_PREFIXES,"org.jnp.interfaces.NamingContextFactory");
DirContext ctx=new InitialDirContext(ht);
}
catch(Exception e){
e.printStackTrace();
}
}
}