编辑代理时参数类型不匹配

时间:2012-07-10 19:44:31

标签: google-app-engine gwt

我似乎无法弄清楚导致此问题的原因如下。我能够创建并持久化B类型的对象,它具有父A(@Parent)并且具有C类型的嵌入对象。当我尝试编辑对象时,我得到下面的错误。什么会导致这个错误?

public class A extends DatastoreObject<Long>{
      @Id private Long id;

      @Override
      public Long getId() {
        return id;
      }

      public void setId(Long id) {
        this.id = id;
      }

    }

    public class C extends ValueProxy{
      private String name;

      public String getName() {
        return name;
      }

      public void setName(String name) {
        this.name = name;
      }

    }


    public class B extends DatastoreObject<Long>{
      @Id private Long id;
      @Parent public Key<A> a;
      public String label;
     @Embedded
     public C c;

      @Override
      public Long getId() {
        return id;
      }

      public void setId(Long id) {
        this.id = id;
      }

    public String getLabel() {
        return label;
     }

     public void setLabel(String label) {
        this.label = label;
     }

      public A getA(){
        if (a == null) {
            return null;
        }

        try {
            return new ADAO().get(a);
        } catch (NotFoundException e){
            return null;
        }
      }

      public void setA(A a) {
        this.a = new ADAO().key(a);
      }

     public void setCustomer(Key<A> a){
       this.a = a;
     }

     public C getC(){
        return c;
     }
     public void setC(C c){
      this.c = c;
     }

    }

private void updateSite(String label){

    BRequest bRequest = requestFactory.bRequest();
    BProxy b = bRequest.edit(bToEdit); //bToEdit is set when I get the object earlier
    b.setLabel("something");

    siteRequest.persist(b);
    siteRequest.fire(...);

}

com.google.web.bindery.requestfactory.server.RequestFactoryServlet doPost
SEVERE: Unexpected error
java.lang.IllegalArgumentException: argument type mismatch
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:104)
    at com.google.web.bindery.requestfactory.server.ReflectiveServiceLayer.setProperty(ReflectiveServiceLayer.java:234)
    at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.setProperty(ServiceLayerDecorator.java:193)
    at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.setProperty(ServiceLayerDecorator.java:193)
    at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.setProperty(ServiceLayerDecorator.java:193)
    at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor$1.visitReferenceProperty(SimpleRequestProcessor.java:529)
    at com.google.web.bindery.autobean.vm.impl.ProxyAutoBean.traverseProperties(ProxyAutoBean.java:324)
    at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.traverse(AbstractAutoBean.java:166)
    at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.accept(AbstractAutoBean.java:101)
    at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.processOperationMessages(SimpleRequestProcessor.java:516)
    at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:210)
    at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:127)
    at com.google.web.bindery.requestfactory.server.RequestFactoryServlet.doPost(RequestFactoryServlet.java:133)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263)
    at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178)
    at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)
    at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62)
    at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)
    at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    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:363)
    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.content(HttpConnection.java:938)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
    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)

1 个答案:

答案 0 :(得分:0)

看起来我忘了将C对象放在我的BProxy对象类中。 whops。