2015-10-14 78 views
-1

我試圖將grails-3.0.8版本連接到mysql作爲我的數據庫。 BuildConfig.groovy已被此版本中的application.yml所取代。但是,在使用mysql進行配置之後,我無法使用命令行再次啓動grails服務器。我的配置有什麼問題?請幫忙。這是我第一次與Grails合作。這裏是application.yml代碼無法在Grails-3.0.8中使用mysql配置啓動服務器

--- 
grails: 
profile: web 
codegen: 
    defaultPackage: mygrails 
info: 
app: 
    name: '@[email protected]' 
    version: '@[email protected]' 
    grailsVersion: '@[email protected]' 
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: com.mysql.jdbc.Driver 

environments: 
development: 
    dataSource: 
     dbCreate: create-drop 
     url: jdbc:mysql://localhost/grails_db;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE 
     username: root 
     password: 
test: 
    dataSource: 
     dbCreate: update 
     url: jdbc:mysql://localhost/grails_db;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE 
production: 
    dataSource: 
     dbCreate: update 
     url: jdbc:mysql://localhost/grails_db;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 

命令行錯誤

enter image description here

+0

是什麼--stacktrace,--debug,--info給你?或者這是剩下的... 83更多的stacktrace(這將是最有趣的部分 - 而不是所有那些奇特的顏色)。也請不要添加錯誤日誌的屏幕截圖。他們無法搜索。 – cfrick

+0

請參閱更新的圖像。謝謝。 – Eli

回答

0

更改下面

url: jdbc:mysql://localhost/grails_db;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE 

網址

url: jdbc:mysql://localhost/grails_db 

和下面的代碼DD你的build.gradle文件

runtime 'mysql:mysql-connector-java:5.1.29'