Announcement Announcement Module
No announcement yet.
Exception Handling Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Exception Handling


    I'm developing a Spring MVC web app following the stack:
    @[email protected]

    I inserted the org.springframework.dao.annotation.PersistenceExce ptionTranslationPostProcessor in my applicationContext.xml

    and in my spring-servlet:
        <bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
            <property name="exceptionMappings">
                    <entry key="DataAccessException" value="dataAccessFailure"/>
    I found out that if in my controller i call directly the DAO the DataAccessException is caught, while if I use the service it does not.
    It can be obvious because it is raised an unchecked exception, but the question is: How to propagate the DataAccessException in order to be caught by the SimpleMappingExceptionResolver?

    Should I have to use a try catch(DataAccessException) block in the service? I tried but it's not caught..

    Another question: where is it useful insert log? In the DAO or in the service?
    What is the best practise?

    Thank you in advance

  • #2
    If i insert

    In my web.xml .. it's showed the /web-inf/jsp/dataaccessfailure.jsp outside my tiles ..

    Should runtimeexception be propagated to the controller passing via Service layer?