Q:

Form Based Authentication - Redirect to error page after successful authentication (Tomcat 7.0.4)

I'm trying out form-based authentication, but I couldn't figure out why, after entering the correct user/password on the login page, it would redirect me to the error page instead of index.jsp.
When I type:
http://localhost:8080/<context>/secure/index.jsp

I get the login page. However, when I type user/password (manager/manager), it brings me to the error.html instead of index.jsp.    
WEB.XML:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>FormBasedAuthentication</display-name>
<login-config>
    <auth-method>FORM</auth-method>
    <form-login-config>
        <form-login-page>/login.html</form-login-page>
        <form-error-page>/error.html</form-error-page>
    </form-login-config>
</login-config>
<security-role>
    <role-name>role1</role-name>
</security-role>    
<security-constraint>
    <web-resource-collection>
        <web-resource-name>SecurePages</web-resource-name>
        <description>Security constraint for JSP resources</description>
        <url-pattern>/secure/*</url-pattern>
        <http-method>POST</http-method>
        <http-method>GET</http-method>
    </web-resource-collection>
    <auth-constraint>
        <role-name>role1</role-name>
    </auth-constraint>
    <user-data-constraint>
        <transport-guarantee>NONE</transport-guarantee>
    </user-data-constraint>
</security-constraint>

TOMCAT-USER.XML:
<tomcat-users>
   <role rolename="manager-gui"/>
   <role rolename="manager-script"/>
   <role rolename="manager-status"/>
   <role rolename="manager-jmx"/>
   <role rolename="role1"/>
   <user username="manager" password="manager" roles="role1"/>
</tomcat-users>

A:

Some error is occurring between the successful authentication and a request to the /secure/*. For example, it might be that a filter is not configured for the particular HTTP method or a servlet throws an exception which can be confused with the auth failure in this case. If I were you I would replace error.html with a temporary servlet (or a jsp: error.jsp) to scrutinize the request for details regarding the failure cause. 
These request attributes should be examined:
Integer statusCode = (Integer) request.getAttribute("javax.servlet.error.status_code");
String exceptionType = (String) request.getAttribute("javax.servlet.error.exception_type");
String errorMsg = (String) request.getAttribute("javax.servlet.error.message");

A:

The server location in the Tomcat configuration should have been 'Use Tomcat Installation' instead of 'Use workspace metadata'.

