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!

HTTP Status 404 - j_secuirty_check

843840Oct 31 2007 — edited Oct 31 2007
Hi, Everyone

I am new in this forum. I am trying to use j_security_check to authenticate my login page, but I have got a 404 error. Can you help me please? Please see the details belows,

I am using tom-cat 5.5.17 and JDK5.0. IDE: Netbeans 5.5

My default page is index.jsp page, which just simple do following action,

<form method="POST" action="Display.do">
<input name="name" type=text/>
<input type=submit />
</form>

I have marked any *.do url to require authentication(plz see web.xml), so once i click the submit button on the index.jsp page, it went to the login page as expected. However, after I put my login details for role "ide", which is a manager role. The browser goes to following URL http://localhost:8084/MyWebApplication1/j_secuirty_check and displays a 404 error as the j_security_check page is not found.


tomcat-users.xml
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager"/>
<role rolename="admin"/>
<user username="ide" password="ksh1981" roles="manager,admin"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="role1" password="tomcat" roles="role1"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
</tomcat-users>

web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app 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">
<context-param>
<param-name>sex</param-name>
<param-value>male</param-value>
</context-param>
<servlet>
<servlet-name>Display</servlet-name>
<servlet-class>com.servlets.Display</servlet-class>
<security-role-ref>
<role-name>member</role-name>
<role-link>manager</role-link>
</security-role-ref>
</servlet>
<servlet-mapping>
<servlet-name>Display</servlet-name>
<url-pattern>/Display.do</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>
index.jsp
</welcome-file>
</welcome-file-list>
<security-constraint>
<web-resource-collection>
<web-resource-name>details</web-resource-name>
<url-pattern>*.do</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>member</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/loginPage.jsp </form-login-page>
<form-error-page>/errorPage.jsp</form-error-page>
</form-login-config>
</login-config>
<security-role>
<role-name>manager</role-name>
</security-role>
<security-role>
<role-name>tomcat</role-name>
</security-role>
<security-role>
<role-name>role1</role-name>
</security-role>
<security-role>
<role-name>admin</role-name>
</security-role>
</web-app>


LoginPage.jsp
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>

<h1>Login Page</h1>
<form method="POST" action="j_secuirty_check">
User Name
<input type=text name="j_username" /><br>
Password
<input type=password name="j_password" /><br>
<input type=submit value="ENTER" />
</form>

</body>
</html>


Plz help me!!! Thank you very much....

Edited by: ksh29 on Oct 31, 2007 6:54 PM

Edited by: ksh29 on Oct 31, 2007 6:56 PM

Edited by: ksh29 on Oct 31, 2007 6:57 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 28 2007
Added on Oct 31 2007
1 comment
315 views