Google Cloud sql和Google应用引擎

时间:2012-03-19 11:35:56

标签: java google-app-engine google-cloud-sql

我做了这个教程https://developers.google.com/cloud-sql/docs/developers_guide_java 当我在我的机器上本地运行应用程序时,eclipse的控制台会生成错误

  

java.security.AccessControlException:访问被拒绝   (java.lang.RuntimePermission accessClassInPackage.sun.jdbc.odbc)at at   java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)     在   java.security.AccessController.checkPermission(AccessController.java:546)     在   java.lang.SecurityManager.checkPermission(SecurityManager.java:532)     在   com.google.appengine.tools.development.DevAppServerFactory $ CustomSecurityManager.checkPermission(DevAppServerFactory.java:252)     在   java.lang.SecurityManager.checkPackageAccess(SecurityManager.java:1512)     在   org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:114)     在   org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)     at java.lang.Class.forName0(Native Method)at   java.lang.Class.forName(Class.java:247)at   java.sql.DriverManager.getCallerClass(DriverManager.java:477)at   java.sql.DriverManager.getConnection(DriverManager.java:576)at   java.sql.DriverManager.getConnection(DriverManager.java:207)at   org.apache.jsp.guestbook_jsp._jspService(guestbook_jsp.java:64)at   org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)at   javax.servlet.http.HttpServlet.service(HttpServlet.java:717)at at   org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)     在   org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)     在org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)     在   com.google.appengine.tools.development.PrivilegedJspServlet.access $ 101(PrivilegedJspServlet.java:23)     在   com.google.appengine.tools.development.PrivilegedJspServlet $ 2.run(PrivilegedJspServlet.java:59)     在java.security.AccessController.doPrivileged(Native Method)at   com.google.appengine.tools.development.PrivilegedJspServlet.service(PrivilegedJspServlet.java:57)     在javax.servlet.http.HttpServlet.service(HttpServlet.java:717)at   org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)     在   org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1166)     在   com.google.appengine.tools.development.BackendServersFilter.doFilter(BackendServersFilter.java:97)     在   org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)     在   org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)     在   org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)     在   org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)     在   org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)     在   org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)     在   com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:78)     在org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:327)     在org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126)     在   com.google.appengine.tools.development.StaticFileUtils.serveWelcomeFileAsForward(StaticFileUtils.java:80)     在   com.google.appengine.tools.development.LocalResourceFileServlet.maybeServeWelcomeFile(LocalResourceFileServlet.java:254)     在   com.google.appengine.tools.development.LocalResourceFileServlet.doGet(LocalResourceFileServlet.java:120)     在javax.servlet.http.HttpServlet.service(HttpServlet.java:617)at   javax.servlet.http.HttpServlet.service(HttpServlet.java:717)at at   org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)     在   org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1166)     在   com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:35)     在   org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)     在   com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:60)     在   org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)     在   com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)     在   org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)     在   com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122)     在   org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)     在   com.google.appengine.tools.development.BackendServersFilter.doFilter(BackendServersFilter.java:97)     在   org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)     在   org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)     在   org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)     在   org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)     在   org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)     在   org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)     在   com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:78)     在   org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)     在   com.google.appengine.tools.development.JettyContainerService $ ApiProxyHandler.handle(JettyContainerService.java:363)     在   org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)     在org.mortbay.jetty.Server.handle(Server.java:326)处   org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)     在   org.mortbay.jetty.HttpConnection $ RequestHandler.headerComplete(HttpConnection.java:923)     在org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)at at   org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)at at   org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)at at   org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)     在   org.mortbay.thread.QueuedThreadPool $ PoolThread.run(QueuedThreadPool.java:582)

但应用程序正在运行。然后我在gae中部署我的应用程序,当我进入我的应用程序时,它会给我错误*

  

错误:服务器错误服务器遇到错误而无法解决   完成你的要求。如果问题仍然存在,请报告您的问题   问题并提及此错误消息和导致它的查询。

谁能帮帮我?

2 个答案:

答案 0 :(得分:3)

当您在本地运行时,您需要设置本地MySQL实例。按照在开发期间使用本地MySQL实例部分中的说明进行操作。

答案 1 :(得分:1)

正如iein valdez所说,你必须为本地测试创建一个本地MySQL实例。 可在以下链接中找到相关说明:https://developers.google.com/cloud-sql/docs/developers_guide_java#using_the_java_development_server