[英]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.. 我已经在寻找解决方案达数小时之久。实际上,我已经设法使其工作了一段时间(不知道我是如何做到的),然后我重构了该项目,并对日食做了一些其他小的更改,现在我又得到例外..
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.