Not sure if the code you pasted is correct, however, you are missing a "new" keyword in front of the InitialContext(). Also, in your second try/catch block you are missing a call to new InitialContext(). I might be picky, but the source code you posted is not at all the source code that you are using (unless are you using a strange version of the Java Complier).
Can you isolate your problem into a small piece of code that works, and try to post again? Thanks. -AP_ http://www.alexparansky.com Java/J2EE Architect/Consultant http://www.myprofiles.com/member/profile/apara_personal -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Jesper Rasmussen Sent: Wednesday, May 01, 2002 3:10 AM To: Orion-Interest Subject: Initial context problem. Hi all, Im trying to make an application which askes for the login and password to connect to the application deployed on 1.5.4 orion server. It works fine if i specify the correct login(admin). However if I uses some wrong cridentials(admin1) i get an exception which also is fine. HOWEVER when i try to login again, without restarting the application) using the correct info I still get the old exception (javax.naming.AuthenticationException: Invalid username/password for beansApp (admin1)). If i close the app and login again with the correct it works fine. to me it seems like the enviroment i pass to the constructor of InitialContext is ignored the second time. I have tried to use close() to no avail. Does anyone have a clue?? Thanks! cheers JEsper ----------more or less the code that cause the bug! server="ormi://127.0.0.1/beansApp"; login="admin1"; password="123"; env = new java.util.Hashtable(); env.put("java.naming.provider.url",server); env.put("java.naming.factory.initial","com.evermind.server.ApplicationCl ientInitialContextFactory"); env.put("java.naming.security.principal",login); env.put("java.naming.security.credentials",password); InitialContext initial; try { initial = InitialContext(env); catch(NamingException e) { try { login="admin"; env = new java.util.Hashtable(); env.put("java.naming.provider.url",server); env.put("java.naming.factory.initial","com.evermind.server.ApplicationCl ientInitialContextFactory"); env.put("java.naming.security.principal",login); env.put("java.naming.security.credentials",password); } catch(NamingException ex) { //ACK. chould not get here!!! }