我无法让 Google App Engine“Guestbook”示例与我的本地 mySQL 数据库配合使用。 https://developers.google.com/appengine/docs/java/cloud-sql/
我遇到以下异常:
java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "modifyThreadGroup")
和
Nested in javax.servlet.ServletException: java.lang.NoClassDefFoundError: Could not initialize class com.mysql.jdbc.ConnectionImpl:
这是我尝试连接的代码(实际上只有最后两行相关):
if (SystemProperty.environment.value() ==
SystemProperty.Environment.Value.Production) {
// Load the class that provides the new "jdbc:google:mysql://" prefix.
Class.forName("com.mysql.jdbc.GoogleDriver");
url = "jdbc:google:mysql://your-project-id:your-instance-name/guestbook?user=root";
} else {
// Local MySQL instance to use during development.
Class.forName("com.mysql.jdbc.Driver");
url = "jdbc:mysql://127.0.0.1:3306/guestbook?user=root";
}
我也无法连接到我的谷歌云 SQL 实例。它起作用的唯一方法是将其部署到 GAE 时..
我已经在寻找解决方案几个小时了..实际上我已经让它工作了一段时间(不知道我是怎么做到的),然后我重构了该项目并在 eclipse 中做了一些其他小的更改,现在我再次遇到异常..
最佳答案
该问题可能是由于本地应用程序无法找到您的 MySQL JDBC 驱动程序 JAR 文件。看看是否有类似的帖子here解决你的问题。
关于java - Google App Engine 留言簿示例无法工作,无法连接到数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21745313/