Grails 2.3.5应用程序赢得&x27;t使用MySQL绑定在AppFog中启动

Grails 2.3.5应用程序赢得&x27;t使用MySQL绑定在AppFog中启动,grails,Grails,我试图在AppFog上部署一个带有MySQL绑定的Grails2.3.5应用程序。我使用DataSource.groovy中的以下设置在Grails 2.2.4应用程序中成功地做到了这一点: production { def envVar = System.env.VCAP_SERVICES def credentials = envVar?grails.converters.JSON.parse(envVar)["mysql-5.1"][0]["credentials"]:

我试图在AppFog上部署一个带有MySQL绑定的Grails2.3.5应用程序。我使用DataSource.groovy中的以下设置在Grails 2.2.4应用程序中成功地做到了这一点:

production { 
    def envVar = System.env.VCAP_SERVICES 
    def credentials = envVar?grails.converters.JSON.parse(envVar)["mysql-5.1"][0]["credentials"]:null 

    dataSource { 
        pooled = true 
        dbCreate = "update" 
        driverClassName = "com.mysql.jdbc.Driver" 
        url = credentials?"jdbc:mysql://${credentials.hostname}:${credentials.port}/${credentials.name}?useUnicode=yes&characterEncoding=UTF-8":"" 
        username = credentials?credentials.username:"" 
        password = credentails?credentials.password:"" 
    } 
}
我还取消了BuildConfig.groovy中运行时mysql连接器语句的注释。我的2.2.4应用程序启动,允许数据提交,并在应用程序重新启动后保存数据

在我的2.3.5应用程序中,通过在BuildConfig.groovy中设置以下内容,我可以在没有MySQL的情况下在AppFog上部署,这会将构建降级为Tomcat 6:

grails.servlet.version = "2.5"
在插件部分:

build ":tomcat:2.2.4"
应用程序启动并提交数据,但由于文件不会持久化,H2数据文件将在应用程序重新启动后删除。如果我进行与上面相同的更改来配置MySQL,则在应用程序启动时会出现以下错误:

Feb 12, 2014 6:05:44 PM org.apache.tomcat.jdbc.pool.ConnectionPool init
SEVERE: Unable to create initial connections of pool.
java.sql.SQLException: Access denied for user 'uqVkBpKILRjxS'@'10.0.13.117' (using password: NO)

日志包含更多内容,但这似乎是一个令人不快的错误。Grails2.3.5中是否有其他需要添加到配置文件中的更改?谢谢你的帮助。

只是指出一些线索:你看到错误消息中的“(使用密码:否)”了吗?由于某些原因,您的密码没有从VCAP_服务获取,您的代码也没有提供任何密码。如果在数据源{…}内执行System.out.println(envVar),会发生什么?你能在日志上看到你的密码吗?