我是grails中的新手,我在我的项目中进行了配置以使用mysql但是此异常apears由SQLException引起:由于java.lang.IllegalAccessException,无法初始化驱动程序属性:Class org.springsource.loaded.ri.ReflectiveInterceptor无法使用修饰符“private”访问com.mysql.jdbc.ConnectionPropertiesImpl类的成员。有人可以帮助我吗?
DataSource.groovy中
dataSource {
pooled = true
jmxExport = true
driverClassName = "com.mysql.jdbc.Driver"
username = "root"
password = "root"
}
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
}
// environment specific settings
environments {
development {
dataSource {
dbCreate = "create-drop" // one of 'create',
'create-drop', 'update', 'validate', ''
url = "jdbc:mysql://localhost:3306/grailsdb"
}
}
test {
dataSource {
dbCreate = "update"
url = "jdbc:mysql://localhost:3306/grailsdb"
}
}
production {
dataSource {
dbCreate = "update"
url = "jdbc:mysql://localhost:3306/grailsdb"
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
}
}
}
}
这是堆栈跟踪
|Loading Grails 2.3.7
|Configuring classpath
|Environment set to development
.................................
|Packaging Grails application
.. ........................................
|Running Grails application
| Error 2014-05-08 19:27:59,760 [localhost-startStop-1]
ERROR pool.ConnectionPool - Unable to create initial connections of pool.
Message: Unable to initialize driver properties due
to java.lang.IllegalAccessException:
Class org.springsource.loaded.ri.ReflectiveInterceptor
can not access a member of class com.mysql.jdbc.ConnectionPropertiesImpl
with modifiers "private"
Line | Method
1084 | createSQLException in com.mysql.jdbc.SQLError
987 | createSQLException in ''
973 | createSQLException . . . . in ''
918 | createSQLException in ''
2861 | initializeProperties . . . in com.mysql.jdbc.ConnectionPropertiesImpl
3521 | initializeDriverProperties in com.mysql.jdbc.ConnectionImpl
821 | <init> . . . . . . . . . . in ''
46 | <init> in com.mysql.jdbc.JDBC4Connection
409 | handleNewInstance . . . . in com.mysql.jdbc.Util
417 | getInstance in com.mysql.jdbc.ConnectionImpl
344 | connect . . . . . . . . . in com.mysql.jdbc.NonRegisteringDriver
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
Error 2014-05-08 19:27:59,801 [localhost-startStop-1]
ERROR pool.ConnectionPool -
Unable to create initial connections of pool.
Message: Unable to initialize driver properties due
to java.lang.IllegalAccessException:
Class org.springsource.loaded.ri.ReflectiveInterceptor
can not access a member ofclasscom.mysql.jdbc.ConnectionPropertiesImpl
with modifiers
"private"
Line | Method
->> 1084 | createSQLException in com.mysql.jdbc.SQLError
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
987 | createSQLException in ''
973 | createSQLException . . . . in ''
918 | createSQLException in ''
2861 | initializeProperties . . . in com.mysql.jdbc.ConnectionPropertiesImpl
3521 | initializeDriverProperties in com.mysql.jdbc.ConnectionImpl
821 | <init> . . . . . . . . . . in ''
46 | <init> in com.mysql.jdbc.JDBC4Connection
409 | handleNewInstance . . . . in com.mysql.jdbc.Util
417 | getInstance in com.mysql.jdbc.ConnectionImpl
344 | connect . . . . . . . . . in com.mysql.jdbc.NonRegisteringDriver
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
Error 2014-05-08 19:27:59,847
[localhost-startStop-1] ERROR pool.ConnectionPool
- Unable to create initial connections of pool.
Message: Unable to initialize driver properties due
to java.lang.IllegalAccessException:
Class org.springsource.loaded.ri.ReflectiveInterceptor
can not access a member of class
com.mysql.jdbc.ConnectionPropertiesImpl with modifiers "private"
Line | Method
1084 | createSQLException in com.mysql.jdbc.SQLError
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
987 | createSQLException in ''
973 | createSQLException . . . . in ''
918 | createSQLException in ''
2861 | initializeProperties . . . in com.mysql.jdbc.ConnectionPropertiesImpl
3521 | initializeDriverProperties in com.mysql.jdbc.ConnectionImpl
821 | <init> . . . . . . . . . . in ''
46 | <init> in com.mysql.jdbc.JDBC4Connection
409 | handleNewInstance . . . . in com.mysql.jdbc.Util
417 | getInstance in com.mysql.jdbc.ConnectionImpl
344 | connect . . . . . . . . . in com.mysql.jdbc.NonRegisteringDriver
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