Communication errors and alert box in Vaadin

3.4k Views Asked by At

My web application is using Vaadin 6.8.8 version with vaadin-xs addon and it's deployed on a glassfish server.

My application randomly (well, I think it's randomly) gets communication problem and/or session expired messages. Nothing is shown in the log. Sometimes I can see an Invalid security key received from localhost error log, but I'm not sure if it's related to the same issue.

I see these problems in Firefox and Chrome (I didn't try it in IE or Opera). In Chrome browser appears infrequently but in Firefox appears frequently.

I overrided the getSystemMessages method:

public static SystemMessages getSystemMessages() {
    CustomizedSystemMessages m = new CustomizedSystemMessages();

    m.setCommunicationErrorCaption(null);
    m.setCommunicationErrorMessage(null);
    m.setCommunicationErrorURL(null);
    m.setSessionExpiredCaption(null);
    m.setSessionExpiredMessage(null);
    m.setSessionExpiredURL(null);

    return m;
}

Now, I don't see any communication problem or session expired messages, instead I get a JavaScript standard alert box with Server Error message, then the page is reloaded. This alert box only appears in Firefox browser, in Chrome broswer the alert box doesn't appear.

Can someone give me any clue? Some workarround to not show the alert box.

Edit:

Sometimes I found this stacktrace in the log file:

Terminal error:
java.lang.ArrayIndexOutOfBoundsException: 1
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1376)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1329)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:761)
at com.vaadin.addons.xs.server.JsonpCommunicationManager.doHandleUidlRequest(JsonpCommunicationManager.java:142)
at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:325)
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:501)
at com.vaadin.addons.xs.server.XSApplicationServlet.service(XSApplicationServlet.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:619)
1

There are 1 best solutions below

2
On

I think you have to look at this one:

https://vaadin.com/de/forum#!/thread/231272

The important part in there is:

Other background thread considerations: Remember to synchronize on the application instance whenever updating the UI from another thread.

In code you do it this way:

synchronized (getApplication()) 
{ 
  // update the UI as required in this synchronized block
  label.setValue("Operation completed");
}