I have configured for the MySql database in grails by installing MySql in my system and placed its driver in X/lib directory(where X is my app name). I have changed the DataSource.groovy to conflict the changes. But when i run my app using the command grails run-app i’m getting an error as
ERROR spring.BeanBuilder - WARNING: Your cache provider is set to 'com.opensymphony.oscache.hibernate.OSCacheProvider' in DataSource.groovy, however the class for this provider cannot be found.
And Grails started to use its built in database..
How to get rid of this error?
DataSource.groovy Code is:
dataSource {
pooled = true
driverClassName = "com.mysql.jdbc.Driver"
username = "grails"
password = "server"
}
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = true
cache.provider_class =
'com.opensymphony.oscache.hibernate.OSCacheProvider'
}
// environment specific settings
environments {
development {
dataSource {
// one of 'create', 'create-drop','update'
dbCreate = "create-drop"
url = "jdbc:mysql://localhost:3306/racetrack_dev?autoreconnect=true"
}
}
test {
dataSource {
dbCreate = "update"
url = "jdbc:mysql://localhost:3306/racetrack_dev?autoreconnect=true"
}
}
production {
dataSource {
dbCreate = "update"
url = "jdbc:mysql://localhost:3306/racetrack_dev?autoreconnect=true"
}
}
}
Thanks in advance.
What version of grails are you using to create that DataSource.groovy file?
Grails 1.3.7 has the hibernate block as:
Which I think would explain your error message? (as you have set it up to use the old
OSCacheProviderEdit
These are the steps I just tried, and it all worked as expected:
Make a new database (I called mine
ants)Create the grails app
Edit the
grails-app/conf/BuildConfig.groovyfile, and uncomment the lines:and
Edit the file
grails-app/conf/DataSource.groovy.Change the dataSource block to:
And the url (in each of the environments) to
Create a domain class:
Run the app
Then, when you inspect the DB, you will have a
runnerstableI am guessing that you are inspecting the wrong database (you have a dev, test, and main db set up, one for each environment)