简体   繁体   中英

JDBC Realm: GlassFish v2.1 = OK; GlassFish v3 = fail with invaliduserreason

In my J2EE 5 application I have a JDBC Realm based security with Form method. Encrypt method is MD5 as default. The database is PostgreSQL 8.4 installed locally (or 8.3 available via lan).

My app used to work finely on GlassFish v2.1 server with PostgreSQL 8.3, but now I need to deploy it on GlassFish v3. I am absolutely sure I have done all the same config on GFv3 like creating Connection Pool (which pings with no problem), JDBC Resource and JDBC Realm.

But on GFv3 I get login exception with "invaliduserreason" while the database schema is just created from the working database script. I have checked the data and entered login/password thousand times and it seems that data is all right.

So where can I find the reason of unworking security? Please, advice.

NetBeans 6.8 Thanks.

I had the same issue here. I resolved setting the security log to finest. I saw that jaas was querying the db in lowercase even though I used a camel notation in naming my fields in postgresql table.

The only solution I found was to name all my table and fields in lowercase in Postgresql server as well.

You might want to increase the logging for the security system. Go to Logger Settings -> Log Warnings and set logger name 'javax.enterprise.system.core.security' to trace. Try again and check the logs.

Try changing database tablenames to UPPERCASE. I had the exactly same problem as you have and changing tablenames to uppercase solved the problem for me.

Setting Digest Algorithm to "none" worked for me. I am using Glassfish 3.1 with Derby. In realm config i have name of tables in lowercase and userid and groupid are columns in the same table, so these things do not cause problems on Derby.

尝试将数据库名称添加到连接池中的属性Url中。此处隐藏的sqlexception表示未指定数据库名称。

这是一篇关于glassfish中的jdbc安全领域及其配置方法的不错的文章: http : //jugojava.blogspot.com/2011/02/jdbc-security-realm-with-glassfish-and.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM