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:
…
contextClass
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
…
org.springframework.web.context.ContextLoaderListener
Vaadin Application Servlet
com.vaadin.server.VaadinServlet
Vaadin UI to display
UI
com.lone.ui.LoneUI
Application widgetset
widgetset
com.lone.ui.AppWidgetSet
Vaadin Application Servlet
/*
So i have browsed and tried with some of the scenarios:
Scenario 1)
First i have configured
java.lang.Throwable /error
(or)
java.lang.Exception
/error
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.