grails - Grails 2 Spring Core插件-服务器请求基于密码的身份验证,但未指定密码

标签 grails spring-security grails-2.0

我已经在应用程序中安装了spring security core plugin。用s2-quickstart com.bahmanm.secureapp SecAppUser SecAppRole创建之后。我在我的域层中又获得了2个类SecAppRole.groovySecAppUser.groovy。我还添加了我的BootStrap.groovy:

class BootStrap {

  def init = { servletContext ->
    def adminRole = new SecAppRole(authority: 'ROLE_ADMIN').save(flush: true)
    def userRole = new SecAppRole(authority: 'ROLE_USER').save(flush: true)

    def testUser = new SecAppUser(username: 'admin', enabled: true, password: 'admin')
    testUser.save(flush: true)

    SecAppUserSecAppRole.create testUser, adminRole, true

    assert SecAppUser.count() == 1
    assert SecAppRole.count() == 2
    assert SecAppUserSecAppRole.count() == 1
  }

  def destroy = {
  }
}

但是,运行我的应用程序时,我得到:
|Loading Grails 2.3.4
|Configuring classpath
.
|Environment set to development
.................................
|Packaging Grails application
Precompiling AST Transformations ...
src C:\Users\GrailsWorkspace\testApplication\target\work\plugins\postgresql-extensions-0.6.1 C:\Users\GrailsWorkspace\testApplication\target\classes
Done precompiling AST Transformations!
..
|Compiling 3 source files
...................................................
|Running Grails application
Configuring Spring Security Core ...
... finished configuring Spring Security Core
Error |
2013-12-14 20:23:19,055 [localhost-startStop-1] ERROR pool.ConnectionPool  - Unable to create initial connections of pool.
Message: The server requested password-based authentication, but no password was specified.
    Line | Method
->>  444 | doAuthentication   in org.postgresql.core.v3.ConnectionFactoryImpl
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    173 | openConnectionImpl in     ''
|     64 | openConnection . . in org.postgresql.core.ConnectionFactory
|    136 | <init>             in org.postgresql.jdbc2.AbstractJdbc2Connection
|     29 | <init> . . . . . . in org.postgresql.jdbc3.AbstractJdbc3Connection
|     21 | <init>             in org.postgresql.jdbc3g.AbstractJdbc3gConnection
|     31 | <init> . . . . . . in org.postgresql.jdbc4.AbstractJdbc4Connection
|     24 | <init>             in org.postgresql.jdbc4.Jdbc4Connection
|    410 | makeConnection . . in org.postgresql.Driver
|    280 | connect            in     ''
|    334 | innerRun . . . . . in java.util.concurrent.FutureTask$Sync
|    166 | run                in java.util.concurrent.FutureTask
|   1110 | runWorker . . . .  in java.util.concurrent.ThreadPoolExecutor
|    603 | run                in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . . . . .  in java.lang.Thread
Error |
2013-12-14 20:23:19,222 [localhost-startStop-1] ERROR pool.ConnectionPool  - Unable to create initial connections of pool.
Message: The server requested password-based authentication, but no password was specified.
    Line | Method
->>  444 | doAuthentication   in org.postgresql.core.v3.ConnectionFactoryImpl
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    173 | openConnectionImpl in     ''
|     64 | openConnection . . in org.postgresql.core.ConnectionFactory
|    136 | <init>             in org.postgresql.jdbc2.AbstractJdbc2Connection
|     29 | <init> . . . . . . in org.postgresql.jdbc3.AbstractJdbc3Connection
|     21 | <init>             in org.postgresql.jdbc3g.AbstractJdbc3gConnection
|     31 | <init> . . . . . . in org.postgresql.jdbc4.AbstractJdbc4Connection
|     24 | <init>             in org.postgresql.jdbc4.Jdbc4Connection
|    410 | makeConnection . . in org.postgresql.Driver
|    280 | connect            in     ''
|    334 | innerRun . . . . . in java.util.concurrent.FutureTask$Sync
|    166 | run                in java.util.concurrent.FutureTask
|   1110 | runWorker . . . .  in java.util.concurrent.ThreadPoolExecutor
|    603 | run                in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . . . . .  in java.lang.Thread
Error |
2013-12-14 20:23:19,436 [localhost-startStop-1] ERROR pool.ConnectionPool  - Unable to create initial connections of pool.
Message: The server requested password-based authentication, but no password was specified.
    Line | Method
->>  444 | doAuthentication   in org.postgresql.core.v3.ConnectionFactoryImpl
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    173 | openConnectionImpl in     ''
|     64 | openConnection . . in org.postgresql.core.ConnectionFactory
|    136 | <init>             in org.postgresql.jdbc2.AbstractJdbc2Connection
|     29 | <init> . . . . . . in org.postgresql.jdbc3.AbstractJdbc3Connection
|     21 | <init>             in org.postgresql.jdbc3g.AbstractJdbc3gConnection
|     31 | <init> . . . . . . in org.postgresql.jdbc4.AbstractJdbc4Connection
|     24 | <init>             in org.postgresql.jdbc4.Jdbc4Connection
|    410 | makeConnection . . in org.postgresql.Driver
|    280 | connect            in     ''
|    334 | innerRun . . . . . in java.util.concurrent.FutureTask$Sync
|    166 | run                in java.util.concurrent.FutureTask
|   1110 | runWorker . . . .  in java.util.concurrent.ThreadPoolExecutor
|    603 | run                in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . . . . .  in java.lang.Thread
Error |
2013-12-14 20:23:19,468 [localhost-startStop-1] ERROR context.GrailsContextLoader  - Error initializing the application: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'lobHandlerDetector' while setting bean property 'lobHandler'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lobHandlerDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.postgresql.util.PSQLException: The server requested password-based authentication, but no password was specified.
Message: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'lobHandlerDetector' while setting bean property 'lobHandler'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lobHandlerDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.postgresql.util.PSQLException: The server requested password-based authentication, but no password was specified.
    Line | Method
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    166 | run       in java.util.concurrent.FutureTask
|   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'lobHandlerDetector' while setting bean property 'lobHandler'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lobHandlerDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.postgresql.util.PSQLException: The server requested password-based authentication, but no password was specified.
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    166 | run       in java.util.concurrent.FutureTask
|   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'lobHandlerDetector' while setting bean property 'lobHandler'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lobHandlerDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.postgresql.util.PSQLException: The server requested password-based authentication, but no password was specified.
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    166 | run       in java.util.concurrent.FutureTask
|   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'lobHandlerDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.postgresql.util.PSQLException: The server requested password-based authentication, but no password was specified.
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    166 | run       in java.util.concurrent.FutureTask
|   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . in java.lang.Thread
Caused by MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.postgresql.util.PSQLException: The server requested password-based authentication, but no password was specified.
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    166 | run       in java.util.concurrent.FutureTask
|   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . in java.lang.Thread
Caused by PSQLException: The server requested password-based authentication, but no password was specified.
->>  444 | doAuthentication in org.postgresql.core.v3.ConnectionFactoryImpl
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    173 | openConnectionImpl in     ''
|     64 | openConnection in org.postgresql.core.ConnectionFactory
|    136 | <init>    in org.postgresql.jdbc2.AbstractJdbc2Connection
|     29 | <init> .  in org.postgresql.jdbc3.AbstractJdbc3Connection
|     21 | <init>    in org.postgresql.jdbc3g.AbstractJdbc3gConnection
|     31 | <init> .  in org.postgresql.jdbc4.AbstractJdbc4Connection
|     24 | <init>    in org.postgresql.jdbc4.Jdbc4Connection
|    410 | makeConnection in org.postgresql.Driver
|    280 | connect   in     ''
|    334 | innerRun  in java.util.concurrent.FutureTask$Sync
|    166 | run       in java.util.concurrent.FutureTask
|   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . in java.lang.Thread
Error |
Forked Grails VM exited with error

但是,我的服务器没有密码?!?!此输出是什么意思?非常感谢您的回答!

最佳答案

这与Spring Security无关,这是数据库连接池错误:

2013-12-14 20:23:19,055 [localhost-startStop-1] ERROR pool.ConnectionPool  - Unable to create initial connections of pool.
Message: The server requested password-based authentication, but no password was specified.
    Line | Method
->>  444 | doAuthentication   in org.postgresql.core.v3.ConnectionFactoryImpl

检查您的DataSource.groovy连接信息。

关于grails - Grails 2 Spring Core插件-服务器请求基于密码的身份验证,但未指定密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20587347/

相关文章:

mysql - Grails 和 MySQL 分区

java - 在 Spring Security 登录期间设置 Grails/Spring Locale - 如何?

spring-boot - 使用 Spring Security 保护 Spring Cloud Gateway

grails - 无法运行Grails项目GGTS

grails - 如何为每个类实例设置唯一约束?

grails - 组合来自 params 数组的标准

mysql - Grails - 外部数据库 Controller 和域

java - Controller 中的 Grails 重定向从 https 切换到 http。为什么?

security - SHA1可以解密吗

unit-testing - Grails 与多个服务的集成测试