2013-12-08 19 views
6

Tôi mới sử dụng Grails. Tôi đang cố gắng để kết nối máy chủ cơ sở dữ liệu postgresql 9,0 với grails 2.3.4. Tôi đã thêm tập tin postgresql-9.0-801.jdbc3.jar vào thư mục lib của ứng dụng grails. Khi tôi đang chạy ứng dụng trên trình soạn thảo Intellij, sau đó nhận được lỗi sau. Tôi đang làm sai ở đâu?Cách kết nối cơ sở dữ liệu postgres với Grails 2.3.4

|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:[email protected] 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:[email protected] 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:[email protected] 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:[email protected] 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:[email protected] 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:[email protected] 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:[email protected] 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:[email protected] 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:[email protected] 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:[email protected] 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 file: -

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" 
     } 
    } 
} 

Trả lời

14

Hãy thử với một tiền tố khác nhau:

url = "jdbc:postgresql://localhost/clientpro" 
+0

Cảm ơn :) Nó làm việc –

+1

Bạn có thể đánh dấu câu trả lời của tôi là [chấp nhận] (http://stackoverflow.com/help/accepted-answer), nếu nó hoạt động cho bạn. Ngoài ra, các bản ghi hầu như không thể đọc được ở dạng hiện tại - tôi đã cố gắng chỉnh sửa chúng lúc đầu, nhưng nó không thực sự có thể (chỉ cần lưu ý trong lần sau). –

+0

Tôi không thể tin rằng chúng có cấu hình ngu ngốc như vậy. Nó cũng có tác dụng với tôi, nhưng nó có ý nghĩa để làm việc cho cả hai –

Các vấn đề liên quan