Customize error page to connect timed out in Spring

2

I'm trying to create a friendly error page in case LDAP is off the air, but unfortunately the only answer I get is j_spring_security_check .

I tried to map the exception in web.xml , but I was not successful.

<error-page>
    <exception-type>java.net.SocketTimeoutException</exception-type >
    <location>/408</location>
</error-page>

<error-page>
    <exception-type>java.net.SocketTimeoutException</exception-type >
    <location>/408</location>
</error-page>

Console error:

GRAVE: Servlet.service() for servlet [mvc-dispatcher] in context with path [/gpa-pesquisa] threw exception org.springframework.ldap.CommunicationException: 171.18.0.15:389; nested exception is javax.naming.CommunicationException: 171.18.0.15:389 [Root exception is java.net.SocketTimeoutException: connect timed out]
    at org.springframework.ldap.support.LdapUtils.convertLdapException(LdapUtils.java:108)
    at org.springframework.ldap.core.support.AbstractContextSource.createContext(AbstractContextSource.java:356)
    at org.springframework.ldap.core.support.AbstractContextSource.doGetContext(AbstractContextSource.java:140)
    at org.springframework.ldap.core.support.AbstractContextSource.getReadOnlyContext(AbstractContextSource.java:159)
    at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:357)
    at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:309)
    at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:616)
    at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:586)
    at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:1651)
    at br.ufc.quixada.npi.ldap.dao.LdapUsuarioDao.getByCpf(LdapUsuarioDao.java:76)
    
asked by anonymous 03.11.2015 / 15:18

1 answer

0

Friend, I did the following to create the customizable error pages. I use Apache Tiles to manage my views.

web.xml

<error-page>
    <error-code>500</error-code>
    <location>/500</location>
</error-page>
<error-page>
    <error-code>404</error-code>
    <location>/404</location>
</error-page>

IndexController.java

@RequestMapping(value = "/404")
public String pageNotFound(Model model) {
    return "base.admin.error.404";
}

@RequestMapping(value = "/500")
public String internalServerError(Model model) {
    return "base.admin.error.500";
}
    
04.11.2015 / 15:09