Strange History Behaviour

118 views
Skip to first unread message

Sven

unread,
Jun 20, 2011, 10:32:09 AM6/20/11
to Google Web Toolkit
Hi mates,

we use the 2.3 MVP architecture. But we now recognize a strange
behaviour.

After setting up everything properly in our onModuleLoad there is the
point where you have to tell the default place. So we did. After that
we call handleCurrentHistory().

...
PlaceHistoryHandler historyHandler = new
DfsPlaceHistoryHandler(historyMapper, new DfsHistorian());
Place defaultPlace = new EventSummary();
historyHandler.register(placeController, eventBus, defaultPlace);
...

...
getPlaceHistoryHandler().handleCurrentHistory();
...

Now what's weird. Starting in Eclipse everthing runs fine. But
deployed to our apache we get a strange exception which was actually
crypted. We managed just to make it readable. But it does not really
explain why or what is going wrong?

Here the exception stack:
com.google.gwt.event.shared.UmbrellaException: One or more exceptions
caught, see full set in UmbrellaException#getCauses
at Unknown.com_google_gwt_core_client_impl_StackTraceCreator
$Collector_fillInStackTrace__Ljava_lang_Throwable_2V(Unknown Source)
at
Unknown.com_google_gwt_core_client_impl_StackTraceCreator_fillInStackTrace__Ljava_lang_Throwable_2V(Unknown
Source)
at Unknown.java_lang_Throwable_
$fillInStackTrace__Ljava_lang_Throwable_2Ljava_lang_Throwable_2(Unknown
Source)
at Unknown.java_lang_Throwable_$
$init__Ljava_lang_Throwable_2V(Unknown Source)
at
Unknown.java_lang_Throwable_Throwable__Ljava_lang_String_2Ljava_lang_Throwable_2V(Unknown
Source)
at
Unknown.java_lang_Exception_Exception__Ljava_lang_String_2Ljava_lang_Throwable_2V(Unknown
Source)
at
Unknown.java_lang_RuntimeException_RuntimeException__Ljava_lang_String_2Ljava_lang_Throwable_2V(Unknown
Source)
at
Unknown.com_google_web_bindery_event_shared_UmbrellaException_UmbrellaException__Ljava_util_Set_2V(Unknown
Source)
at
Unknown.com_google_gwt_event_shared_UmbrellaException_UmbrellaException__Ljava_util_Set_2V(Unknown
Source)
at Unknown.com_google_gwt_event_shared_EventBus_
$castFireEvent__Lcom_google_gwt_event_shared_EventBus_2Lcom_google_gwt_event_shared_GwtEvent_2V(Unknown
Source)
at Unknown.com_google_gwt_event_shared_SimpleEventBus_
$fireEvent__Lcom_google_gwt_event_shared_SimpleEventBus_2Lcom_google_gwt_event_shared_GwtEvent_2V(Unknown
Source)
at Unknown.de_systemagmbh_dfs_client_factory_AbstractClientFactory
$1_fireEvent__Lcom_google_gwt_event_shared_GwtEvent_2V(Unknown Source)
at Unknown.com_google_gwt_place_shared_PlaceController_
$goTo__Lcom_google_gwt_place_shared_PlaceController_2Lcom_google_gwt_place_shared_Place_2V(Unknown
Source)
at
Unknown.de_systemagmbh_dfs_client_place_DfsPlaceController_goTo__Lcom_google_gwt_place_shared_Place_2V(Unknown
Source)
at Unknown.de_systemagmbh_dfs_client_Index$DfsPlaceHistoryHandler_
$doHandleHistoryToken__Lde_systemagmbh_dfs_client_Index
$DfsPlaceHistoryHandler_2Ljava_lang_String_2V(Unknown Source)
at Unknown.de_systemagmbh_dfs_client_Index
$DfsPlaceHistoryHandler_handleCurrentHistory__V(Unknown Source)
at Unknown.de_systemagmbh_dfs_client_Index_
$loginAccepted__Lde_systemagmbh_dfs_client_Index_2Lde_systemagmbh_dfs_shared_model_Config_2V(Unknown
Source)
at Unknown.de_systemagmbh_dfs_client_Index$1_
$onSuccess__Lde_systemagmbh_dfs_client_Index
$1_2Lde_systemagmbh_dfs_shared_model_Config_2V(Unknown Source)
at Unknown.de_systemagmbh_dfs_client_Index
$1_onSuccess__Ljava_lang_Object_2V(Unknown Source)
at
Unknown.com_google_gwt_user_client_rpc_impl_RequestCallbackAdapter_onResponseReceived__Lcom_google_gwt_http_client_Request_2Lcom_google_gwt_http_client_Response_2V(Unknown
Source)
at Unknown.com_google_gwt_http_client_Request_
$fireOnResponseReceived__Lcom_google_gwt_http_client_Request_2Lcom_google_gwt_http_client_RequestCallback_2V(Unknown
Source)
at Unknown.com_google_gwt_http_client_RequestBuilder
$1_onReadyStateChange__Lcom_google_gwt_xhr_client_XMLHttpRequest_2V(Unknown
Source)
at Unknown.anonymous(Unknown Source)
at
Unknown.com_google_gwt_core_client_impl_Impl_apply__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2(Unknown
Source)
at
Unknown.com_google_gwt_core_client_impl_Impl_entry0__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2(Unknown
Source)
at Unknown.anonymous(Unknown Source)

Did someone have such an unusual behaviour too?
It seems that something goes wrong with the eventbus but we can't
figure it out what it really is?

Second strange thing is that if we change the default place everything
works. No exception, nothnig, everything fine. But our places are
almost the same actually only names differ :/

Hope someone can push me to the right direction ;)

Thx

Thomas Broyer

unread,
Jun 20, 2011, 11:23:55 AM6/20/11
to google-we...@googlegroups.com
Unfortunately, the stack trace is not helpful without the exception's "cause". Could you add a GWT.UncaughtExceptionHandler that shows the getCause() ?

Anyway, it's something to do with a PlaceChangeHandler throwing an exception (that one being in the getCause() or the UmbrellaException; there might be several such exceptions though, that's what UmbrellaExceptions has a getCauses(), but you could nuke them one at a time).
One line that might help:
at Unknown.de_systemagmbh_dfs_client_factory_AbstractClientFactory 
$1_fireEvent__Lcom_google_gwt_event_shared_GwtEvent_2V(Unknown Source) 

An inner class in your AbstractClientFactory has a fireEvent, that might be the source of the error.

Maybe you could share some light as to why you have a custom PlaceController, PlaceHistoryHandler and Historian? (and is that inner class a custom EventBus?)

Sven

unread,
Jun 21, 2011, 2:02:37 AM6/21/11
to google-we...@googlegroups.com
We just made a custom PlaceController and Historian to share some log messages. Most of the google methods are private so that we can't just override them implementing our log messages.

You mentioned GWT.setUncaughtExceptionHandler and i already placed it in my code. But it may be the wrong place. Where do i have to place it to catch all the exceptions mentioned?


But maybe our placecontroller puts some magic in there:

public DfsPlaceController(EventBus eventBus) {
        super(eventBus);
    }

    public DfsPlaceController(EventBus eventBus, Delegate delegate) {
        super(eventBus, delegate);
    }

    protected BreadcrumbBar createBreadcrumbBar() {
        BreadcrumbBar breadcrumbBar = new BreadcrumbBar();
        return breadcrumbBar;
    }

    @Override
    public void goTo(Place newPlace) {
        LOG.debug("goTo: " + newPlace);
        super.goTo(newPlace);
        updateBreadcrumbBar(newPlace);
    }

    public void updateBreadcrumbBar() {
        updateBreadcrumbBar(getWhere());
    }

    protected void updateBreadcrumbBar(Place place) {
        try {

            RootPanel breadcrumbRootPanel = RootPanel.get("breadcrumb");
            if (breadcrumbRootPanel.getWidgetCount() == 0) {
                LOG.debug("#updateBreadcrumbBar: No breadcrumb rootpanel available.");
                return;
            }

            Widget widget = breadcrumbRootPanel.getWidget(0);
            if (!(widget instanceof BreadcrumbBar)) {
                LOG.debug("#updateBreadcrumbBar: The first widget is not the breadcrumb bar.");
                return;
            }

            BreadcrumbBar breadcrumbBar = (BreadcrumbBar) widget;
            BreadcrumbItem[] items = BreadcrumbBar.NO_BREADCRUMB_ITEMS;
            if (place instanceof AbstractPlace) {
                AbstractPlace abstractPlace = (AbstractPlace) place;
                items = abstractPlace.getBreadcrumbItems();
            }
            breadcrumbBar.setBreadcrumbItems(items);

        } catch (Exception ex) {
            LOG.error("Unable to update breadcrumb bar.", ex);
        }
    }


Sven

unread,
Jun 21, 2011, 2:40:29 AM6/21/11
to google-we...@googlegroups.com
UPDATE:

after try catching in my AbstractClientFactory i found something:

protected EventBus createEventBus() {
        return new SimpleEventBus() {
           
            @Override
            public void fireEvent(Event<?> event) {
                try {
                LOG.debug("#fireEvent(Event<?> event): " + event != null ? event.toDebugString() : "null");
               
                super.fireEvent(event);
                }catch(Exception e){
                    LOG.error("fire event failed: " + e.getCause().getMessage());
                }
            }
           
            @Override
            public void fireEvent(GwtEvent<?> event) {
                try {
                LOG.debug("#fireEvent(GwtEvent<?> event)" + event != null ? event.toDebugString() : "null");
                super.fireEvent(event);
                }catch(Exception e){
                    LOG.error("fire gwtevent failed: " + e.getCause().getMessage());
                }
            }
        };
    }

like you said the inner class (in this case the new SimpleEventBus) is the problem. fireEvent(Event<?> event) runs in my catch method. Problem is that the exception just says that i should check the umbrella exception for the cause. I don't know how to get this one? Or is this the point where i should place my GWT.setUncaughtExceptionHandler?

Thomas Broyer

unread,
Jun 21, 2011, 5:08:39 AM6/21/11
to google-we...@googlegroups.com
try {
  super.fireEvent(event);
} catch (UmbrellaException ue) {
  for (Throwable t : ue.getCauses()) {
    // here, use your code that prints the stack-trace; and if it's not enough, loop over the getCause() hierarchy
  }
}

An UncaughtExceptionHandler is a "global catch": basically, your GWT code is run in a big try/catch, so any exception you don't catch will go to your UncaughtExceptionHandler (if you set one; or they'll generate "JavaScript errors" in your browser console)

Sven

unread,
Jun 21, 2011, 5:11:37 AM6/21/11
to google-we...@googlegroups.com
I solved it.... You won't believe it... My View is currently using a third party calendar which needs to be implemented via native js. Deep in my UmbrellaExceptions I found something like $wnd.Calendar is null or wrong type. However this was firing an event which got recognized by GWT an encapsulated in about 10 UmbrellaExceptions... I also didn't find it because I casted to UmbrellaException from gwt shared package but it was from bindery package shared ;)

Crazy stuff but thx for your help Thomas.

Sven

unread,
Jun 21, 2011, 5:14:45 AM6/21/11
to google-we...@googlegroups.com
This showed me the root of the problem ;)

import com.google.web.bindery.event.shared.UmbrellaException;
...

...
private void checkAndPrintException(Throwable ex) {
        if(ex instanceof UmbrellaException){
            LOG.debug("UMBRELLA EXCEPTION FOUND");
            UmbrellaException umbEx = (UmbrellaException)ex;
            for(Throwable t: umbEx.getCauses()){
                if(t != null){
                    checkAndPrintException(t);
                    LOG.debug("Throwable caught: " + t.getMessage());
                }
            }
        }
    }
Reply all
Reply to author
Forward
0 new messages