Google App Engine Java无法运行应用程序HTTP 500

时间:2012-05-18 07:55:45

标签: java eclipse google-app-engine http-error

我有一个简单的servlet,如下所示。 Ite使用Google的用户服务。当我不使用它时,我没有任何错误。另外,我得到一个完整的错误列表,如下所示。我发现这是一个Eclipse已知问题,但我找不到解决方案。

import java.io.IOException;
import javax.servlet.http.*;
import com.google.appengine.api.users.User;
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;

@SuppressWarnings("serial")
public class GuestbookServlet extends HttpServlet {
    public void doGet(HttpServletRequest req, HttpServletResponse resp)
              throws IOException {
        UserService userService = UserServiceFactory.getUserService();
        User user = userService.getCurrentUser();

        if (user != null) {
            resp.setContentType("text/plain");
            resp.getWriter().println("Hello, " + user.getNickname());
        } else {
            resp.sendRedirect(userService.createLoginURL(req.getRequestURI()));
        }
    }
}

这是第一个错误:

HTTP ERROR 500

Problem accessing /guestbook. Reason: 
    Expecting a stackmap frame at branch target 117 in method guestbook.GuestbookServlet.doGet(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V at offset 34

Caused by:
java.lang.VerifyError: Expecting a stackmap frame at branch target 117 in method guestbook.GuestbookServlet.doGet(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V at offset 34
    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)

问题来自Java版本吗?我正在运行Eclipse Indigo和Java 7.我该怎么做

1 个答案:

答案 0 :(得分:3)

这似乎是JDK7的一个已知的日食问题。请检查this link以获取解决方法/解决方案。