Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

j_security_check 404 error Please please help me

843838Aug 2 2005 — edited Aug 5 2005
I am new to this forum although I have been lurking around for while:)

I have a question about j_security_check.

I am working in Apache Tomcat server and I want to set up form based authentication. So I used j_security_check and I get an error 404 j_security_check page not found.

I am not sure how this is supposed to work.
1. Am I supposed to load the secured pages before I login and j_security_check should send me to the login.jsp page?
Or should I start with teh login.jsp page and if my login is incorrect, then I cannot load any page? (until I login correctly)

I always get 404 j_sedurity_check not found when I try to click submit button in login.jsp page and when I try to open other pages (even without login) I am able to open.

Can you please help me?

Should I register j_security_check in web.xml, if yes, please tell me how and give me a sample, please........


Here's my code:

web.xml

<security-constraint>
<display-name>SecurityConstraint</display-name>
<web-resource-collection>
<web-resource-name>STK</web-resource-name>
<url-pattern>/*.jsp</url-pattern>
<http-method>DELETE</http-method>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>customer</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>file</realm-name>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/logi</form-login-config>
</login-config>

I am in the list of user in tocat-users.xml

My login.jsp
<form action="Servlet.j_security_check" method="POST">

<center>
<table cellpadding=4 cellspacing=2 border=0>

<th bgcolor="#CCCCFF" colspan=2>
<font size=5>Business Owner Login</font>
<br>
<font size=1><sup>*</sup> Required Fields</font>
</th>

<tr bgcolor="Aqua">
<td valign=top>
<b>User ID<sup>*</sup></b>
<br>
<td valign=top>
<input type="text" name="j_username"></td>
<td valign=top>
<b>Password<sup>*</sup></b>
<br>
<td valign=top>
<input type="password" name="j_password" value="" size=15 maxlength=20></td>
<td valign=top>
</tr>

<tr bgcolor="#c8d8f8">
<td align=center colspan=2>
<input type="submit" value="Log In">
</td>
</tr>

</TABLE>

</BODY>
</HTML>
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 2 2005
Added on Aug 2 2005
8 comments
2,241 views