java.lang.VerifyError:期待一个堆栈映射帧

有没有办法将自定义的HttpServlet加载到GAE?我上传了一个项目,该项目在.server包中包含了一个HttpServlet,并将其添加到Web.xml...

<servlet>
   <servlet-name>testServlet</servlet-name>
   <servlet-class>gwtone.server.TestServlet</servlet-class>
</servlet>

<servlet-mapping>
   <servlet-name>testServlet</servlet-name>
   <url-pattern>/tester/greet</url-pattern>
</servlet-mapping>

我是否还缺少其他内容,或者不可能?

--------编辑--------

当我初始化我的服务器时出现的一些东西,我不习惯看到...

Jan 22, 2012 4:23:44 AM com.google.apphosting.utils.jetty.JettyLogger info
INFO: Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger
Jan 22, 2012 4:23:44 AM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
INFO: Successfully processed E:\Program Files\eclipse-SDK-3.7.1-win32-x86_64\Workspace\gwtone\war\WEB-INF/appengine-web.xml
Jan 22, 2012 4:23:44 AM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml
INFO: Successfully processed E:\Program Files\eclipse-SDK-3.7.1-win32-x86_64\Workspace\gwtone\war\WEB-INF/web.xml
Jan 21, 2012 10:23:44 PM com.google.appengine.tools.development.DevAppServerImpl start
INFO: The server is running at http://localhost:8888/
Jan 21, 2012 10:23:44 PM com.google.appengine.tools.development.DevAppServerImpl start
INFO: The admin console is running at http://localhost:8888/_ah/admin

这是当它崩溃时显示的内容。

WARNING: Error for /tester/greet
java.lang.VerifyError: Expecting a stackmap frame at branch target 14 in method gwtone.server.TestServlet.doGet(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V at offset 0
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
    at java.lang.Class.getConstructor0(Unknown Source)
    at java.lang.Class.newInstance0(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    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:362)
    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)

编辑 #2

package gwtone.server;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class TestServlet extends HttpServlet {

public TestServlet(){}

@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) 
        throws ServletException, IOException {
    System.out.println("0");
    try {
        System.out.println("1");
        resp.getWriter().println("IT WORKED");
        resp.getWriter().flush();
        System.out.println("2");
    } catch (IOException e) {
        e.printStackTrace();
    }
    System.out.println("3");
}
}

答案 1

正如BalusC所指出的,这个问题的一个解决方案是只使用JDK6。

如果你想继续使用JDK7,另一个解决方案是使用“-XX:-UseSplitVerifier”作为VM的参数。转到(G)

→ Java → →已安装的 JREs →编辑...→ 默认 VM 参数

并将其添加到那里。

Installed JREsJRE Definition


答案 2

GAE 使用 Java 1.6,但您已经使用 Java 1.7 编译了代码。您需要使用 Java 1.6 重新编译。根据评论,您正在使用Eclipse;您可以在项目属性的 Java >编译器部分中设置 Java 编译器级别。

enter image description here


推荐