Custom errorhandling won't work on first load

Hey folks,
for my current project i use vaadin7 (with vaadin-cdi). To show the user nicer errorpages i want to show custom error pages depending on different exceptions that are thrown. One of that exception is the
that gets thrown inside the cdiViewProvider (method: getViewName()) as shown below. Now if i open a view that dont exists it shows me a nice error view and it works fine. BUT if i visit a view that dont exists after a restart of the application server that error handling is not executed and i see the default vaadin exception page.
Any ideas?

getViewName method of my cdiViewProvider class:

public String getViewName(String viewAndParameters) {
String viewName = super.getViewName(viewAndParameters);

try {
    return viewName;
} catch (RuntimeException e) {
    String errorMessage = String.format("View %s can not be found", viewAndParameters);
    throw new NotFoundException(errorMessage);

[/code]In the init method of the UI i register the error handler like this:

Navigator navigator = new Navigator(this, contentLayout); navigator.addProvider(cdiViewProvider); navigator.setErrorView(errorView); UI.getCurrent().setErrorHandler(this); VaadinSession.getCurrent().setErrorHandler(this); The ErrorHandler method:

public void error(com.vaadin.server.ErrorEvent errorEvent) { getNavigator().navigateTo(RoutingConstants.VIEW_ERROR); errorView.getPresenter().showErrorMessage(errorEvent.getThrowable()); } The showErrorMessage from the errorView Presenter:

public void showErrorMessage(Throwable throwable) {
        logger.errorf(throwable, "Error-ID: %s", UUID.randomUUID().toString());

        if (throwable instanceof NotFoundException || throwable.getCause() instanceof NotFoundException) {
            getView().showCommonErrorMessage("views.errorView.notFound.errorHeader", "views.errorView.notFound.errorMessage");
        } else if (throwable instanceof ForbiddenAccessException || throwable.getCause() instanceof ForbiddenAccessException) {
            getView().showForbiddenErrorMessage("error", "error");
        } else {
            getView().showCommonErrorMessage("views.errorView.common.errorHeader", "views.errorView.common.errorMessage");