MVP pattern uncaught exception

91 views
Skip to first unread message

Jordi Planadecursach

unread,
May 24, 2011, 4:36:54 AM5/24/11
to Google Web Toolkit
Hello guys,

I have an exception in the following code using the MVP pattern. I'm
just iniciaiting myself to the GWT world and I would need some help.

Call:

public class LoginActivity extends AbstractActivity implements
LoginView.Presenter {
private ClientFactory clientFactory;
[...]
public void goToControlPanel() {
clientFactory.getPlaceController().goTo(new
ControlPanelPlace("controlPanelPlace"));
}

Stack trace:

10:26:01.019 [ERROR] [rourevell_booking] Uncaught exception escaped
com.google.gwt.event.shared.UmbrellaException: One or more exceptions
caught, see full set in UmbrellaException#getCauses
at
com.google.gwt.event.shared.EventBus.castFireEvent(EventBus.java:70)
at
com.google.gwt.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:
57)
at
com.google.gwt.place.shared.PlaceController.goTo(PlaceController.java:
136)
at
com.rourevell.booking.client.activity.LoginActivity.goToControlPanel(LoginActivity.java:
29)
at com.rourevell.booking.client.ui.LoginViewImpl
$1$1.onSuccess(LoginViewImpl.java:61)
at com.rourevell.booking.client.ui.LoginViewImpl
$1$1.onSuccess(LoginViewImpl.java:1)
at
com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:
232)
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(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.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:
167)
at
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:
326)
at
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:
207)
at
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:
132)
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:214)
at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
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:
167)
at
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:
281)
at
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:
531)
at
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:
352)
at java.lang.Thread.run(Thread.java:619)
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:
70)
at
com.google.gwt.place.shared.PlaceChangeEvent.dispatch(PlaceChangeEvent.java:
1)
at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
at
com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:
193)
at
com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:
88)
at
com.google.gwt.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:
52)
at
com.google.gwt.event.shared.EventBus.castFireEvent(EventBus.java:68)
at
com.google.gwt.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:
57)
at
com.google.gwt.place.shared.PlaceController.goTo(PlaceController.java:
136)
at
com.rourevell.booking.client.activity.LoginActivity.goToControlPanel(LoginActivity.java:
29)
at com.rourevell.booking.client.ui.LoginViewImpl
$1$1.onSuccess(LoginViewImpl.java:61)
at com.rourevell.booking.client.ui.LoginViewImpl
$1$1.onSuccess(LoginViewImpl.java:1)
at
com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:
232)
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(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.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:
167)
at
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:
326)
at
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:
207)
at
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:
132)
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:214)
at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
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:
167)
at
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:
281)
at
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:
531)
at
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:
352)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException: null
at
com.rourevell.booking.client.ui.ControlPanelViewImpl.<init>(ControlPanelViewImpl.java:
80)
at
com.rourevell.booking.client.service.impl.ClientFactoryImpl.getControlPanelView(ClientFactoryImpl.java:
37)
at
com.rourevell.booking.client.activity.ControlPanelActivity.start(ControlPanelActivity.java:
21)
at
com.google.gwt.activity.shared.ActivityManager.onPlaceChange(ActivityManager.java:
158)
at
com.google.gwt.place.shared.PlaceChangeEvent.dispatch(PlaceChangeEvent.java:
70)
at
com.google.gwt.place.shared.PlaceChangeEvent.dispatch(PlaceChangeEvent.java:
1)
at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
at
com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:
193)
at
com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:
88)
at
com.google.gwt.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:
52)
at
com.google.gwt.event.shared.EventBus.castFireEvent(EventBus.java:68)
at
com.google.gwt.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:
57)
at
com.google.gwt.place.shared.PlaceController.goTo(PlaceController.java:
136)
at
com.rourevell.booking.client.activity.LoginActivity.goToControlPanel(LoginActivity.java:
29)
at com.rourevell.booking.client.ui.LoginViewImpl
$1$1.onSuccess(LoginViewImpl.java:61)
at com.rourevell.booking.client.ui.LoginViewImpl
$1$1.onSuccess(LoginViewImpl.java:1)
at
com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:
232)
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(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.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:
167)
at
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:
326)
at
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:
207)
at
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:
132)
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:214)
at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
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:
167)
at
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:
281)
at
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:
531)
at
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:
352)
at java.lang.Thread.run(Thread.java:619)

Thanks to give me some tips in how to solve the issue.

Cheers,
Jordi.

Alisson Prestes

unread,
May 24, 2011, 4:58:51 PM5/24/11
to google-we...@googlegroups.com
You must find the "caused by" on the stack trace:

Caused by: java.lang.NullPointerException: null 
   at com.rourevell.booking.client.ui.ControlPanelViewImpl.<init>(ControlPanelViewImpl.java:80)
   at com.rourevell.booking.client.service.impl.ClientFactoryImpl.getControlPanelView(ClientFactoryImpl.java:37)
   at com.rourevell.booking.client.activity.ControlPanelActivity.start(ControlPanelActivity.java:21)
...

It seems that you tried to acess a variable without checking if it's null and got this error. Did you initialize the variable?

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


Jordi Planadecursach

unread,
May 25, 2011, 8:19:27 AM5/25/11
to Google Web Toolkit
Problem identified. Thanks for the help.

The activity was injected to the View after its construction while the
activity was requested by the class inicializator.
I am forced to pass the activity in the constructor of the view.

Is that a good practice?

On 24 Maig, 22:58, Alisson Prestes <javalis...@gmail.com> wrote:
> You must find the "caused by" on the stack trace:
>
> Caused by: java.lang.NullPointerException: null
>
>  at com.rourevell.booking.client.ui.ControlPanelViewImpl.<init>(ControlPanelVie wImpl.java:80)
>
>  at com.rourevell.booking.client.service.impl.ClientFactoryImpl.getControlPanel View(ClientFactoryImpl.java:37)
>
>  at com.rourevell.booking.client.activity.ControlPanelActivity.start(ControlPan elActivity.java:21)
> ...
>
> It seems that you tried to acess a variable without checking if it's null
> and got this error. Did you initialize the variable?
>
> Alisson Presteswww.google.com/profiles/javalisson
>
> On Tue, May 24, 2011 at 5:36 AM, Jordi Planadecursach
> <planad...@gmail.com>wrote:
> > com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChanne lServer.java:
> > 281)
> >    at
>
> > com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChan nelServer.java:
> > com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChanne lServer.java:
> > 281)
> >    at
>
> > com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChan nelServer.java:
> > 88)
> >    at
> > com.google.gwt.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:
> > 52)
> >    at
> > com.google.gwt.event.shared.EventBus.castFireEvent(EventBus.java:68)
> >    at
> > com.google.gwt.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:
> > 57)
> >    at
> > com.google.gwt.place.shared.PlaceController.goTo(PlaceController.java:
> > 136)
> >    at
>
> > com.rourevell.booking.client.activity.LoginActivity.goToControlPanel(LoginA ctivity.java:
> > 29)
> >    at com.rourevell.booking.client.ui.LoginViewImpl
> > $1$1.onSuccess(LoginViewImpl.java:61)
> >    at com.rourevell.booking.client.ui.LoginViewImpl
> > $1$1.onSuccess(LoginViewImpl.java:1)
> >    at
>
> > com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceiv ed(RequestCallbackAdapter.java:
> > 232)
> >    at
> > com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:
> > 287)
> >    at
>
> ...
>
> llegiu-ne més »
Reply all
Reply to author
Forward
0 new messages