0
我在本地運行grails 2.4.4。我有以下域類:grails在運行grails生成命令時拋出異常
class MyClass {
byte[] posterImage
String posterType
String posterName
static belongsTo = NicheChannel
static constraints = {
posterImage(nullable: true, maxSize: 16384000 /* 16000k */)
posterType(nullable: true)
}
}
當我嘗試運行
grails generate-controller MyClass
或
grails generate-views MyClass
我得到以下異常:
| Domain class not found in grails-app/domain, trying hibernate mapped classes...
| Error 2016-01-04 04:30:44,365 [main] ERROR pool.ConnectionPool - Unable to create initial connections of pool.
Message: Driver:[email protected] returned null for URL:jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
Line | Method
->> 40 | doCall in _GrailsBootstrap$_run_closure2
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 64 | doCall in _GrailsBootstrap$_run_closure6
| 45 | doCall in _GrailsGenerate_groovy$_run_closure1
^ 40 | doCall in GenerateViews$_run_closure1
| Error 2016-01-04 04:30:44,400 [main] ERROR pool.ConnectionPool - Unable to create initial connections of pool.
Message: Driver:[email protected] returned null for URL:jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
Line | Method
->> 40 | doCall in _GrailsBootstrap$_run_closure2
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 64 | doCall in _GrailsBootstrap$_run_closure6
| 45 | doCall in _GrailsGenerate_groovy$_run_closure1
^ 40 | doCall in GenerateViews$_run_closure1
| Error 2016-01-04 04:30:44,431 [main] ERROR pool.ConnectionPool - Unable to create initial connections of pool.
Message: Driver:[email protected] returned null for URL:jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
Line | Method
->> 40 | doCall in _GrailsBootstrap$_run_closure2
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 64 | doCall in _GrailsBootstrap$_run_closure6
| 45 | doCall in _GrailsGenerate_groovy$_run_closure1
^ 40 | doCall in GenerateViews$_run_closure1
| Error Error executing script GenerateViews: org.springframework.beans.factory.BeanCreationException: 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 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': 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:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE (Use --stacktrace to see the full trace)
我甚至嘗試
grails generate-all MyClass
我得到同樣的例外。
'錯誤pool.ConnectionPool - 無法創建初始連接時,您在連接到數據庫面臨的困難pool.'來。請檢查是否一切都在'DataSource.groovy' – Parth
寫得好驗證您的數據庫URL in'URL:JDBC:H2:MEM:devDb; MVCC = TRUE; LOCK_TIMEOUT = 10000; DB_CLOSE_ON_EXIT = FALSE'是正確的。 – shaydel