使用AppEngine示例项目的NoClassDefFoundError

时间:2013-09-26 05:38:33

标签: google-app-engine

我已按照此处的说明为Juno安装了AppEngine Eclipse插件:https://developers.google.com/appengine/docs/java/tools/eclipse

但是,当运行一些提供的示例项目(例如ShardedCounter)时,将抛出NoClassDefFoundError,指出无法找到类com / google / appengine / tools / development / DevAppServerFactory $ CustomSecurityManager $ StackTraceAnalyzer:

java.lang.NoClassDefFoundError: com/google/appengine/tools/development/DevAppServerFactory$CustomSecurityManager$StackTraceAnalyzer
    at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.appHasPermission(DevAppServerFactory.java:334)
    at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:379)
    at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkAccess(DevAppServerFactory.java:408)
    at java.lang.ThreadGroup.checkAccess(ThreadGroup.java:299)
    at java.lang.Thread.init(Thread.java:336)
    at java.lang.Thread.<init>(Thread.java:608)
    at java.util.concurrent.Executors$DefaultThreadFactory.newThread(Executors.java:541)
    at com.google.appengine.tools.development.ApiProxyLocalImpl$DaemonThreadFactory.newThread(ApiProxyLocalImpl.java:644)
    at java.util.concurrent.ThreadPoolExecutor.addThread(ThreadPoolExecutor.java:672)
    at java.util.concurrent.ThreadPoolExecutor.addIfUnderMaximumPoolSize(ThreadPoolExecutor.java:721)
    at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:657)
    at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:92)
    at com.google.appengine.tools.development.ApiProxyLocalImpl$PrivilegedApiAction.run(ApiProxyLocalImpl.java:270)
    at com.google.appengine.tools.development.ApiProxyLocalImpl$PrivilegedApiAction.run(ApiProxyLocalImpl.java:255)
    at com.google.appengine.tools.development.ApiProxyLocalImpl.makeAsyncCall(ApiProxyLocalImpl.java:203)
    at com.google.apphosting.api.ApiProxy.makeAsyncCall(ApiProxy.java:190)
    at com.google.appengine.api.datastore.DatastoreApiHelper.makeAsyncCall(DatastoreApiHelper.java:56)
    at com.google.appengine.api.datastore.PreparedQueryImpl.runQuery(PreparedQueryImpl.java:127)
    at com.google.appengine.api.datastore.PreparedQueryImpl.asIterator(PreparedQueryImpl.java:60)
    at com.google.appengine.api.datastore.BasePreparedQuery$1.iterator(BasePreparedQuery.java:25)
    at com.google.appengine.demos.shardedcounter.java.v1.ShardedCounter.getCount(ShardedCounter.java:59)
    at com.google.appengine.demos.shardedcounter.java.v1.CounterPage.doGet(CounterPage.java:36)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
    at com.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:123)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:125)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:368)
    at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectModuleRequest(DevAppServerModulesFilter.java:351)
    at com.google.appengine.tools.development.DevAppServerModulesFilter.doFilter(DevAppServerModulesFilter.java:116)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
    at com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:97)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:485)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

我对示例项目所做的唯一修改是删除了Google Web Toolkit的使用,因为如果使用GWT,则无法启动测试服务器。我刚刚开始尝试使用AppEngine,非常感谢任何帮助。

2 个答案:

答案 0 :(得分:0)

您需要将特定的jar添加到类路径中,以便它们在运行时

中可用

答案 1 :(得分:0)

将Eclipse设置为使用JDK 7似乎可以解决问题,这解释了为什么它在实际的App Engine服务器上运行但在本地失败。它给出的错误仍然很奇怪......

可能会进一步测试并更新信息。