2017-04-20 33 views
2

创建初始连接池我有一个Grails 3.2.7应用与IntelliJ IDEA的2017年1月1日。但问题是我无法创建连接池到MySql数据库(开发环境)。无法在Grails的3

这里是我的application.yml

--- 
 
grails: 
 
    profile: web 
 
    codegen: 
 
     defaultPackage: ifp 
 
    spring: 
 
     transactionManagement: 
 
      proxies: false 
 
info: 
 
    app: 
 
     name: '@[email protected]' 
 
     version: '@[email protected]' 
 
     grailsVersion: '@[email protected]' 
 
spring: 
 
    main: 
 
     banner-mode: "off" 
 
    groovy: 
 
     template: 
 
      check-template-location: false 
 

 
# Spring Actuator Endpoints are Disabled by Default 
 
endpoints: 
 
    enabled: false 
 
    jmx: 
 
     enabled: true 
 

 
--- 
 
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 
 
endpoints: 
 
    jmx: 
 
     unique-names: true 
 

 
--- 
 
hibernate: 
 
    cache: 
 
     queries: false 
 
     use_second_level_cache: true 
 
     use_query_cache: false 
 
     region.factory_class: org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory 
 

 
dataSource: 
 
    pooled: true 
 
    jmxExport: true 
 
    driverClassName: com.mysql.jdbc.Driver 
 
    dialect: org.hibernate.dialect.MySQL5InnoDBDialect 
 
    username: root 
 
    password: root 
 

 
environments: 
 
    development: 
 
     dataSource: 
 
      dbCreate: update 
 
      url: jdbc:mysql://localhost:3306/ifp;AUTO_RECONNECT=TRUE; 
 
    test: 
 
     dataSource: 
 
      dbCreate: update 
 
      url: jdbc:mysql://192.168.40.67:3306/ifp;AUTO_RECONNECT=TRUE; 
 
    production: 
 
     dataSource: 
 
      dbCreate: update 
 
      url: jdbc:mysql://192.168.40.67:3306/ifp;AUTO_RECONNECT=TRUE; 
 
      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

这里是我的build.gradle

buildscript { 
 
    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.11.6" 
 
     classpath "org.grails.plugins:hibernate5:${gormVersion-".RELEASE"}" 
 
    } 
 
} 
 

 
version "0.1" 
 
group "ifp" 
 

 
apply plugin:"eclipse" 
 
apply plugin:"idea" 
 
apply plugin:"war" 
 
apply plugin:"org.grails.grails-web" 
 
apply plugin:"org.grails.grails-gsp" 
 
apply plugin:"asset-pipeline" 
 

 
repositories { 
 
    mavenLocal() 
 
    maven { url "https://repo.grails.org/grails/core" } 
 
} 
 

 
dependencies { 
 
    compile "org.springframework.boot:spring-boot-starter-logging" 
 
    compile "org.springframework.boot:spring-boot-autoconfigure" 
 
    compile "org.grails:grails-core" 
 
    compile "org.springframework.boot:spring-boot-starter-actuator" 
 
    compile "org.springframework.boot:spring-boot-starter-tomcat" 
 
    compile "org.grails:grails-dependencies" 
 
    compile "org.grails:grails-web-boot" 
 
    compile "org.grails.plugins:cache" 
 
    compile "org.grails.plugins:scaffolding" 
 
    compile "org.grails.plugins:hibernate5" 
 
    compile "org.hibernate:hibernate-core:5.1.3.Final" 
 
    compile "org.hibernate:hibernate-ehcache:5.1.3.Final" 
 
    console "org.grails:grails-console" 
 
    profile "org.grails.profiles:web" 
 
    runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.11.6" 
 
    runtime "com.h2database:h2" 
 
    testCompile "org.grails:grails-plugin-testing" 
 
    testCompile "org.grails.plugins:geb" 
 
    testRuntime "org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1" 
 
    testRuntime "net.sourceforge.htmlunit:htmlunit:2.18" 
 

 
//--------------Custom Dependencies---------------- 
 
    compile 'org.grails.plugins:spring-security-core:3.1.1' 
 
    compile "org.grails.plugins:jasypt-encryption:2.0.1" 
 
    runtime "org.grails.plugins:jquery:1.11.1" 
 
    runtime "mysql:mysql-connector-java:5.1.37" 
 

 
} 
 

 
bootRun { 
 
    jvmArgs('-Dspring.output.ansi.enabled=always') 
 
    addResources = true 
 
} 
 

 

 
assets { 
 
    minifyJs = true 
 
    minifyCss = true 
 
}

Iam a newbi to grails 3有人可以帮我弄清楚这个问题吗?

回答

0

这些依赖关系似乎丢失了你的build文件

runtime "org.apache.tomcat:tomcat-jdbc:8.5.0" 
runtime "org.apache.tomcat.embed:tomcat-embed-logging-log4j:8.5.0" 

尝试加入他们,看看它是否工作。

相关问题