請問你們能幫我解釋爲什麼我有這個例外嗎?
我提取RequestFactory代理和上下文接口劃分爲單獨的jar,所以我可以在GWT客戶端和Android客戶端使用兩個(詳情here)
不幸的是RF拋出的第一個調用服務器上的一個例外。例外是:
com.google.web.bindery.requestfactory.server.UnexpectedException: No RequestContext for operation LPZEK7DlYkoG1$NQ5MjHlmuRChk=
at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.die(ServiceLayerDecorator.java:216)
at com.google.web.bindery.requestfactory.server.ResolverServiceLayer.resolveRequestContext(ResolverServiceLayer.java:154)
下面是我的工廠界面。正如你所看到的,我必須用ServiceName
替換Service
註釋,因爲我不想用Guice注入來編譯所有定製的定位器,這些定位器將發佈到移動設備上的jar中。
public interface AdminRequestFactory extends RequestFactory
{
// @Service(value = UserServiceDao.class, locator = InjectingServiceLocator.class)
@ServiceName(value = "com.blah.courierApp.server.dao.UserServiceDao", locator = "com.blah.courierApp.server.inject.InjectingServiceLocator")
public interface GaeUserServiceContext extends RequestContext
{
public Request<String> createLogoutURL(String destinationURL);
public Request<GaeUser> getCurrentUser();
}
// @Service(value = OrderDao.class, locator = InjectingServiceLocator.class)
@ServiceName(value = "com.blah.courierApp.server.dao.OrderDao", locator = "com.blah.courierApp.server.inject.InjectingServiceLocator")
public interface OrderRequestContext extends RequestContext
{
Request<List<OrderProxy>> listAll();
Request<Void> delete(Long id);
Request<Void> createOrder(OrderProxy order);
Request<OrderProxy> findOrderById(long id);
Request<Void> updateOrderState(long id, StateType newStateType);
}
GaeUserServiceContext contextUserService();
OrderRequestContext contextOrder();
}
當我編譯它RF註釋工具給瞭如下警告:
Cannot fully validate context since domain type com.blah.courierApp.server.dao.UserServiceDao is not available.
You must run the ValidationTool as part of your server build process.
Add @SuppressWarnings("requestfactory") to dismiss.
因此,當服務器上的調試器下拋出的例外,我看到的com.google.web.bindery.requestfactory.vm.impl.Deobfuscator
實例都有空operationData
場正在被初始化由DeobfuscatorBuilder
由RequestFactory註釋工具生成的類。
所以...我反編譯該類和發現這一點:工廠
public final class AdminRequestFactoryDeobfuscatorBuilder extends Deobfuscator.Builder
{
public AdminRequestFactoryDeobfuscatorBuilder()
{
withRawTypeToken("w1Qg$YHpDaNcHrR5HZ$23y518nA=", "com.google.web.bindery.requestfactory.shared.EntityProxy");
withRawTypeToken("8KVVbwaaAtl6KgQNlOTsLCp9TIU=", "com.google.web.bindery.requestfactory.shared.ValueProxy");
withRawTypeToken("FXHD5YU0TiUl3uBaepdkYaowx9k=", "com.google.web.bindery.requestfactory.shared.BaseProxy");
withRawTypeToken("5vjE9LUy$l0uvi4kMYpS3JA1WEE=", "com.blah.shared.model.GaeUser");
withRawTypeToken("8KVVbwaaAtl6KgQNlOTsLCp9TIU=", "com.google.web.bindery.requestfactory.shared.ValueProxy");
withRawTypeToken("5a7OV4PSV$1xemsooKLfEQ4g5yY=", "com.blah.shared.proxies.OrderProxy");
withRawTypeToken("neR_xIhE5oZsc0HbnkAMa8A88yw=", "com.blah.shared.proxies.OrderStateProxy");
withRawTypeToken("t6gMQWDROJnYvqYhNURV8pd$sn4=", "com.blah.shared.proxies.OrganizationProxy");
withRawTypeToken("1o45xgS$5bIkBKF4wlR8oMw_FSo=", "com.blah.shared.proxies.PersonProxy");
withRawTypeToken("FXHD5YU0TiUl3uBaepdkYaowx9k=", "com.google.web.bindery.requestfactory.shared.BaseProxy");
}
}
它沒有生成的標記。因此沒有呼叫Deobfuscator.Builder.withOperation
,因爲當呼叫來自客戶端時,我的服務器無法找到上下文。
的問題是:
- 爲什麼不RequestFactory註釋工具生成工廠(操作)令牌?
- 我該如何解決?
我建議刪除這篇文章,因爲它顯然不是一個答案(儘管你可以發佈它作爲答案)。 – fdreger 2014-08-29 11:50:22