[英]Grails & Mysql Connection mapping values are not allowed here
這是我在 Mysql Db 連接到 Grails 項目時遇到問題,我已經創建了這個數據庫,名稱為來自終端的汽車,一切正常。 但是當我嘗試運行我的應用程序時,我收到此錯誤。
| Error Error occurred running Grails CLI: mapping values are not allowed here
in 'reader', line 107, column 17:
url: "jdbc:mysql://localhost:3306/cars"
^
(Use --stacktrace to see the full trace)
這是我的 application.yml 文件
dataSource:
pooled: true
jmxExport: true
driverClassName: "com.mysql.jdbc.Driver"
username: "root"
password: "1234"
environments:
development:
dataSource:
dbCreate: update
url: "jdbc:mysql://localhost:3306/cars"
test:
dataSource:
dbCreate: update
url: "jdbc:mysql://localhost:3306/cars"
production:
dataSource:
dbCreate: none
url: "jdbc:mysql://localhost:3306/cars"
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 文件
runtime 'mysql:mysql-connector-java:5.1.29'
我認為您在第 17 行有一個額外的空間。在括號內。
dbCreate: update
[ ]url: "jdbc:mysql://localhost:3306/cars"
您可以在此站點上測試您的 yml 文件:http: //yaml-online-parser.appspot.com/
像這樣嘗試:
dataSource: pooled: true jmxExport: true driverClassName: "com.mysql.jdbc.Driver" username: "root" password: "1234" environments: development: dataSource: dbCreate: update url: 'jdbc:mysql://localhost:3306/cars' test: dataSource: dbCreate: update url: 'jdbc:mysql://localhost:3306/cars' production: dataSource: dbCreate: none url: "jdbc:mysql://localhost:3306/cars" 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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.