2012-06-04 220 views
2

您好我有次在一個新的谷歌應用程序引擎(SDK 1.6.6)的Eclipse項目如下Servlet谷歌應用程序引擎 - Servlet的:

package test; 

import java.io.IOException; 
import java.io.PrintWriter; 

import javax.servlet.http.*; 

@SuppressWarnings("serial") 
public class TestStorageServlet extends HttpServlet { 
    public void doGet(HttpServletRequest req, HttpServletResponse resp) 
      throws IOException { 
     resp.setContentType("text/plain"); 
     PrintWriter writer = resp.getWriter(); 
     try { 
      writer.write("Hello"); 
     } catch (Exception ex) { 
      writer.write("Error: " + ex.getMessage()); 
     } finally { 
      writer.close(); 
     } 
    } 
} 
(錯誤的方法測試期待的分支目標44 stackmap幀)。

這樣一個Servlet是在Tomcat上工作正常(作爲一個正常的Java Web項目)米,但在谷歌App Engine的項目我面臨以下500錯誤:

HTTP ERROR 500 

Problem accessing /teststorage. Reason: 

    Expecting a stackmap frame at branch target 44 in method test.TestStorageServlet.doGet(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V at offset 25 
Caused by: 

java.lang.VerifyError: Expecting a stackmap frame at branch target 44 in method test.TestStorageServlet.doGet(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V at offset 25 
    at java.lang.Class.getDeclaredConstructors0(Native Method) 
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404) 
    at java.lang.Class.getConstructor0(Class.java:2714) 
    at java.lang.Class.newInstance0(Class.java:343) 
    at java.lang.Class.newInstance(Class.java:325) 
    at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153) 
    at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:428) 
    at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339) 
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) 
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166) 
    at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:35) 
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) 
    at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:60) 
    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:122) 
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) 
    at com.google.appengine.tools.development.BackendServersFilter.doFilter(BackendServersFilter.java:97) 
    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:78) 
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) 
    at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:369) 
    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) 
Powered by Jetty:// 

回答

2

看來你與JDK7編譯。 http://java.dzone.com/articles/javalangverifyerror-expecting

嘗試切換到JDK6。

更新:這個答案現在已經老了,不再相關了。 jdk7的解決方案似乎是將-XX:-UseSplitVerifier添加到您的JVM參數。

查看更多信息這樣的問題:Why am I getting the following error when running Google App from eclipse?

+0

javac的源= 「1.6」 目標= 「1.6」 –

+0

的java 6已被棄用上GAE。對我來說同樣的錯誤:https://gist.github.com/ZiglioNZ/bd1d7d424727b3f26c64 – ZiglioUK

+0

我的答案已超過一年,不再相關。看到這個鏈接可能的解決方案(+評論):http://java.dzone.com/articles/javalangverifyerror-expecting –