On Friday, January 21, 2011 12:59:12 AM UTC+1, Romain BIARD wrote:
>
> Hi everybody, 
>
> I'm currently trying to integrate GIN on a POC which deals with 
> RequestFactory and EventBus. 
> 1) I first noticed that I had to extends some Technical Classes with 
> no reasons except to mark the constructor whit @Inject like this : 
>
> public class PamdaPlaceHistoryHandler extends PlaceHistoryHandler { 
>
> @Inject 
> public PamdaPlaceHistoryHandler(PlaceHistoryMapper mapper) { 
> super(mapper); 
> } 
> } 
>

Or you could simply use a Provider and bind() it explicitly in your 
GinModule, or (even more simple) use @Provides method in your GinModule:
   @Provides
   PlaceHistoryHandle providePlaceHistoryHandler(PlaceHistoryMapper mapper) 
{
      return new PlaceHistoryHandler(mapper);
   }

 

> 2) After initializing the injector and create all the singletons 
> through GIN (eventBus, RequestFactory and so on ...), my app threw a 
> NPE when fire a event in order to retrieve Proxies through Request 
> Factory ..... Here's the stack : 
>
>
> Caused by: com.google.gwt.event.shared.UmbrellaException: One or more 
> exceptions caught, see full set in UmbrellaException#getCauses 
>     at 
> com.google.gwt.activity.shared.ActivityManager.onPlaceChange(ActivityManager.java:
>  
>
> 173) 
>     at 
> com.google.gwt.place.shared.PlaceChangeEvent.dispatch(PlaceChangeEvent.java: 
>
> 52) 
>     at 
> com.google.gwt.place.shared.PlaceChangeEvent.dispatch(PlaceChangeEvent.java: 
>
> 1) 
>     at 
> com.google.gwt.event.shared.SimpleEventBus.doFire(SimpleEventBus.java: 
> 204) 
>     at 
> com.google.gwt.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java: 
> 103) 
>     at 
> com.google.gwt.place.shared.PlaceController.goTo(PlaceController.java: 
> 115) 
>     at 
> com.google.gwt.place.shared.PlaceHistoryHandler.handleHistoryToken(PlaceHistoryHandler.java:
>  
>
> 179) 
>     at 
> com.google.gwt.place.shared.PlaceHistoryHandler.handleCurrentHistory(PlaceHistoryHandler.java:
>  
>
> 117) 
>     at 
> com.francetelecom.entreprise.fme.client.Pamda.onModuleLoad(Pamda.java: 
> 36) 
>     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.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java: 
> 396) 
>     at 
> com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:
>  
>
> 183) 
>     at 
> com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:
>  
>
> 510) 
>     at 
> com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java: 
>
> 352) 
>     at java.lang.Thread.run(Thread.java:680) 
> Caused by: java.lang.NullPointerException: null 
>     at 
> com.google.gwt.requestfactory.shared.impl.AbstractRequestContext.doFire(AbstractRequestContext.java:
>  
>
> 606) 
>     at 
> com.google.gwt.requestfactory.shared.impl.AbstractRequestContext.fire(AbstractRequestContext.java:
>  
>
> 210) 
>     at 
> com.google.gwt.requestfactory.shared.impl.AbstractRequest.fire(AbstractRequest.java:
>  
>
> 54) 
>     at 
> com.google.gwt.requestfactory.shared.impl.AbstractRequest.fire(AbstractRequest.java:
>  
>
> 59) 
>
> The cause of this NPE seems to come from the request Factory which 
> hasn't been initialized with the EventBus.... 
>
> Am I supose to call requestFactory.initialize(eventBus) each time i 
> would make a call? Am I wrong on initialization on my App ?
>

It's hard to tell: are you ever calling initialize(eventBus) somewhere on 
the initialization of your app?

FWIW, I register() the PlaceHistoryHandler in my EntryPoint's onModuleLoad, 
but I initialize() the RequestFactory from within a @Provides method in my 
GinModule, where I explicitly call the GWT.create():

   @Provides
   @Singleton
   MyAppRequestFactory provideMyAppRequestFactory(EventBus eventBus) {
      MyAppRequestFactory requestFactory = 
GWT.create(MyAppRequestFactory.class);
      requestFactory.initialize(eventBus);
      return requestFactory;
   }

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to