3

I'm building an application using the OpenCmis library to communicate with Cmis repositories. The librairy itself call REST services using the HttpUrlConnection object. So I don't have any access to the connection object. The authentication is made directly by the transport protocol: So the server returns a "http error 401 Unauthorize" when the provided credentials are wrong, the library catch the exception, raised a CmisSomethingException, the application manages it and everything works fine.

Everything works fine, until I tried to test the application outside my dev environment. The application is started from a JNLP and when I use it from there... some internal Java handling seems to outrun the library handling, catch the 401 error and pop a Java login dialog asking for credentials.

It works well if the user provides valid username and password. The login dialog is re-showned if the credentials are wrong. And finally, the 401 error is finally catched by the librairy (and passed to the application) if the login dialog is cancelled by the user.

The Look, the functionnalites and the feedback provided by this dialog to the user are not what we want.

Does anybody now how to "bypass/get rid of" this dialog when using the app from Java web start???

Thanks

Jeff

  • See also [Unwanted login dialog when running application from a JNLP](http://forums.oracle.com/forums/thread.jspa?threadID=2251865) at OTN. – Andrew Thompson Jul 12 '11 at 21:00
  • If you need to pass authentication information, check out this [answer][1] [1]: http://stackoverflow.com/questions/5171032/how-to-handle-multiple-authenticator/7535951#7535951 – Mike Sep 23 '11 at 23:56

2 Answers2

2

Look at java.net.Authenticator and method setDefault(java.net.Authenticator).

To sum up, adding this line of code at the beginning helped:

Authenticator.setDefault(new Authenticator());
zacheusz
  • 8,750
  • 3
  • 36
  • 60
0

if you can't find it, try to set a breakpoint in the constructor of JDialog and run the JNLP with remote debugging enabled. That should give you an idea who displays the dialog which might give you an idea why it happens.

Community
  • 1
  • 1
Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820