저는 Grails 초보자입니다. Datasource.groovy에서 몇 가지 기본 구성을 수행 한 후 grails 앱이 시작되지 않습니다. 아래 오류가 발생합니다.
Error 2015-07-03 15:27:19,014 [localhost-startStop-1] ERROR pool.ConnectionPool - Unable to create initial connections of pool.
메시지 : Driver : org.h2.Driver@78f95cf6에서 URL : jdbc : mysql : // localhost : 3306 / radb? createDatabaseIfNotExist = true에 대해 null을 반환했습니다.
| 오류 2015-07-03 15 : 27 : 19,854 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener-애플리케이션 초기화 오류 : 'transactionManagerPostProcessor'이름으로 Bean 생성 오류 : Bean 초기화 실패; 중첩 된 예외는 org.springframework.beans.factory.BeanCreationException : 이름이 'transactionManager'인 Bean 생성 오류 : Bean 속성 'sessionFactory'를 설정하는 동안 'sessionFactory'Bean에 대한 참조를 확인할 수 없습니다. 중첩 된 예외는 org.springframework.beans.factory.BeanCreationException : 이름이 'sessionFactory'인 Bean 생성 오류 : init 메소드 호출에 실패했습니다. 중첩 된 예외는 java.lang.NullPointerException입니다.
radb 데이터베이스가 있습니다. 나는 그것을 확인했다
내 Datasource.groovy 파일은 아래와 같습니다.
dataSource {
pooled = true
jmxExport = true
driverClassName = "org.h2.Driver"
dialect = "org.hibernate.dialect.MySQL5InnoDBDialect"
//username = "sa"
//password = ""
}
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = false
// cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' // Hibernate 3
cache.region.factory_class = 'org.hibernate.cache.ehcache.EhCacheRegionFactory' // Hibernate 4
singleSession = true // configure OSIV singleSession mode
flush.mode = 'manual' // OSIV session flush mode outside of transactional context
}
// environment specific settings
environments {
development {
dataSource {
dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
url = "jdbc:mysql://localhost:3306/radb?createDatabaseIfNotExist=true"
username="root"
password="root"
logSql = true
}
}
test {
dataSource {
dbCreate = "update"
url = "jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
}
}
production {
dataSource {
dbCreate = "update"
url = "jdbc:h2:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
properties {
// See http://grails.org/doc/latest/guide/conf.html#dataSource for documentation
jmxEnabled = true
initialSize = 5
maxActive = 50
minIdle = 5
maxIdle = 25
maxWait = 10000
maxAge = 10 * 60000
timeBetweenEvictionRunsMillis = 5000
minEvictableIdleTimeMillis = 60000
validationQuery = "SELECT 1"
validationQueryTimeout = 3
validationInterval = 15000
testOnBorrow = true
testWhileIdle = true
testOnReturn = false
jdbcInterceptors = "ConnectionState"
defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED
}
}
}
}
해결 방법
driverClassName
이 잘못되었습니다. mysql이 필요한 경우 mysql (예 : com.mysql.jdbc.Driver
등)에서 올바른 mysql을 사용합니다. 지금 당신은 :
default: driver=h2, dialect=mysql;
dev: url=mysql
prod: url=h2
당신은 확실히 이것을 정리하고 싶습니다. 또한 귀하의 deps에 운전자가 있는지 확인하십시오.
참조 페이지 https://stackoverflow.com/questions/31204498
'MySql' 카테고리의 다른 글
MySQL 테이블에서 최신 ID 번호를 얻는 방법은 무엇입니까? (0) | 2020.11.19 |
---|---|
MySQL Laravel 5.1 Migration and Seeding Cannot truncate a table referenced in a foreign key constraint (0) | 2020.11.19 |
MySQL Echo current number of row (0) | 2020.11.19 |
MySQL 라 라벨에서 DB :: select 내에서 DB :: raw를 사용하는 이유는 무엇입니까? (0) | 2020.11.18 |
MySQL jsf를 사용하여 데이터베이스에 연결 (0) | 2020.11.18 |
댓글