0

我尝试部署我的应用程序,该应用程序还将数据存储在应用引擎的数据存储区中。我使用 objectify 库来访问数据存储。它在本地运行没有问题,我可以在本地访问管理数据存储。但是当我尝试部署它的时候,虽然eclipse说已经部署成功了,但是当我尝试url的时候,却报错:NOT_FOUND。在日志中(在应用程序引擎中)有两个警告:

com.google.api.server.spi.response.ServletResponseResultWriter getWriteObjectifyKeyAsStringModule: Exception while resolving Objectify Key#getString
java.lang.NoSuchMethodException: com.googlecode.objectify.Key.getString()
at com.google.appengine.runtime.Request.process-16096d3fb5bf337e(Request.java)
at java.lang.Class.getMethod(Class.java:216)
at com.google.api.server.spi.response.ServletResponseResultWriter.getWriteObjectifyKeyAsStringModule(ServletResponseResultWriter.java:154)
at com.google.api.server.spi.response.ServletResponseResultWriter.<init>(ServletResponseResultWriter.java:57)
at com.google.api.server.spi.SystemServiceServlet.getResponseWriter(SystemServiceServlet.java:127)
at com.google.api.server.spi.SystemServiceServlet.doPost(SystemServiceServlet.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
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 org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
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 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.HttpConnection.handle(HttpConnection.java:404)
at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:454)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:461)
at com.google.tracing.TraceContext.runInContext(TraceContext.java:703)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:338)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:330)
at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:458)
at java.lang.Thread.run(Thread.java:679)

com.google.api.server.spi.request.ServletRequestParamReader getObjectifyKeyModule: Exception while resolving Objectify Key#create
       java.lang.NoSuchMethodException: com.googlecode.objectify.Key.create(java.lang.String)
at com.google.appengine.runtime.Request.process-16096d3fb5bf337e(Request.java)
at java.lang.Class.getMethod(Class.java:216)
at com.google.api.server.spi.request.ServletRequestParamReader.getObjectifyKeyModule(ServletRequestParamReader.java:147)
at com.google.api.server.spi.request.ServletRequestParamReader.<init>(ServletRequestParamReader.java:131)
at com.google.api.server.spi.SystemServiceServlet.getParamReader(SystemServiceServlet.java:122)
at com.google.api.server.spi.SystemServiceServlet.execute(SystemServiceServlet.java:140)
at com.google.api.server.spi.SystemServiceServlet.doPost(SystemServiceServlet.java:112)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
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 org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
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 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.HttpConnection.handle(HttpConnection.java:404)
at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:454)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:461)
at com.google.tracing.TraceContext.runInContext(TraceContext.java:703)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:338)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:330)
at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:458)

我有 4 个看起来很多的 rpc 方法,所以我将举一个其中的一个示例:

问候服务:

@RemoteServiceRelativePath("registration")
public interface GreetingService extends RemoteService {
    String greetServer(String email, String pass, String rPass, int job ) throws IllegalArgumentException;

}

异步:

public interface GreetingServiceAsync {
    void greetServer(String email, String pass, String rPass, int job, AsyncCallback<String> callback) throws IllegalArgumentException;
}

和实施:

@SuppressWarnings("serial")
public class GreetingServiceImpl extends RemoteServiceServlet implements GreetingService {

    static {
        ObjectifyService.register(LoginUser.class);
    }

    public String greetServer(String email, String pass, String rPass, int job) throws IllegalArgumentException {

        Objectify ofy = ObjectifyService.begin();

        LoginUser user = new LoginUser();

        if (!FieldVerifier.isValidName(email)) {
            throw new IllegalArgumentException("Name must be at least 4 characters long");
        }
        if (!FieldVerifier.isValidPass(pass, rPass)) {
            throw new IllegalArgumentException("Password and Repeat Password do not match!");
        } else {
            user.setEmail(email);
            user.setPassword(pass);
            user.setJob(job);
            ofy.put(user);
        }

        return email;
    }
}

有任何想法吗??

4

2 回答 2

0

我从来没有发现问题是什么。我只是重新安装了 gwt 和 gae,创建了一个新项目并且能够部署它。

于 2013-02-07T16:40:40.823 回答
0

I had the same problem. Then I realized that I had objectify-3.0.jar in my war/WEB-INF/lib The Key.getString() method apparently was added to version 3.1 only, so after I replaced objectify-3.0.jar with objectify-3.1.jar the problem was gone.

于 2013-03-08T02:36:51.207 回答