gorm - Grails: MySQL and mongoDB together -


i new grails. trying use mysql , mongodb in 1 web-app. can have quick on buildconfig.groovy , datasource.groovy , suggest me correct way ahead.

buildconfig.groovy

grails.servlet.version = "3.0" // change depending on target container compliance (2.5 or 3.0) grails.project.class.dir = "target/classes" grails.project.test.class.dir = "target/test-classes" grails.project.test.reports.dir = "target/test-reports" grails.project.work.dir = "target/work" grails.project.target.level = 1.6 grails.project.source.level = 1.6 //grails.project.war.file = "target/${appname}-${appversion}.war"  grails.project.fork = [ // configure settings compilation jvm, note if alter groovy version     forked compilation required //  compile: [maxmemory: 256, minmemory: 64, debug: false, maxperm: 256, daemon:true],  // configure settings test-app jvm, uses daemon default test: [maxmemory: 768, minmemory: 64, debug: false, maxperm: 256, daemon:true], // configure settings run-app jvm run: [maxmemory: 768, minmemory: 64, debug: false, maxperm: 256, forkreserve:false], // configure settings run-war jvm war: [maxmemory: 768, minmemory: 64, debug: false, maxperm: 256, forkreserve:false], // configure settings console ui jvm console: [maxmemory: 768, minmemory: 64, debug: false, maxperm: 256] ]  grails.project.dependency.resolver = "maven" // or ivy grails.project.dependency.resolution = { // inherit grails' default dependencies inherits("global") {     // specify dependency exclusions here; example, uncomment disable ehcache:     // excludes 'ehcache' } log "error" // log level of ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose' checksums true // whether verify checksums on resolve legacyresolve false // whether secondary resolve on plugin installation, not advised , here backwards compatibility  repositories {     inherits true // whether inherit repository definitions plugins      grailsplugins()     grailshome()     mavenlocal()     grailscentral()     mavencentral()     // uncomment these (or add new ones) enable remote dependency resolution public maven repositories     //mavenrepo "http://repository.codehaus.org"     //mavenrepo "http://download.java.net/maven/2/"     //mavenrepo "http://repository.jboss.com/maven2/" }  dependencies {     // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.      runtime 'mysql:mysql-connector-java:5.1.27'     // runtime 'org.postgresql:postgresql:9.3-1100-jdbc41'      compile 'org.grails:grails-datastore-gorm:3.0.4.release'      compile 'org.grails:grails-datastore-core:3.0.4.release'      test 'org.grails:grails-datastore-simple:3.0.4.release' }  plugins {     // plugins build system     build ":tomcat:7.0.52.1"      // plugins compile step     compile ":scaffolding:2.0.2"     compile ':cache:1.1.1'     //compile ":datasources:0.5"      // plugins needed @ runtime not compilation     runtime ":hibernate:3.6.10.9" // or ":hibernate4:4.3.4"     runtime ":database-migration:1.3.8"     runtime ":jquery:1.11.0.2"     runtime ":resources:1.2.7"     // uncomment these (or add new ones) enable additional resources capabilities     //runtime ":zipped-resources:1.0.1"     //runtime ":cached-resources:1.1"     //runtime ":yui-minify-resources:0.1.5"     compile ":mongodb:2.0.1"     // alternative default resources plugin asset-pipeline plugin     //compile ":asset-pipeline:1.6.1"      // uncomment these enable additional asset-pipeline capabilities     //compile ":sass-asset-pipeline:1.5.5"     //compile ":less-asset-pipeline:1.5.3"     //compile ":coffee-asset-pipeline:1.5.0"     //compile ":handlebars-asset-pipeline:1.3.0.1" } } 

datasource.groovy

datasource { pooled = true jmxexport = true driverclassname = "com.mysql.jdbc.driver" dialect = "org.hibernate.dialect.mysql5innodbdialect" username = "root" password = "root" } grails { mongo {     host = "localhost"     port = 27017     //replicaset = [ "localhost:27017", "localhost:27018"]     databasename = "test" }  } 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" // 1 of 'create', 'create-drop', 'update', 'validate', ''         url = "jdbc:mysql://localhost:3306/web_store"         username = "root"         password = "root"     }  } test {     datasource {         dbcreate = "update"         url = "jdbc:mysql://localhost:3306/web_store"         username = "root"         password = "root"     }  } production {     datasource {         dbcreate = "update"         url = "jdbc:mysql://localhost:3306/web_store"         username = "root"         password = "root"      }  }    } 

here error got:

error | 2014-04-08 20:14:15,210 [localhost-startstop-1] error context.grailscontextloader  - error initializing application: error creating bean name 'mongotransactionmanager': cannot resolve reference bean 'mongodatastore' while setting bean property 'datastore'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'mongodatastore': cannot resolve reference bean 'mongomappingcontext' while setting bean property 'mappingcontext'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'mongomappingcontext': factorybean threw exception on object creation; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'test.studentvalidator': cannot resolve reference bean 'sessionfactory' while setting bean property 'sessionfactory'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'sessionfactory': cannot resolve reference bean 'transactionmanager' while setting bean property 'transactionmanager'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'transactionmanager': cannot resolve reference bean '$primarytransactionmanager' while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name '$primarytransactionmanager': cannot resolve reference bean 'sessionfactory' while setting bean property 'sessionfactory'; nested exception org.springframework.beans.factory.beancurrentlyincreationexception: error creating bean name 'sessionfactory': factorybean in creation returned null getobject message: error creating bean name 'mongotransactionmanager': cannot resolve reference bean 'mongodatastore' while setting bean property 'datastore'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'mongodatastore': cannot resolve reference bean 'mongomappingcontext' while setting bean property 'mappingcontext'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'mongomappingcontext': factorybean threw exception on object creation; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'test.studentvalidator': cannot resolve reference bean 'sessionfactory' while setting bean property 'sessionfactory'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'sessionfactory': cannot resolve reference bean 'transactionmanager' while setting bean property 'transactionmanager'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'transactionmanager': cannot resolve reference bean '$primarytransactionmanager' while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name '$primarytransactionmanager': cannot resolve reference bean 'sessionfactory' while setting bean property 'sessionfactory'; nested exception org.springframework.beans.factory.beancurrentlyincreationexception: error creating bean name 'sessionfactory': factorybean in creation returned null getobject     line | method ->>  262 | run       in java.util.concurrent.futuretask - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  |   1145 | runworker in java.util.concurrent.threadpoolexecutor |    615 | run . . . in java.util.concurrent.threadpoolexecutor$worker ^    744 | run       in java.lang.thread caused beancreationexception: error creating bean name 'mongodatastore': cannot resolve reference bean 'mongomappingcontext' while setting bean property 'mappingcontext'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'mongomappingcontext': factorybean threw exception on object creation; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'test.studentvalidator': cannot resolve reference bean 'sessionfactory' while setting bean property 'sessionfactory'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'sessionfactory': cannot resolve reference bean 'transactionmanager' while setting bean property 'transactionmanager'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'transactionmanager': cannot resolve reference bean '$primarytransactionmanager' while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name '$primarytransactionmanager': cannot resolve reference bean 'sessionfactory' while setting bean property 'sessionfactory'; nested exception org.springframework.beans.factory.beancurrentlyincreationexception: error creating bean name 'sessionfactory': factorybean in creation returned null getobject ->>  262 | run       in java.util.concurrent.futuretask - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  |   1145 | runworker in java.util.concurrent.threadpoolexecutor |    615 | run . . . in java.util.concurrent.threadpoolexecutor$worker ^    744 | run       in java.lang.thread caused beancreationexception: error creating bean name 'mongomappingcontext': factorybean threw exception on object creation; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'test.studentvalidator': cannot resolve reference bean 'sessionfactory' while setting bean property 'sessionfactory'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'sessionfactory': cannot resolve reference bean 'transactionmanager' while setting bean property 'transactionmanager'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'transactionmanager': cannot resolve reference bean '$primarytransactionmanager' while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name '$primarytransactionmanager': cannot resolve reference bean 'sessionfactory' while setting bean property 'sessionfactory'; nested exception org.springframework.beans.factory.beancurrentlyincreationexception: error creating bean name 'sessionfactory': factorybean in creation returned null getobject ->>  262 | run       in java.util.concurrent.futuretask - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  |   1145 | runworker in java.util.concurrent.threadpoolexecutor |    615 | run . . . in java.util.concurrent.threadpoolexecutor$worker ^    744 | run       in java.lang.thread caused beancreationexception: error creating bean name 'test.studentvalidator': cannot resolve reference bean 'sessionfactory' while setting bean property 'sessionfactory'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'sessionfactory': cannot resolve reference bean 'transactionmanager' while setting bean property 'transactionmanager'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'transactionmanager': cannot resolve reference bean '$primarytransactionmanager' while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name '$primarytransactionmanager': cannot resolve reference bean 'sessionfactory' while setting bean property 'sessionfactory'; nested exception org.springframework.beans.factory.beancurrentlyincreationexception: error creating bean name 'sessionfactory': factorybean in creation returned null getobject ->>   69 | getobject in org.grails.datastore.gorm.bean.factory.abstractmappingcontextfactorybean - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  |    262 | run       in java.util.concurrent.futuretask |   1145 | runworker in java.util.concurrent.threadpoolexecutor |    615 | run       in java.util.concurrent.threadpoolexecutor$worker ^    744 | run . . . in java.lang.thread caused beancreationexception: error creating bean name 'sessionfactory': cannot resolve reference bean 'transactionmanager' while setting bean property 'transactionmanager'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'transactionmanager': cannot resolve reference bean '$primarytransactionmanager' while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name '$primarytransactionmanager': cannot resolve reference bean 'sessionfactory' while setting bean property 'sessionfactory'; nested exception org.springframework.beans.factory.beancurrentlyincreationexception: error creating bean name 'sessionfactory': factorybean in creation returned null getobject ->>   69 | getobject in org.grails.datastore.gorm.bean.factory.abstractmappingcontextfactorybean - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  |    262 | run       in java.util.concurrent.futuretask |   1145 | runworker in java.util.concurrent.threadpoolexecutor |    615 | run       in java.util.concurrent.threadpoolexecutor$worker ^    744 | run . . . in java.lang.thread caused beancreationexception: error creating bean name 'transactionmanager': cannot resolve reference bean '$primarytransactionmanager' while setting constructor argument; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name '$primarytransactionmanager': cannot resolve reference bean 'sessionfactory' while setting bean property 'sessionfactory'; nested exception org.springframework.beans.factory.beancurrentlyincreationexception: error creating bean name 'sessionfactory': factorybean in creation returned null getobject ->>   69 | getobject in org.grails.datastore.gorm.bean.factory.abstractmappingcontextfactorybean - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  |    262 | run       in java.util.concurrent.futuretask |   1145 | runworker in java.util.concurrent.threadpoolexecutor |    615 | run       in java.util.concurrent.threadpoolexecutor$worker ^    744 | run . . . in java.lang.thread caused beancreationexception: error creating bean name '$primarytransactionmanager': cannot resolve reference bean 'sessionfactory' while setting bean property 'sessionfactory'; nested exception org.springframework.beans.factory.beancurrentlyincreationexception: error creating bean name 'sessionfactory': factorybean in creation returned null getobject ->>   69 | getobject in org.grails.datastore.gorm.bean.factory.abstractmappingcontextfactorybean - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  |    262 | run       in java.util.concurrent.futuretask |   1145 | runworker in java.util.concurrent.threadpoolexecutor |    615 | run       in java.util.concurrent.threadpoolexecutor$worker ^    744 | run . . . in java.lang.thread caused beancurrentlyincreationexception: error creating bean name 'sessionfactory': factorybean in creation returned null getobject ->>   69 | getobject in org.grails.datastore.gorm.bean.factory.abstractmappingcontextfactorybean - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  |    262 | run       in java.util.concurrent.futuretask |   1145 | runworker in java.util.concurrent.threadpoolexecutor |    615 | run       in java.util.concurrent.threadpoolexecutor$worker ^    744 | run . . . in java.lang.thread error | forked grails vm exited error 

sagar,

i tracked down issue mongodb<any version> , hibernate-3.6.10.9 not playing nicely together. if downgrade :hibernate:3.6.10.8 should go, @ least worked me.

i tried put in jira ticket on i'm getting 500's...


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -