0

私の GWT アプリには、RequestFactory + Objectify (GAE Datastore) による永続性が含まれています。以下のコードは機能しますが (データは GAE に正常に保存されます)、以下の例外が発生します。何か案は?ありがとう

10:22:56.772 [ERROR] [dialective] Uncaught exception escaped

java.lang.IllegalStateException: The AutoBean has been frozen
    at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.checkFrozen(AbstractAutoBean.java:195)
    at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.setProperty(AbstractAutoBean.java:270)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:289)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
    at com.google.web.bindery.autobean.gwt.client.impl.ClientPropertyContext$Setter$.call$(ClientPropertyContext.java)
    at com.google.web.bindery.autobean.gwt.client.impl.ClientPropertyContext.set(ClientPropertyContext.java:137)
    at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext$3.visitValueProperty(AbstractRequestContext.java:910)
    at com.gw.dialective.shared.model.DiagramProxyAutoBean_com_google_web_bindery_requestfactory_shared_impl_EntityProxyCategory_com_google_web_bindery_requestfactory_shared_impl_ValueProxyCategory_com_google_web_bindery_requestfactory_shared_impl_BaseProxyCategory.traverseProperties(DiagramProxyAutoBean_com_google_web_bindery_requestfactory_shared_impl_EntityProxyCategory_com_google_web_bindery_requestfactory_shared_impl_ValueProxyCategory_com_google_web_bindery_requestfactory_shared_impl_BaseProxyCategory.java:222)
    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.shared.impl.AbstractRequestContext.processReturnOperation(AbstractRequestContext.java:879)
    at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.processReturnOperations(AbstractRequestContext.java:1215)
    at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.access$7(AbstractRequestContext.java:1185)
    at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext$StandardPayloadDialect.processPayload(AbstractRequestContext.java:347)
    at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext$5.onTransportSuccess(AbstractRequestContext.java:1108)
    at com.google.web.bindery.requestfactory.gwt.client.DefaultRequestTransport$1.onResponseReceived(DefaultRequestTransport.java:136)
    at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287)
    at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
    at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
    at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213)
    at sun.reflect.GeneratedMethodAccessor34.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
    at java.lang.Thread.run(Unknown Source)

MyApp.java

public void update(int index, DiagramBox object, String value) {                            
            object.setDescription(value);
            sendUpdateDiagramBoxEvent(index, BasicConstants.editableTableFields.DESCRIPTION, value); // send event to the View
            DiagramRequest diagramRequest = requestFactory.diagramRequest();
            DiagramProxy newDiagramProxy = diagramRequest.create(DiagramProxy.class); // Create new diagram entity
            Date date = new Date();
            newDiagramProxy.set_id("DUEN39AS89AS");
            newDiagramProxy.setDateCreated(date);
            newDiagramProxy.setDateEdited(date);
            diagramRequest.saveAndReturn(newDiagramProxy).fire(); 
          }
        });

DiagramRequest.java

@Service(value=DiagramDao.class, locator=DaoServiceLocator.class)
public interface DiagramRequest extends RequestContext {
    Request<DiagramProxy> saveAndReturn(DiagramProxy diagram);
}

図Dao.java

public class DiagramDao extends ObjectifyDao<Diagram>{

    public Diagram saveAndReturn(Diagram diagram)
    {
        Key<Diagram> key = this.put(diagram);
        try
        {
            return this.get(key);
        }
        catch (Exception e)
        {
            throw new RuntimeException(e);
        }
    }
}

DaoServiceLocator.java

public class DaoServiceLocator implements ServiceLocator {
    public Object getInstance(Class<?> clazz) {
        try {
            return clazz.newInstance();
        } catch (InstantiationException e) {
            throw new RuntimeException(e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        }
    }
}
4

1 に答える 1

1

これは、サーバーが受信 (クライアントから送信) されたものと同じエンティティを返すが、別のインスタンスとして返される場合に発生する可能性があります。

あなたのケースではsaveAndReturnthis.get(key)引数として受け取ったものとは異なるオブジェクトを返す場合、その問題が発生します。ここにいたほうがいいreturn diagram

http://code.google.com/p/google-web-toolkit/issues/detail?id=7341をご覧ください

于 2012-09-30T09:44:28.567 に答える