2016-01-04 3 views
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 

И я получаю то же исключение.

+0

'ОШИБКА pool.ConnectionPool - не удалось создать начальные соединения из pool.' приходит, когда вы сталкиваетесь с трудностями при подключении к базе данных. Проверьте, правильно ли написано все в 'DataSource.groovy' – Parth

+0

, что ваш DB-url в 'URL: jdbc: h2: mem: devDb; MVCC = TRUE; LOCK_TIMEOUT = 10000; DB_CLOSE_ON_EXIT = FALSE' правильный. – shaydel

ответ

0

Update: Это было исправлено путем добавления имяпакета к MyClass следующего

grails generate-controller <packagename>.MyClass 
Смежные вопросы