1

我有一个简单的 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。我应该怎么做

4

1 回答 1

3

这似乎是 JDK7 的一个已知 Eclipse 问题。请检查此链接以获取解决方法/解决方案。

于 2012-05-18T08:04:23.600 回答