java - Google App Engine 留言簿示例无法工作,无法连接到数据库

标签 java mysql google-app-engine jdbc

我无法让 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/

相关文章:

java - 使用 play 框架登录

java - JSESSIONID cookie 未存储在浏览器中

php - 找不到列 : 1054 Unknown column '' in 'field list' error message while trying to update datas in database

mysql - 我需要选择条件这个

php - 在mysql中选择中间元素?

python - Google App Engine 数据库未显示

google-app-engine - 如何导入谷歌应用引擎sqlite数据文件?

java - Enum 的 values() 方法的文档在哪里?

java - 使用 kotlin-maven-plugin 进行注解处理

python - 日期时间和 utctimetuple()