We have a Grails 2.5.6 application that connects to a Mongo database that is being upgraded to 3.4. As I understand it this requires moving to the 6.1.2 version of the Grails MongoDB plugin. This has been completed for the application and it works. However, the application also connects to an Oracle DB and uses Hibernate. With a fork configuration similar to the following the application works fine when running locally (run-app or through IntelliJ).
grails.project.fork = [
test: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, daemon:true],
run: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
war: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
console: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256]
]
However, when deploying as a WAR to a Tomcat container it fails with the following error at startup. I can recreate this locally by removing the fork configuration.
Caused by ClassNotFoundException: org.springframework.context.PayloadApplicationEvent
->> 179 | findClass in org.codehaus.groovy.tools.RootLoader
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 425 | loadClass in java.lang.ClassLoader
| 151 | loadClass in org.codehaus.groovy.tools.RootLoader
| 358 | loadClass in java.lang.ClassLoader
| 151 | <init> . in org.grails.orm.hibernate.HibernateDatastore
| 262 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run . . . in java.lang.Thread
I took a look at the Spring version being pulled in by Grails 2.5.6, 4.1.9, and sure enough the class in question is not present. Spring 4.1.9 documentation. It looks like the class is first present in 4.2.0 documentation.
grails.project.dependency.resolver = "maven" // or ivy
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// specify dependency exclusions here; for example, uncomment this to disable ehcache:
// excludes 'ehcache'
excludes 'grails-plugin-testing', 'grails-plugin-rest', 'grails-plugin-filters', 'grails-plugin-url-mappings', 'grails-plugin-async', 'grails-plugin-gsp'
}
log "error" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
checksums true // Whether to verify checksums on resolve
legacyResolve false // whether to do a secondary resolve on plugin installation, not advised and here for backwards compatibility
repositories {
inherits true // Whether to inherit repository definitions from plugins
grailsPlugins()
grailsHome()
mavenLocal()
grailsCentral()
mavenCentral()
}
dependencies {
compile('org.codehaus.groovy.modules.http-builder:http-builder:0.7.2') {
excludes 'commons-logging', 'xml-apis', 'groovy'
}
compile 'javax.mail:mail:1.4'
compile ('org.grails:grails-plugin-rest:2.5.6') { excludes 'grails-datastore-simple' }
compile ('org.grails:grails-plugin-filters:2.5.6') { excludes 'grails-datastore-simple' }
compile ('org.grails:grails-plugin-url-mappings:2.5.6') { excludes 'grails-datastore-simple' }
compile ('org.grails:grails-plugin-async:2.5.6') { excludes 'grails-datastore-simple' }
compile ('org.grails:grails-plugin-gsp:2.5.6') { excludes 'grails-datastore-simple' }
test ('org.grails:grails-plugin-testing:2.5.3') { excludes 'grails-datastore-simple' }
test 'org.grails:grails-datastore-gorm-test:6.1.1.RELEASE'
test 'org.grails:grails-datastore-test-support:5.0.13.RELEASE'
test 'com.github.fakemongo:fongo:2.1.0'
runtime 'joda-time:joda-time:2.4'
runtime 'com.oracle:ojdbc6:11.2.0.3'
}
plugins {
// plugins for test
test ':code-coverage:2.0.3-3'
test ':build-test-data:2.2.3'
// plugins for the build system only
build ':tomcat:8.0.22'
// plugins for the compile step
compile ':rest:0.8'
compile ':cache:1.1.8'
compile ':cache-ehcache:1.0.5'
compile ':mongodb:6.1.2'
compile ':marshallers:0.6'
compile ':cache-manager:1.0.0'
compile ':rabbitmq-native:3.1.3'
// plugins needed at runtime but not for compilation
runtime (':hibernate4:6.1.2') {
excludes 'grails-datastore-simple'
excludes 'ehcache-core'
}
runtime ':resources:1.2.14'
}
Any thoughts? I apologize if this should have been posted somewhere else. Thanks for any guidance you can provide.