postgresql – 如何使用Grails 2.3.4连接postgres数据库

前端之家收集整理的这篇文章主要介绍了postgresql – 如何使用Grails 2.3.4连接postgres数据库前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我是Grails的新手.我正在尝试使用grails 2.3.4连接 postgresql 9.0数据库服务器.我已将postgresql-9.0-801.jdbc3.jar文件添加到grails应用程序的lib文件夹中.当我在Intellij编辑器上运行应用程序时,会出现以下错误.
哪里我做错了?
|Running Grails application Error | 2013-12-08 18:44:55,837 [localhost-startStop-1] ERROR pool.ConnectionPool - Unable to create initial connections of pool. Message: Driver:org.postgresql.Driver@7c3b99 returned null for URL:jdbc:postgres://localhost/clientpro Line | Method ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
| 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Error | 2013-12-08 18:44:55,877 [localhost-startStop-1] ERROR pool.ConnectionPool - Unable to create initial connections of pool. Message: Driver:org.postgresql.Driver@1ab5d6d returned null for URL:jdbc:postgres://localhost/clientpro Line | Method ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
| 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Error | 2013-12-08 18:44:56,160 [localhost-startStop-1] ERROR pool.ConnectionPool - Unable to create initial connections of pool. Message: Driver:org.postgresql.Driver@6bf551 returned null for URL:jdbc:postgres://localhost/clientpro Line | Method ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
| 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Error | 2013-12-08 18:44:56,174 [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 java.sql.sqlException: Driver:org.postgresql.Driver@6bf551 returned null for URL:jdbc:postgres://localhost/clientpro 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 java.sql.sqlException: Driver:org.postgresql.Driver@6bf551 returned null for URL:jdbc:postgres://localhost/clientpro Line | Method ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
| 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | 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 java.sql.sqlException: Driver:org.postgresql.Driver@6bf551 returned null for URL:jdbc:postgres://localhost/clientpro ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
| 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | 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 java.sql.sqlException: Driver:org.postgresql.Driver@6bf551 returned null for URL:jdbc:postgres://localhost/clientpro ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
| 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | 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 java.sql.sqlException: Driver:org.postgresql.Driver@6bf551 returned null for URL:jdbc:postgres://localhost/clientpro ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
| 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Caused by MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.sqlException: Driver:org.postgresql.Driver@6bf551 returned null for URL:jdbc:postgres://localhost/clientpro ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
| 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Caused by sqlException: Driver:org.postgresql.Driver@6bf551 returned null for URL:jdbc:postgres://localhost/clientpro ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
| 138 | run in java.util.concurrent.FutureTask | 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 918 | run in '' ^ 662 | run . . in java.lang.Thread Error | Forked Grails VM exited with error Process finished with exit code 1

DataSource文件: –

dataSource {
   pooled = true
   driverClassName = "org.postgresql.Driver"
   dialect = org.hibernate.dialect.PostgresqlDialect
   username = "postgres"
   password = "password"
}
hibernate {
   cache.use_second_level_cache = true
   cache.use_query_cache = true
   cache.provider_class='org.hibernate.cache.EhCacheProvider'
}
// environment specific settings
environments {
   development {
      dataSource {
         dbCreate = "update"
         url = "jdbc:postgres://localhost/clientpro"
         username = "postgres"
         password = "password"
      }
   }
   test {
      dataSource {
         dbCreate = "update"
         url = "jdbc:postgres://localhost/clientpro"
         username = "postgres"
         password = "password"
      }
   }
   production {
      dataSource {
         dbCreate = "update"
         url = "jdbc:postgres://localhost/clientpro"
         username = "postgres"
         password = "password"
      }
   }
}
尝试使用不同的前缀:
url = "jdbc:postgresql://localhost/clientpro"
原文链接:https://www.f2er.com/postgresql/191815.html

猜你在找的Postgre SQL相关文章