我对grails不熟悉,但是当我尝试运行我的项目时它失败了,我得到了以下的堆栈跟踪:
| Loading Grails 2.0.4
| Configuring classpath.
| Environment set to development.....
| Packaging Grails application....
| Compiling 1 source files..
| Compiling 1 source files.....
| Running Grails application
| Error 2013-06-26 14:01:37,372 [pool-7-thread-1] ERROR context.GrailsContextLoader - Error executing bootstraps: 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 org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Unable to initialize driver properties due to java.lang.IllegalAccessException: Class com.springsource.loaded.ri.ReflectiveInterceptor can not access a member of class com.mysql.jdbc.ConnectionPropertiesImpl with modifiers "private")
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 org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Unable to initialize driver properties due to java.lang.IllegalAccessException: Class com.springsource.loaded.ri.ReflectiveInterceptor can not access a member of class com.mysql.jdbc.ConnectionPropertiesImpl with modifiers "private")
Line | Method
->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 724 | 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 org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Unable to initialize driver properties due to java.lang.IllegalAccessException: Class com.springsource.loaded.ri.ReflectiveInterceptor can not access a member of class com.mysql.jdbc.ConnectionPropertiesImpl with modifiers "private")
->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 724 | 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 org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Unable to initialize driver properties due to java.lang.IllegalAccessException: Class com.springsource.loaded.ri.ReflectiveInterceptor can not access a member of class com.mysql.jdbc.ConnectionPropertiesImpl with modifiers "private")
->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 724 | 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 org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Unable to initialize driver properties due to java.lang.IllegalAccessException: Class com.springsource.loaded.ri.ReflectiveInterceptor can not access a member of class com.mysql.jdbc.ConnectionPropertiesImpl with modifiers "private")
->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 724 | run . . . in java.lang.Thread
Caused by MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Unable to initialize driver properties due to java.lang.IllegalAccessException: Class com.springsource.loaded.ri.ReflectiveInterceptor can not access a member of class com.mysql.jdbc.ConnectionPropertiesImpl with modifiers "private")
->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 724 | run . . . in java.lang.Thread
Caused by SQLNestedException: Cannot create PoolableConnectionFactory (Unable to initialize driver properties due to java.lang.IllegalAccessException: Class com.springsource.loaded.ri.ReflectiveInterceptor can not access a member of class com.mysql.jdbc.ConnectionPropertiesImpl with modifiers "private")
->> 1549 | createPoolableConnectionFactory in org.apache.commons.dbcp.BasicDataSource
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1388 | createDataSource in ''
| 1044 | getConnection in ''
| 334 | innerRun in java.util.concurrent.FutureTask$Sync
| 166 | run . . . in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 724 | run in java.lang.Thread
Caused by SQLException: Unable to initialize driver properties due to java.lang.IllegalAccessException: Class com.springsource.loaded.ri.ReflectiveInterceptor can not access a member of class com.mysql.jdbc.ConnectionPropertiesImpl with modifiers "private"
->> 1073 | createSQLException in com.mysql.jdbc.SQLError
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 987 | createSQLException in ''
| 982 | createSQLException in ''
| 927 | createSQLException in ''
| 2772 | initializeProperties in com.mysql.jdbc.ConnectionPropertiesImpl
| 3312 | initializeDriverProperties in com.mysql.jdbc.ConnectionImpl
| 786 | <init> . in ''
| 47 | <init> in com.mysql.jdbc.JDBC4Connection
| 411 | handleNewInstance in com.mysql.jdbc.Util
| 381 | getInstance in com.mysql.jdbc.ConnectionImpl
| 305 | connect . in com.mysql.jdbc.NonRegisteringDriver
| 38 | createConnection in org.apache.commons.dbcp.DriverConnectionFactory
| 582 | makeObject in org.apache.commons.dbcp.PoolableConnectionFactory
| 1556 | validateConnectionFactory in org.apache.commons.dbcp.BasicDataSource
| 1545 | createPoolableConnectionFactory in ''
| 1388 | createDataSource in ''
| 1044 | getConnection in ''
| 334 | innerRun in java.util.concurrent.FutureTask$Sync
| 166 | run . . . in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 724 | run in java.lang.Thread
任何人都可以帮我弄清楚这里可能出现的问题吗?我记得之前有过这样的工作,我尝试使用新的STS-grails安装
dataSource {
pooled = true
driverClassName = "com.mysql.jdbc.Driver"
dialect = "org.hibernate.dialect.MySQL5InnoDBDialect"
}
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = false
cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
}
// environment specific settings
environments {
// development {
// dataSource {
// dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
// url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
// }
// }
development {
dataSource {
pooled = true
dbCreate = "create" // one of 'create', 'create-drop','update'
url = "jdbc:mysql://localhost/mydatabase?useUnicode=yes&characterEncoding=UTF-8"
username = "root"
password = "root"
properties {
maxActive = 50
maxIdle = 25
minIdle = 5
initialSize = 5
minEvictableIdleTimeMillis = 1800000
timeBetweenEvictionRunsMillis = 1800000
maxWait = 10000
}
}
}
}
答案 0 :(得分:11)
这可能是Spring-Loaded重载代理的一个问题。
尝试使用 noreloading 标志
禁用它YOUR_GRAILS_COMMAND_HERE -noreloading
还要检查JIRA问题是否有潜在的错误修复等。
答案 1 :(得分:4)
遇到同样的问题,即使使用-noreloading也没解决,我发现它可能是与JDK版本相关的问题:它显示使用jdk1.7.0_25而JDK 1.6或以前的JDK 1.7版本不会发生,如https://dba.stackexchange.com/questions/45029/mysql-exception-after-upgrading-from-java-6-to-java-7
中所示