Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Vaadin+Java+Tomcat Server how to display an Error page when we get an Excep
Requirement:
I want to show an error page when ever we get any exception(i.e.,NullPointer,IndexOutofBoundsException etc) in Server Console.
System Requirement:
We are using apache tomcat 7.0.61,maven 3.2.3,Spring and Vaadin 7 (For UI Framework).
Ours WEB.XML file:
<context-param>
..............
</context-param>
<context-param>
<param-name>contextClass</param-name>
<param-value> org.springframework.web.context.support.AnnotationConfigWebApplicationContext </param-value> </context-param>
.....
<listener>
<listener-class> org.springframework.web.context.ContextLoaderListener </listener-class>
</listener>
<servlet>
<servlet-name>Vaadin Application Servlet</servlet-name>
<servlet-class>com.vaadin.server.VaadinServlet</servlet-class>
<init-param> <description>Vaadin UI to display</description>
<param-name>UI</param-name>
<param-value>com.lone.ui.LoneUI</param-value>
</init-param>
<init-param>
<description>Application widgetset</description>
<param-name>widgetset</param-name>
<param-value>com.lone.ui.AppWidgetSet</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Vaadin Application Servlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
So i have browsed and tried with some of the scenarios:
Scenario 1)
First i have configured
<error-page> <exception-type>java.lang.Throwable</exception-type> <location>/error</location> </error-page>
(or)
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/error</location>
</error-page>
in web.xml file and then i have written the Controller class by using the @RequestMapping("/error") in the method level but this scenario not worked.
Scenario 2)
Same with the above web.xml file i have written the Servlet class as
@WebServlet(value = {"/error"},asyncSupported = true)
public class ExceptionHandling extends VaadinServlet{ @Override protected VaadinServletService getService() { System.out.println("First if i display the sout message then i can Navigate to the Error Page...."); return super.getService(); } }
But this is also not working.
Scenario 3)
Same with the above web.xml file i have written the Servlet class by extending the HTTPServlet but still unable to display the sout message.
Scenario 4)
I have tried with Spring @ControllerAdvice and @Exception handler Annotation still i am unable to display the Error Page
Could you please suggest me to complete the requirement because i have been working on this requirement from past 2 days.
Thanks in advance.