Hi Sai,
Did you add the JNDI jar files (ldap.jar, jndi.jar etc..) to the
CLASSPATH prior to invoking JavaWebserver ?
If you run JWS with the -verbose option it should list the various
paths in the CLASSPATH and the JNDI jar files should be listed as well.
Send any other JWS specific questions to jserv-interest...
hope this helps,
-isa
]X-Sent: 10 Aug 1999 23:46:26 GMT
]Content-Disposition: inline
]Mime-Version: 1.0
]Date: Tue, 10 Aug 1999 16:46:26 -0700
]From: Sai Mattancheril <[EMAIL PROTECTED]>
]Subject: Cannot instantiate class: com.sun.jndi.ldap.LdapCtxFactory --
JWS/JDK1.2.2/JSDK2.1
]To: [EMAIL PROTECTED]
]
]Hi,
]
]I am trying to access an LDAP server using JNDI. I managed to get the
]code to work standalone. But when i try to run it as a servlet (
]i am using JavaWebServer with JDK1.2.2 and JSDK 2.1) i get the
]following NamingException.
]
]Cannot instantiate class: com.sun.jndi.ldap.LdapCtxFactory
]
]The snippet of code is given below.
]
]Thanks for your time
]Sai
]
]---------------------Code Snippet --------------------------------
]public void init() {
] env = new Hashtable(5, 0.75f);
] env.put(Context.INITIAL_CONTEXT_FACTORY,
] "com.sun.jndi.ldap.LdapCtxFactory");
] env.put(Context.PROVIDER_URL, "ldap://directory.company.com:389");
] nineYards = new Vector(10);
] spacer = "";
]
] try {
] ctx = new InitialDirContext(env);
] constraints = new SearchControls();
] constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
] }
] catch (NamingException e) {
] System.err.println("NamingException: " + e.getExplanation());
] e.printStackTrace();
] }
] }
]
]___________________________________________________________________________
]To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
]of the message "signoff SERVLET-INTEREST".
]
]Archives: http://archives.java.sun.com/archives/servlet-interest.html
]Resources: http://java.sun.com/products/servlet/external-resources.html
]LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html