简体   繁体   English

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

[英]Google App Engine Guestbook Sample not working, can't connect to DB

i can't get the Google App Engine "Guestbook" sample to work with my local mySQL DB. 我无法使用Google App Engine“来宾”示例来与本地mySQL DB一起使用。 https://developers.google.com/appengine/docs/java/cloud-sql/ https://developers.google.com/appengine/docs/java/cloud-sql/

I get following Exceptions: 我得到以下异常:

java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "modifyThreadGroup") java.security.AccessControlException:访问被拒绝(“ java.lang.RuntimePermission”“ modifyThreadGroup”)

and

Nested in javax.servlet.ServletException: java.lang.NoClassDefFoundError: Could not initialize class com.mysql.jdbc.ConnectionImpl: 嵌套在javax.servlet.ServletException中:java.lang.NoClassDefFoundError:无法初始化com.mysql.jdbc.ConnectionImpl类:

This is the code i try to connect with (actually only the last 2 rows are relevant): 这是我尝试连接的代码(实际上只有最后两行是相关的):

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";
}

I also can't connect to to my google cloud sql instance. 我也无法连接到我的Google Cloud SQL实例。 The only way it works is when i deploy it to GAE.. 它工作的唯一方法是将其部署到GAE。

I'm already searching for a solution for hours.. Actually i already managed it to work for some time(don't know how i did it), then i refactored the project and did some other minor changes in eclipse and now i again get the exception.. 我已经在寻找解决方案达数小时之久。实际上,我已经设法使其工作了一段时间(不知道我是如何做到的),然后我重构了该项目,并对日食做了一些其他小的更改,现在我又得到例外..

The problem is likely due to the local application not able to locate your MySQL JDBC Driver JAR file. 该问题可能是由于本地应用程序无法找到您的MySQL JDBC驱动程序JAR文件。 See if a similar thread here solves your problem. 看看这里是否有类似的线程可以解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Google App Engine留言簿示例索引不起作用 - Google App Engine Guestbook example index not working .jsp文件不适用于Google App Engine留言板教程 - .jsp file not working for Google App Engine guestbook tutorial Google App Engine的留言簿示例未启动 - Guestbook example for Google App Engine not starting up 使用mvn devserver的Google App Engine Java失败:缺少“guestbook / target / guestbook-1.0-SNAPSHOT” - Google App Engine Java with mvn devserver failed: missing “guestbook/target/guestbook-1.0-SNAPSHOT” Spring 启动应用程序在部署到 Google App Engine 时无法连接到 Google Cloud SQL (PostgreSQL) - Spring Boot app can't connect to Google Cloud SQL (PostgreSQL) when deploying to Google App Engine 无法使用Google App Engine(GAE)连接到Google Cloud Messaging(GCM)服务器 - Can't connect to Google Cloud Messaging (GCM) server using Google App Engine (GAE) 无法上传到谷歌应用引擎 - Can't upload to google app engine 连接到Google App Engine数据存储区 - Connect to Google App Engine Datastore 我无法从Google App Engine上已部署的后端Servlet连接到我的Google Cloud sql数据库 - I can't connect to my google cloud sql database from my deployed backend servlet on the google app engine Restlet GAE示例不适用于Google App Engine工具包1.4.0 - Restlet GAE sample doesn't work with Google App Engine Toolkit 1.4.0
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM