Spring Security lgoin always redirecting to authentication failure URL
<p>I am rather new to programming so please help me out a bit here.</p>

<p>I have configured <code>Spring Security</code> to fetch user details from the database and when I try to login with the following accounts:</p>

<ul>
<li>user1 - password1 </li>
<li>admin - password1 </li>
</ul>

<p>The authentication fails as it always redirect me to <code>home.jsp/OPS=999</code> which is my login page. The user record exists in the database but I cannot seem to log in.  </p>

<p>This is my security config xml file.  </p>

<pre><code> &lt;http auto-config="true"&gt;
     &lt;form-login login-page='/home.jsp?OPS=9999' default-target-url='/secure/user.jsp' always-use-default-target='true' /&gt;
     &lt;logout logout-success-url="/home.jsp" logout-url="/j_spring_security_logout" /&gt;
 &lt;/http&gt;

&lt;authentication-provider&gt;
    &lt;jdbc-user-service data-source-ref="Application.DataSource2" users-by-username-query="select USERNAME, PASSWORD from USER where lower(USERNAME) = lower(?)"/&gt;
&lt;/authentication-provider&gt;
</code></pre>

<p>I am doing it without the authentication/authorities for now as the login is not working. What could be some of the possible reasons for the authentication failure? could database connection play a part? please help me out.</p>

<p>Thank you in advance!</p>