【问题标题】:Grails 2 Spring Core Plugin - The server requested password-based authentication, but no password was specifiedGrails 2 Spring Core Plugin - 服务器请求基于密码的身份验证,但未指定密码
【发布时间】:2014-01-02 10:51:18
【问题描述】:

我已经在我的应用程序中安装了spring security core plugin。使用s2-quickstart com.bahmanm.secureapp SecAppUser SecAppRole 创建后。在我的域层中,我又获得了 2 个课程 SecAppRole.groovy 和 SecAppUser.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

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

【问题讨论】:

    标签: grails spring-security grails-2.0


    【解决方案1】:

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

    【讨论】:

    • 我的数据库用户没有密码!我需要密码还是可以让这个字段为空?
    • 我不确定,我不太使用 Postgres。您可能需要至少指定一个简单的密码。
    猜你喜欢
    • 1970-01-01
    • 2016-04-19
    • 1970-01-01
    • 2021-03-26
    • 2017-01-29
    • 1970-01-01
    • 2014-03-26
    • 2012-09-12
    • 1970-01-01
    相关资源
    最近更新 更多