Monday, August 19, 2013

MySQL useCursorFetch property and Grails 2.2.4

Just hit a problem with using the useCursorFetch property in Grails 2.2.4. It may be present in earlier versions of Grails 2, but this was working up through Grails 1.3.9. I'm upgrading a Grails 1.3.9 application to Grails 2.2.4 and hit the following runtime exception when the JDBC URL has the useCursorFetch property set to true.


| Error 2013-08-19 09:05:50,365 [localhost-startStop-1] ERROR context.GrailsContextLoader  - Error initializing the application: java.lang.LinkageError: Illegal class file encountered. Try running with -Xverify:all in method executeBatchSerially
Message: java.lang.LinkageError: Illegal class file encountered. Try running with -Xverify:all in method executeBatchSerially
   Line | Method
->> 308 | evaluateEnvironmentSpecificBlock in grails.util.Environment
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   301 | executeForEnvironment            in     ''
|   277 | executeForCurrentEnvironment . . in     ''
|   303 | innerRun                         in java.util.concurrent.FutureTask$Sync
|   138 | run . . . . . . . . . . . . . .  in java.util.concurrent.FutureTask
|   895 | runTask                          in java.util.concurrent.ThreadPoolExecutor$Worker
|   918 | run . . . . . . . . . . . . . .  in     ''
^   680 | run                              in java.lang.Thread

Caused by LinkageError: Illegal class file encountered. Try running with -Xverify:all in method executeBatchSerially
->> 4566 | prepareStatement                 in com.mysql.jdbc.ConnectionImpl
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   4479 | prepareStatement                 in     ''
|   281 | prepareStatement . . . . . . . . in org.apache.commons.dbcp.DelegatingConnection
|   313 | prepareStatement                 in org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper
|   111 | methodMissing . . . . . . . . .  in org.grails.datastore.gorm.GormStaticApi
|    56 | loadUsersAndRoles                in com.vocabra.eventlogging.services.DefaultDataLoaderService
|    22 | load . . . . . . . . . . . . . . in     ''
|   165 | doCall                           in GrailsMelodyGrailsPlugin$_closure4_closure15_closure16
|    18 | doCall . . . . . . . . . . . . . in BootStrap$_closure1
|   308 | evaluateEnvironmentSpecificBlock in grails.util.Environment
|   301 | executeForEnvironment . . . . .  in     ''
|   277 | executeForCurrentEnvironment     in     ''
|   303 | innerRun . . . . . . . . . . . . in java.util.concurrent.FutureTask$Sync
|   138 | run                              in java.util.concurrent.FutureTask
|   895 | runTask . . . . . . . . . . . .  in java.util.concurrent.ThreadPoolExecutor$Worker
|   918 | run                              in     ''
^   680 | run . . . . . . . . . . . . . .  in java.lang.Thread

Removing the property from the JDBC URL resolves the issue. Need to do more research into why this is happening.