Reputation: 63
when deploying grails app to cloudfoundry, if define multi-datasource ,there are error: Cannot create JDBC driver of class 'org.postgresql.Driver' for connect URL 'n/a'
dataSource {
dialect = "org.hibernate.dialect.MySQLInnoDBDialect"
driverClassName = 'com.mysql.jdbc.Driver'
username = 'n/a'
password = 'n/a'
url = 'n/a'
dbCreate = 'update'
}
dataSource_postgre {
dialect = "org.hibernate.dialect.PostgresPlusDialect"
driverClassName = "org.postgresql.Driver"
username = 'n/a'
password = 'n/a'
url = "n/a"
dbCreate = 'update'
}
but as i known from http://blog.springsource.com/2011/04/12/one-step-deployment-with-grails-and-cloud-foundry/ as following:
When you bind a service to an application in Cloud Foundry, you are telling the cloud to pass the connection settings for that service to the application at runtime. The Cloud Foundry plugin then picks up that information and overrides the connection settings in your application. As if by magic, your application then transparently works against the cloud service without you having done anything! And this works for all available services, not just MySQL
Upvotes: 0
Views: 175
Reputation: 3984
Check the logs of the application using VMC if possible, in the staging.log, you should see a summary of the services that have been auto-configured.
I would have to check if this is possible with two services, you may have to configure one manually using the VCAP_SERVICES environment variable.
Upvotes: 0
Reputation: 3076
CloudFoundry will reconfigure the data source and replace your local DataSource definition. The way you notify CloudFoundry about the services you need is interacting with CF with vmc Tunneling with Caldecott command or Cloud Foundry Integration for STS.
Upvotes: 1