Announcement Announcement Module
Collapse
No announcement yet.
exception handling page Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • exception handling page

    I configured Exeception handling as

    Code:
    <bean id="exceptionResolver" class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
    <property name="exceptionMappings">
    <props>
    <prop key="java.lang.Exception">friendlyError</prop>
    </props>
    </property>
    </bean>
    When exception throwed,It forward to friendlyerror page(refer the log) but that page is not displayed.Why this is?

    Code:
    19:52:28,171 DEBUG DispatcherServlet:1045 - Testing handler map [[email protected]8baf36] in DispatcherServlet with name 'spring'
    19:52:28,171 DEBUG SimpleUrlHandlerMapping:161 - Looking up handler for [/newPerson.htm]
    19:52:28,171 DEBUG DispatcherServlet:1085 - Testing handler adapter [[email protected]9d3c]
    19:52:28,171 DEBUG DispatcherServlet:1085 - Testing handler adapter [org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter@3c9314]
    19:52:28,171 DEBUG DispatcherServlet:961 - Last-Modified value for [/springapps/newPerson.htm] is: -1
    19:52:28,171 DEBUG DispatcherServlet:783 - DispatcherServlet with name 'spring' received request for [/springapps/newPerson.htm]
    19:52:28,187 DEBUG DispatcherServlet:845 - Bound request context to thread: org.apache.catalina.connector.RequestFacade@1ed1dbe
    19:52:28,187 DEBUG DispatcherServlet:1085 - Testing handler adapter [[email protected]9d3c]
    19:52:28,187 DEBUG DispatcherServlet:1085 - Testing handler adapter [org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter@3c9314]
    19:52:28,203 DEBUG PersonController:337 - Displaying new form
    19:52:28,218 DEBUG PersonController:362 - Creating new command of class [com.dom.Person]
    19:52:28,218 DEBUG DispatcherServlet:1172 - Rendering view [org.springframework.web.servlet.view.JstlView: name 'newPerson'; URL [/WEB-INF/jsp/newPerson.jsp]] in DispatcherServlet with name 'spring'
    19:52:28,218 DEBUG JstlView:241 - Rendering view with name 'newPerson' with model {org.springframework.validation.BindingResult.person=org.springframework.validation.BeanPropertyBindingResult: 0 errors, person=com.dom.Person@1ae939f} and static attributes {}
    19:52:28,218 DEBUG JstlView:340 - Added model object 'org.springframework.validation.BindingResult.person' of type [org.springframework.validation.BeanPropertyBindingResult] to request in view with name 'newPerson'
    19:52:28,218 DEBUG JstlView:340 - Added model object 'person' of type [com.dom.Person] to request in view with name 'newPerson'
    19:52:28,218 DEBUG JstlView:238 - Forwarding to resource [/WEB-INF/jsp/newPerson.jsp] in InternalResourceView 'newPerson'
    19:52:28,218 DEBUG DispatcherServlet:939 - Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@1ed1dbe
    19:52:28,218 DEBUG DispatcherServlet:591 - Successfully completed request
    19:52:28,218 DEBUG XmlWebApplicationContext:273 - Publishing event in context [org.springframework.web.context.support.XmlWebApplicationContext@9e5c73]: ServletRequestHandledEvent: url=[/springapps/newPerson.htm]; client=[127.0.0.1]; method=[GET]; servlet=[spring]; session=[F39E03EADA03B9BCF3BAB61CC69833D6]; user=[null]; time=[47ms]; status=[OK]
    19:52:29,640 DEBUG DispatcherServlet:783 - DispatcherServlet with name 'spring' received request for [/springapps/newPerson.htm]
    19:52:29,640 DEBUG DispatcherServlet:845 - Bound request context to thread: org.apache.catalina.connector.RequestFacade@1ed1dbe
    19:52:29,640 DEBUG DispatcherServlet:1045 - Testing handler map [[email protected]8baf36] in DispatcherServlet with name 'spring'
    19:52:29,640 DEBUG SimpleUrlHandlerMapping:161 - Looking up handler for [/newPerson.htm]
    19:52:29,656 DEBUG DispatcherServlet:1085 - Testing handler adapter [[email protected]9d3c]
    19:52:29,656 DEBUG DispatcherServlet:1085 - Testing handler adapter [org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter@3c9314]
    19:52:29,656 DEBUG PersonController:362 - Creating new command of class [com.dom.Person]
    19:52:29,656 DEBUG PersonController:266 - No errors -> processing submit
    19:52:29,656 DEBUG DefaultListableBeanFactory:214 - Returning cached instance of singleton bean 'PersonDAO'
    19:52:29,656 DEBUG SimpleMappingExceptionResolver:251 - Resolving exception from handler [com.controllers.PersonController@93df2c]: java.lang.ClassCastException: $Proxy0 cannot be cast to com.dao.PersonDAO
    19:52:29,687 DEBUG SimpleMappingExceptionResolver:347 - Resolving to view 'friendlyError' for exception of type [java.lang.ClassCastException], based on exception mapping [java.lang.Exception]
    19:52:29,703 DEBUG SimpleMappingExceptionResolver:439 - Exposing Exception as model attribute 'exception'
    19:52:29,703 DEBUG DispatcherServlet:1117 - Handler execution resulted in exception - forwarding to resolved error view: ModelAndView: reference to view with name 'friendlyError'; model is {exception=java.lang.ClassCastException: $Proxy0 cannot be cast to com.dao.PersonDAO}
    java.lang.ClassCastException: $Proxy0 cannot be cast to com.dao.PersonDAO
    	at com.dao.PersonDAO.getFromApplicationContext(PersonDAO.java:145)
    	at com.controllers.PersonController.onSubmit(PersonController.java:27)
    	at org.springframework.web.servlet.mvc.SimpleFormController.processFormSubmission(SimpleFormController.java:267)
    	at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:265)
    	at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
    	at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
    	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
    	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
    	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
    	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    	at java.lang.Thread.run(Unknown Source)
    19:52:29,703 DEBUG DispatcherServlet:1172 - Rendering view [org.springframework.web.servlet.view.JstlView: name 'friendlyError'; URL [/WEB-INF/jsp/friendlyError.jsp]] in DispatcherServlet with name 'spring'
    19:52:29,703 DEBUG JstlView:241 - Rendering view with name 'friendlyError' with model {exception=java.lang.ClassCastException: $Proxy0 cannot be cast to com.dao.PersonDAO} and static attributes {}
    19:52:29,703 DEBUG JstlView:340 - Added model object 'exception' of type [java.lang.ClassCastException] to request in view with name 'friendlyError'
    19:52:29,703 DEBUG JstlView:238 - Forwarding to resource [/WEB-INF/jsp/friendlyError.jsp] in InternalResourceView 'friendlyError'
    19:52:29,703 DEBUG DispatcherServlet:939 - Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@1ed1dbe
    19:52:29,703 DEBUG DispatcherServlet:591 - Successfully completed request
    19:52:29,703 DEBUG XmlWebApplicationContext:273 - Publishing event in context [[email protected]9e5c73]: ServletRequestHandledEvent: url=[/springapps/newPerson.htm]; client=[127.0.0.1]; method=[POST]; servlet=[spring]; session=[F39E03EADA03B9BCF3BAB61CC69833D6]; user=[null]; time=[63ms]; status=[OK]
Working...
X