我的JSP项目中的Tomcat Realm(Forms)认证在我将操作系统改为linux之前运行良好,现在它不会:登录总是失败。Tomcat领域表格:登录总是失败
IDE是IDEA。
该项目采用:
- 8.0.9 Tomcat的JDBCRealm
- 的PostgreSQL 9.3
- Postgres的JDBC驱动程序是在/ WEB-INF/lib目录和可见的Hibernate作为
org.postgresql.Driver
- 的Postgres登陆&通过是正确的,表名也是正确的
更改我ñserver.xml中:
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm
className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
<Realm
className="org.apache.catalina.realm.JDBCRealm"
driverName="org.postgresql.Driver"
connectionURL="jdbc:postgresql://localhost:5432/postgres?user=postgres&password=123"
userTable="users"
userNameCol="name"
userCredCol="pass"
userRoleTable="user_roles"
roleNameCol="role"/>
</Realm>
...其实,我有什么都没有改变,除了移动LockOutRealm
到<Host>
标签并添加JDBCRealm
块成。
的web.xml
是正确的,因为它好工作之前...
为什么它不工作?也许这是关于Linux用户的 特权?
的pg_hba.conf:
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication postgres md5
#host replication postgres 127.0.0.1/32 md5
#host replication postgres ::1/128 md5
Postgres的日志:
2014-07-25 19:52:17 MSK LOG: database system was shut down at 2014-07-25 19:52:07 MSK
2014-07-25 19:52:17 MSK LOG: database system is ready to accept connections
2014-07-25 19:52:17 MSK LOG: autovacuum launcher started
2014-07-25 19:53:57 MSK LOG: incomplete startup packet
2014-07-25 19:53:59 MSK LOG: incomplete startup packet
2014-07-25 22:39:38 MSK LOG: unexpected EOF on client connection with an open transaction
2014-07-25 22:42:15 MSK LOG: unexpected EOF on client connection with an open transaction
请提供您的错误信息和设置“pg_hba.conf”。 –
@ErwinBrandstetter,我在你问的时候给Q添加了'pg_hba.conf'。关于错误 - 这里没有错误。它只是将我重定向到“登录失败”页面,就像我进入wrond pass – WildDev
你在数据库日志中看到什么错误消息? –