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

时间:2013-12-14 19:31:57

标签: 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

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

1 个答案:

答案 0 :(得分:4)

这与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连接信息。