简体   繁体   English

JDBC领域:GlassFish v2.1 = OK; GlassFish v3 =因无效的用户原因而失败

[英]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. 在我的J2EE 5应用程序中,我具有使用Form方法的基于JDBC Realm的安全性。 Encrypt method is MD5 as default. 加密方法默认为MD5。 The database is PostgreSQL 8.4 installed locally (or 8.3 available via lan). 该数据库是本地安装的PostgreSQL 8.4(或可通过lan获得的8.3)。

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. 我的应用程序过去可以在带有PostgreSQL 8.3的GlassFish v2.1服务器上正常运行,但是现在我需要将其部署在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. 我绝对确定我已经在GFv3上完成了所有相同的配置,例如创建连接池(可以ping正常),JDBC资源和JDBC领域。

But on GFv3 I get login exception with "invaliduserreason" while the database schema is just created from the working database script. 但是在GFv3上,我只是从工作数据库脚本中创建了数据库模式,却出现了“ invaliduserreason”登录异常。 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. NetBeans 6.8谢谢。

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. 我看到jaas正在用小写查询数据库,即使我在名称postgresql表中的字段时使用了骆驼符号。

The only solution I found was to name all my table and fields in lowercase in Postgresql server as well. 我发现的唯一解决方案是在Postgresql服务器中也用小写字母命名所有表和字段。

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. 转到记录器设置->记录警告,并将记录器名称'javax.enterprise.system.core.security'设置为要跟踪。 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. 我在使用Derby的Glassfish 3.1。 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. 在领域配置中,我使用小写形式的表名,而userid和groupid是同一表中的列,因此这些事情不会在Derby上引起问题。

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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