users@glassfish.java.net

Re: Cannot use JDBC Realm with MySQL Database

From: Witold Szczerba <pljosh.mail_at_gmail.com>
Date: Sat, 3 Nov 2007 11:44:17 -0700

If you don't use digesting for password - try typing none as an
digest algorithm. I've lost some time because of this parameter.

2007/11/3, glassfish_at_javadesktop.org <glassfish_at_javadesktop.org>:
> I´m trying to get Glassfish to work with a JDBC Realm since 4 days, it does
> not work. I have a really simple web application with only one role and only
> one servlet that requires authentication/authorization (BASIC). The required
> user and group tables are stored in a MYSQL-Database. I´ve tried all and
> everything to get JDBC Realm to work, it still refuses to work.
>
> This is the error I get in "server.log" when i try to access the servlet and
> type in the user information that can be found in the user/group tables of
> the database:
>
>
> [#|2007-11-03T16:36:17.407+0100|SEVERE|sun-appserver9.1|javax.enterprise.system.core.security|_ThreadID=20;_ThreadName=httpSSLWorkerThread-8080-0;webuser;_RequestID=d5c8794c-007e-4a23-888c-b94a3a3e272e;|SEC1112:
> Cannot validate user [webuser] for JDBC realm.|#]
>
> [#|2007-11-03T16:36:17.409+0100|INFO|sun-appserver9.1|javax.enterprise.system.core.security|_ThreadID=20;_ThreadName=httpSSLWorkerThread-8080-0;webuser;|SEC5046:
> Audit: Authentication refused for [webuser].|#]
>
> [#|2007-11-03T16:36:17.410+0100|WARNING|sun-appserver9.1|javax.enterprise.system.container.web|_ThreadID=20;_ThreadName=httpSSLWorkerThread-8080-0;_RequestID=d5c8794c-007e-4a23-888c-b94a3a3e272e;|Web
> login failed: Login failed: javax.security.auth.login.LoginException:
> Security Exception|#]
>
>
> There are no additional errors/warnings when building/deploying the WebApp.
>
> I really do not believe that the mistake can be found within my WebApp. When
> I switch from JDBC Realm to File-Realm (in web.xml) everything works
> perfect.
>
> I also tested my database. It can be accessed via another WebApp that I
> built to test the database. Also, from within the admin console you can ping
> the database without a problem. ConnectionPool and DataSource work both
> without a problem (I do know that I don´t need both).
>
> I also checked the domain.xml. The configuration information is exactly the
> same as in Admin Console. There is no mistake in my jdbc realm configuration
> (case-sensitivity, writing mistakes etc.). I rebuilt the database and
> user/group tables several times and renamed the tables and table entries.
>
> I followed the explanations from these tutorials (especially, I used the sql
> statements as a basis to create my own database tables):
>
> http://blogs.sun.com/swchan/entry/jdbcrealm_in_glassfish_with_mysql
> http://blogs.sun.com/swchan/entry/jdbcrealm_in_glassfish
> http://developinjava.com/readarticle.php?article_id=6
>
> Is there anything that I could have forgotten to check? Maybe you know. I
> can also post the complete config info and sources, but as i said, my WebApp
> works perfectly when I choose File-Realm instead of JDBC Realm. And I can
> also ping and access my database. And I checked the JDBC Realm configuration
> information (including JDBC Resources) several times.
>
>
> I used:
>
> Windows Vista x32 Home Premium
> Sun Java System Application Server 9.1 (build b58g-fcs)
> MySQL 5.0.45-community-nt
> mysql-connector-java-5.1.5
> [Message sent by forum member 'zebhed' (zebhed)]
>
> http://forums.java.net/jive/thread.jspa?messageID=243667
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>