gwt javascript load error with multiple vaadin portlets on liferay page

We’re developing a series of Vaadin 6.8.6 portlets that all reside in a liferay 6.0.6 portal page. When there is just a single portlet on the page, there are no problems, but as soon as there is more than one vaadin portlet, periodically there are javascript errors preventing the portlets from loading up. Performing a page refresh (press “F5”) a few times is enough to clear the error.

The ROOT web app has the vaadin jar, all the addon jars, the extracted widgetset, and themes. Our web app (containing all our portlets) contains a copy of all those jars. We’ve tried to remove all the jars from our war and use the ones in the ROOT web app, via specifying them in the liferay specific configuration file, but that had no effect, despite all the jars being available in the ROOT web app and being of identical version.

The more vaadin portlets on the page, the more frequent the error occurs on page load, so our thinking is that it is because the gwt code is loaded multiple times and is still loading when the portlets try to use it.

This error has been testing in Firefox, Chrome, and IE8. It occurs in all browsers, but the error might be listed at a different line. Typically though the error is a “object not found exception”.

Any thoughts would be welcome, this has been occurring for ages now and it’s become a major concern.

This is a bug in vaadin to support GWT SuperDevMode that was committed for
Ticket 8924
… I have filled a ticket (
) but nobody seem to have looked at it yet. It would be nice to have someone from vaadin comment on this.

You can work around this issue by “reverting” the changes that were made in 8924. For this, you will need to extend ApplicationPortlet2, modify you web.xml file to use your newly created class instead and finally, overwrite the “writeAjaxPageScriptWidgetset” method with this one:

	public void  writeAjaxPageScriptWidgetset(RenderRequest request, RenderResponse response, final BufferedWriter writer) throws IOException 
		//IMPORTANT Do not call super implementation!
		String requestWidgetset = getApplicationOrSystemProperty(PARAMETER_WIDGETSET, null);
		String sharedWidgetset = getPortalProperty(PORTAL_PARAMETER_VAADIN_WIDGETSET, request.getPortalContext());

		String widgetset;
		if (requestWidgetset != null) 
			widgetset = requestWidgetset;
		else if (sharedWidgetset != null) 
			widgetset = sharedWidgetset;
			widgetset = DEFAULT_WIDGETSET;
		String widgetsetURL = getWidgetsetURL(widgetset, request);
		writer.write("document.write('<iframe tabIndex=\"-1\" id=\"__gwt_historyFrame\" "
				+ "style=\"position:absolute;width:0;height:0;border:0;overflow:"
				+ "hidden;opacity:0;top:-100px;left:-100px;\" src=\"javascript:false\"></iframe>');\n");
		writer.write("document.write(\"<script language='javascript' src='"
				+ widgetsetURL + "'><\\/script>\");\n}\n");

Basically, this is just the code as it was before the fix in 8924.

Hope it helps!