环境详情: MongoDB的 Windows 10 Grails 3.0.12 java版" 1.8.0_25" Java(TM)SE运行时环境(版本1.8.0_25-b18)
Application.yml
#trips.trips, #offers.offers { css for "current page" button }
------------------------------的build.gradle -------------- ----------------------
---
grails:
profile: web
codegen:
defaultPackage: org.samatvam
info:
app:
name: '@info.app.name@'
version: '@info.app.version@'
grailsVersion: '@info.app.grailsVersion@'
spring:
groovy:
template:
check-template-location: false
---
grails:
mime:
disable:
accept:
header:
userAgents:
- Gecko
- WebKit
- Presto
- Trident
types:
all: '*/*'
atom: application/atom+xml
css: text/css
csv: text/csv
form: application/x-www-form-urlencoded
html:
- text/html
- application/xhtml+xml
js: text/javascript
json:
- application/json
- text/json
multipartForm: multipart/form-data
pdf: application/pdf
rss: application/rss+xml
text: text/plain
hal:
- application/hal+json
- application/hal+xml
xml:
- text/xml
- application/xml
urlmapping:
cache:
maxsize: 1000
controllers:
defaultScope: singleton
converters:
encoding: UTF-8
views:
default:
codec: html
gsp:
encoding: UTF-8
htmlcodec: xml
codecs:
expression: html
scriptlets: html
taglib: none
staticparts: none
---
hibernate:
cache:
queries: false
use_second_level_cache: true
use_query_cache: false
region.factory_class: 'org.hibernate.cache.ehcache.EhCacheRegionFactory'
endpoints:
jmx:
unique-names: true
dataSource:
pooled: true
jmxExport: true
driverClassName: org.h2.Driver
username: sa
password:
environments:
development:
grails:
mongodb:
host: "localhost"
port: 27017
username: "blah"
password: "blah"
databaseName: "emrDB"
connectionString: "mongodb://blah:blah@localhost:27017/emrDB"
test:
dataSource:
dbCreate: create-drop
url: mongodb://blah:blah@localhost:27017/emrDB;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
production:
dataSource:
dbCreate: update
url: jdbc:h2:./prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
properties:
jmxEnabled: true
initialSize: 5
maxActive: 50
minIdle: 5
maxIdle: 25
maxWait: 10000
maxAge: 600000
timeBetweenEvictionRunsMillis: 5000
minEvictableIdleTimeMillis: 60000
validationQuery: SELECT 1
validationQueryTimeout: 3
validationInterval: 15000
testOnBorrow: true
testWhileIdle: true
testOnReturn: false
jdbcInterceptors: ConnectionState
defaultTransactionIsolation: 2 # TRANSACTION_READ_COMMITTED
-------------------错误--------------------------- ------
buildscript {
ext {
grailsVersion = project.grailsVersion
}
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath 'com.bertramlabs.plugins:asset-pipeline-gradle:2.5.0'
classpath "org.grails.plugins:hibernate:4.3.10.5"
}
}
plugins {
id "io.spring.dependency-management" version "0.5.4.RELEASE"
}
version "0.1"
group "org.emr"
apply plugin: "spring-boot"
apply plugin: "war"
apply plugin: "asset-pipeline"
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: "org.grails.grails-web"
apply plugin: "org.grails.grails-gsp"
ext {
grailsVersion = project.grailsVersion
gradleWrapperVersion = project.gradleWrapperVersion
}
assets {
minifyJs = true
minifyCss = true
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://repo.grails.org/grails/core" }
maven {url "http://code.google.com/p/json-simple/"}
}
dependencyManagement {
imports {
mavenBom "org.grails:grails-bom:$grailsVersion"
}
applyMavenExclusions false
}
dependencies {
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-dependencies"
compile "org.grails:grails-web-boot"
//compile "org.grails.plugins:hibernate"
compile "org.grails.plugins:cache"
//compile "org.hibernate:hibernate-ehcache"
compile "org.grails.plugins:scaffolding"
runtime "org.grails.plugins:asset-pipeline"
testCompile "org.grails:grails-plugin-testing"
testCompile "org.grails.plugins:geb"
// Note: It is recommended to update to a more robust driver (Chrome, Firefox etc.)
testRuntime 'org.seleniumhq.selenium:selenium-htmlunit-driver:2.44.0'
console "org.grails:grails-console"
//--------project-plugin-start------------------------//
compile "org.grails.plugins:mail:1.0.7"
compile "org.grails.plugins:mongodb:5.0.0.RC1"
compile "org.grails.plugins:calendar:1.2.1"
//compile "org.grails.plugins:jquery-ui:1.10.4"
compile "org.grails.plugins:joda-time:1.5"
compile "org.grails.plugins:rest:0.8"
//compile "org.grails.plugins:spring-security-core:2.0.0"
compile 'org.grails.plugins:spring-security-core:3.0.3'
//runtime "org.grails.plugins:jquery:1.11.1"
runtime "org.grails.plugins:resources:1.2.7"
runtime 'org.grails.plugins:twitter-bootstrap:3.3.5'
//build "org.grails.plugins:tomcat:7.0.52.1"
compile 'com.googlecode.json-simple:json-simple:1.1'
compile "org.grails.plugins:hibernate4:5.0.0.RC1"
//compile "org.mongodb:mongodb-driver:3.0.2"
// runtime 'org.springframework.data:spring-data-mongodb:1.8.1.RELEASE'
//----------------------------------------------------//
}
task wrapper(type: Wrapper) {
gradleVersion = gradleWrapperVersion
}
答案 0 :(得分:0)
我认为GORM插件中存在一个错误。它似乎没有识别databaseName属性。如果仅使用连接字符串,它似乎确实有效。
connectionString:“mongodb:// username:password @ host:port / databaseName”
详细信息:https://docs.mongodb.com/manual/reference/connection-string/