Monday, August 31, 2009

IllegalStateException: SimplePanel can only contain one child widget

I have been struggling (wasted time) for about a week trying to figure out why my GWT admin application is giving an IllegalStateException. The full error is :
Error: uncaught exception: java.lang.IllegalStateException: SimplePanel can only contain one child widget

The application runs on Google App Engine with Struts 2 and GWT - "Namibia my African Destination".

After doing some research and determining (incorrectly) that the problem was my DecoratorPanel and that I should use the method setWidget and not the add method, I realized that the error was actually not from the DecoratorPanel, but from the FormPanel that I have as a child of the DecoratorPanel.

Both FormPanel and DecoratorPanel comes from the Base class SimplePanel and can only have one child.

Yay, it finally works.

I probably would have known exactly where the problem was, if I was running it in hosted mode.