java.lang.NoClassDefFoundError:com.google.gson.Gson是一个受限制的类。有关详细信息,请参阅Google App Engine开发人员指南

时间:2014-07-31 05:27:52

标签: java google-app-engine gson

简而言之,在将我的(Java)应用程序部署到GAE时,GAE会在其中一个捆绑的jar中为类抛出java.lang.NoClassDefFoundError。 我在GAE中使用GSON,但它无法工作,我已经导入了GSON-2.2.4.jar 我不知道如何解决它。

  

javax.servlet.ServletException:java.lang.NoClassDefFoundError:com.google.gson.Gson是一个受限制的类。有关详细信息,请参阅Google App Engine开发人员指南。       at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862)       at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)       在org.apache.jsp.index_jsp._jspService(index_jsp.java:89)       在org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)       在javax.servlet.http.HttpServlet.service(HttpServlet.java:717)       在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:61)       at java.security.AccessController.doPrivileged(Native Method)       在com.google.appengine.tools.development.PrivilegedJspServlet.service(PrivilegedJspServlet.java:58)       在javax.servlet.http.HttpServlet.service(HttpServlet.java:717)       在org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)       在org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1166)       在com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63)       在org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)       在com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:366)       在com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectModuleRequest(DevAppServerModulesFilter.java:349)       在com.google.appengine.tools.development.DevAppServerModulesFilter.doFilter(DevAppServerModulesFilter.java:116)       在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:98)       在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:82)       在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)       在javax.servlet.http.HttpServlet.service(HttpServlet.java:717)       在org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)       在org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1166)       在com.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74)       在org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)       在com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:127)       在org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)       在com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34)       在org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)       在com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63)       在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:125)       在org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)       在com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:366)       在com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectModuleRequest(DevAppServerModulesFilter.java:349)       在com.google.appengine.tools.development.DevAppServerModulesFilter.doFilter(DevAppServerModulesFilter.java:116)       在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:98)       在org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)       在com.google.appengine.tools.development.JettyContainerService $ ApiProxyHandler.handle(JettyContainerService.java:490)       在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)       at org.mortbay.jetty.HttpConnection $ RequestHandler.headerComplete(HttpConnection.java:923)       在org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)       在org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)       在org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)       在org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)       在org.mortbay.thread.QueuedThreadPool $ PoolThread.run(QueuedThreadPool.java:582)   引起:java.lang.NoClassDefFoundError:com.google.gson.Gson是一个受限制的类。有关详细信息,请参阅Google App Engine开发人员指南。       在com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51)       at test.client.CatchData.getData(CatchData.java:135)       在test.client.Main.run(Main.java:56)       在org.apache.jsp.index_jsp._jspService(index_jsp.java:69)       ... 66更多

1 个答案:

答案 0 :(得分:0)

来自Google App Engine Java Runtime Environment

沙箱

为了允许App Engine在多个Web服务器上分发应用程序请求,并防止一个应用程序干扰另一个应用程序,该应用程序在受限制的沙盒中运行。环境。在此环境中,应用程序可以在App Engine数据存储区中执行代码,存储和查询数据,使用App Engine邮件,URL提取和用户服务,并检查用户的Web请求并准备响应。

App Engine应用程序不能:

  • 写入文件系统。应用程序必须使用App Engine数据存储区来存储持久数据。允许从文件系统读取,并且随应用程序上载的所有应用程序文件都可用。

  • 慢慢回应。必须在几秒钟内处理对应用程序的Web请求。终止需要很长时间才能响应的进程以避免Web服务器过载。

  • 进行其他类型的系统调用。