Multi-Window: No UIProvider returned a UI for the request

I’ve been experiencing weird problems when working with multiple browser windows in 7Beta11, I’ve attempted to create an uber-simplified minamalist application to test whether the same problem re-occurs, and it seems to.
Intermittantly after opening several tabs and/or browser windows within the same user session (way before the session timeout) and clicking on a navigation button I receive a ‘No UIProvider returned a UI for the request’ stack trace, and an ‘Internal Error’ notification within the browser.

Here’s an example that seems to reproduce it (albeit still intermittantly).


@Theme("runo")
public class HelloWorldUI extends UI {

  private static int number = 1;

  @Override
  protected void init(VaadinRequest request) {
    VaadinSession.getCurrent().setAttribute("someInt", number++);

    Navigator navigator = new Navigator(this, this);
    navigator.addView(View1.NAME, View1.class);
    navigator.addView(View2.NAME, View2.class);
    setNavigator(navigator);
  }
}

public class View1 extends Panel implements View {

  public static final String NAME = "";

  @Override
  public void enter(ViewChangeListener.ViewChangeEvent event) {
    final Label someIntLabel = new Label(
          "View 1, UI Count: " + VaadinSession.getCurrent().getAttribute("someInt"));
    final Button button = new Button("Go to View 2");
    button.addClickListener(new Button.ClickListener() {
      @Override
      public void buttonClick(Button.ClickEvent event) {
        UI.getCurrent().getNavigator().navigateTo(View2.NAME);
      }
    });
    setContent(new VerticalLayout(someIntLabel, button));
  }
}

public class View2 extends Panel implements View {

  public static final String NAME = "view2";

  @Override
  public void enter(ViewChangeListener.ViewChangeEvent event) {
    final Label someIntLabel = new Label(
          "View 2, UI Count: " + VaadinSession.getCurrent().getAttribute("someInt"));
    final Button button = new Button("Go to View 1");
    button.addClickListener(new Button.ClickListener() {
      @Override
      public void buttonClick(Button.ClickEvent event) {
        UI.getCurrent().getNavigator().navigateTo(View1.NAME);
      }
    });
    setContent(new VerticalLayout(someIntLabel, button));
  }
}

Any ideas guys?

Hey, could you post the stacktrace you’re getting? Every time you open a new browser tab with same URL the UI provider should instantiate new instance of the UI. This is, every time you open new browser tab you should get new UI instance. Now, the navigator is UI instance specific in this case. Each UI instance will have it’s own Navigator instance. The view is registered to navigator using ViewProvider which in your use case will instantiate for every added view new ViewProvider instance which is able to instantiate the view from given view class you’re using as parameter.

What is possible in some situations is that different UI’s with different navigator instances might share same View instances. I don’t see that being the case in your situation but the stacktrace might tell more.

In either case, message about UIProvider not being able to provide default UI in this case seems odd.


javax.servlet.ServletException: No UIProvider returned a UI for the request.
	at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:312)
	at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:201)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:931)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1822)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:722)

However, I’ve just figured out what was going on… One of my windows had the ?restartApplication flag set obviously resetting the application state, hardly surprising.

Thanks for your assistance, sorry for wasting your time.