Gwt RF';具有空RequestContext的未冻结bean';将ValueProxy参数与JsonRpc方言一起使用时
当我尝试发送一个使用ValueProxy参数的请求时,我得到了这个“未格式化bean”异常。我不知道这个异常是因为使用JsonDialect时RF出现错误还是我做错了什么。。。需要帮忙吗Gwt RF';具有空RequestContext的未冻结bean';将ValueProxy参数与JsonRpc方言一起使用时,gwt,requestfactory,autobean,Gwt,Requestfactory,Autobean,当我尝试发送一个使用ValueProxy参数的请求时,我得到了这个“未格式化bean”异常。我不知道这个异常是因为使用JsonDialect时RF出现错误还是我做错了什么。。。需要帮忙吗 java.lang.AssertionError: Unfrozen bean with null RequestContext at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.checkStreamsNot
java.lang.AssertionError: Unfrozen bean with null RequestContext
at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.checkStreamsNotCrossed(AbstractRequestContext.java:981)
at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.editProxy(AbstractRequestContext.java:509)
at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.edit(AbstractRequestContext.java:502)
at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.retainArg(AbstractRequestContext.java:1230)
at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.access$2(AbstractRequestContext.java:1223)
at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext$JsonRpcPayloadDialect.addInvocation(AbstractRequestContext.java:202)
at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.addInvocation(AbstractRequestContext.java:661)
at es.xxxx.taller.client.Taller_SomeRequestContextImpl.SomeCall(Taller_SomeRequestContextImpl.java:29)
at es.xxxx.taller.client.Taller.onModuleLoad(Taller.java:417)
public class SomeEntryPoint implements EntryPoint {
@JsonRpcProxy
public interface SomeProxy extends ValueProxy {
String getSomeProperty();
void setSomeProperty(String value);
}
@JsonRpcProxy
public interface VoidProxy extends ValueProxy {
}
public interface SomeAutoBeanFactory extends AutoBeanFactory {
SomeAutoBeanFactory INSTANCE = GWT.create(SomeAutoBeanFactory.class);
AutoBean<SomeProxy> someProxy();
}
public interface SomeRequestFactory extends RequestFactory {
SomeRequestFactory INSTANCE = GWT.create(SomeRequestFactory.class);
SomeRequestContext context();
}
@JsonRpcService
public interface SomeRequestContext extends RequestContext {
SomeCall SomeCall(SomeProxy proxy);
@JsonRpcWireName(value = "SomeCall")
public interface SomeCall extends Request<VoidProxy> {
}
}
public void onModuleLoad() {
SomeProxy someProxy = SomeAutoBeanFactory.INSTANCE.someProxy().as();
someProxy.setSomeProperty("someValue");
SomeRequestFactory.INSTANCE.context().SomeCall(someProxy).fire();
}
}
java.lang.AssertionError:RequestContext为null的未冻结bean
位于com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.checkStreamsNotCrossed(AbstractRequestContext.java:981)
位于com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.editProxy(AbstractRequestContext.java:509)
位于com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.edit(AbstractRequestContext.java:502)
在com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.retainArg(AbstractRequestContext.java:1230)上
在com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.access$2(AbstractRequestContext.java:1223)
位于com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext$JsonRpcPayloadDialect.addInvocation(AbstractRequestContext.java:202)
位于com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.addInvocation(AbstractRequestContext.java:661)
在es.xxxx.higher.client.higher\u SomeRequestContextImpl.SomeCall(higher\u SomeRequestContextImpl.java:29)
位于es.xxxx.tiller.client.tiller.onModuleLoad(tiller.java:417)
公共类SomeEntryPoint实现EntryPoint{
@JsonRpcProxy
公共接口SomeProxy扩展了ValueProxy{
字符串getSomeProperty();
void setSomeProperty(字符串值);
}
@JsonRpcProxy
公共接口VoidProxy扩展了ValueProxy{
}
公共接口SomeAutoBeanFactory扩展了AutoBeanFactory{
SomeAutoBeanFactory实例=GWT.create(SomeAutoBeanFactory.class);
AutoBean someProxy();
}
公共接口SomeRequestFactory扩展了RequestFactory{
SomeRequestFactory实例=GWT.create(SomeRequestFactory.class);
SomeRequestContext();
}
@JsonRpcService
公共接口SomeRequestContext扩展了RequestContext{
SomeCall SomeCall(SomeProxy代理);
@JsonRpcWireName(value=“SomeCall”)
公共接口SomeCall扩展请求{
}
}
moduleload()上的公共void{
SomeProxy SomeProxy=SomeAutoBeanFactory.INSTANCE.SomeProxy().as();
someProxy.setSomeProperty(“someValue”);
SomeRequestFactory.INSTANCE.context().SomeCall(someProxy.fire();
}
}
代理应该由RequestContext
创建,而不是AutoBeanFactory
!使用JsonRpc方言不会改变您使用RequestFactory的方式。
再次感谢托马斯!但使用您的示例代码,我现在得到了一个NullPointerException on fire():-(我应该把我的失败代码放在另一个stackoverflow的问题中吗?java.lang.NullPointerException:null位于com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.doFire(AbstractRequestContext.java:1102)我的RequestTransport为null!!抱歉!
public void onModuleLoad() {
SomeRequestContext ctx = SomeRequestFactory.INSTANCE.context();
SomeProxy someProxy = ctx.create(SomeProxy.class);
someProxy.setSomeProperty("someValue");
ctx.SomeCall(someProxy).fire();
}