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!

Cannot login to tomcat server. web.xml doesn't work.

843840Jul 13 2010 — edited Jul 15 2010
Hello Everyone!

(1) Guys, I'm studying Servlets/JSP using famous HeadFirst book and now in the chapter about Authentication. The problem is that I cannot login to my web app when I am trying to do this via FORM authentication method. I CAN login when I am using BASIC method. What should I do? I am working via Netbeans, my tomcat 6.0.20 was supplied with it.

Login page is ok:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
        <form method="POST" action="j_security_check">
            <input type="text" name="j_username">
            <input type="password" name=”j_password">
            <input type="submit" value="Enter">
        </form>
    </body>
</html>{code} 

tomcat-users.xml also:
{code}<tomcat-users>
<role rolename="Admin"/>
<role rolename="Member"/>
<role rolename="Guest"/>
<user username="Annie" password="admin" roles="Admin, Member, Guest" />
<user username="Diane" password="coder" roles="Member, Guest" />
<user username="Ted" password="newbie" roles="Guest" />
</tomcat-users>{code}

(2) Probably the problem is in Netbeans. 
Thats why also I am trying to use the second way: deploying my application manually. I have started the server without Netbeans, and copied my build folder from my documents to webapps. Now I can open every html form in my application, but it looks like tomcat is not using my web.xml file. It is set properly: in the webapps/myapp/WEB-INF. What should I do after coping my build files to server webapp folder to deploy my application manually? At the moment my web.xml is out of the game.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 12 2010
Added on Jul 13 2010
5 comments
219 views