This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Unable to access the servlet even on entering username/password set in tomcat-users.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Unable to access the servlet even on entering username/password set in tomcat-users.xml" Watch "Unable to access the servlet even on entering username/password set in tomcat-users.xml" New topic
Author

Unable to access the servlet even on entering username/password set in tomcat-users.xml

Bindu Lakhanpal
Ranch Hand

Joined: Oct 17, 2008
Posts: 163

I have set username in tomcat-users.xml file like:



And in web.xml i have set the various tags like:





But when i try to access the servlet /myServ.do i am asked to enter username and password. But its not accepting any of username and password i set in tomcat-users.xml..(Bindu, bindu) or (admin, ).I mean i am not able to access the servlet.
Why so?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

I mean i am not able to access the servlet.

What error do you have ?


[My Blog]
All roads lead to JavaRanch
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39571
    
  27
You're not by any chance running Tomcat from within an IDE or something like that, are you?


Ping & DNS - updated with new look and Ping home screen widget
Bindu Lakhanpal
Ranch Hand

Joined: Oct 17, 2008
Posts: 163

If i enter Bindu/bindu.. On third time i get this response

the resulting url is:
http://localhost:8080/SimpleTag5/myServ.do?movilis=first&gen=A&movilis=second&gen=B&movilis=third&gen=C

and the output is:

HTTP Status 401 -

--------------------------------------------------------------------------------

type Status report

message

description This request requires HTTP authentication ().


--------------------------------------------------------------------------------

Apache Tomcat/6.0.16



If i enter admin on first time itself i get this :

the resulting url is:

http://localhost:8080/SimpleTag5/myServ.do?movilis=first+&gen=A&movilis=second&gen=B&movilis=third&gen=C


and the output is:

HTTP Status 403 - Access to the requested resource has been denied

--------------------------------------------------------------------------------

type Status report

message Access to the requested resource has been denied

description Access to the specified resource (Access to the requested resource has been denied) has been forbidden.


--------------------------------------------------------------------------------

Apache Tomcat/6.0.16



And i am not running Tomcat from within an IDE.
Bindu Lakhanpal
Ranch Hand

Joined: Oct 17, 2008
Posts: 163

Its working now.
I just stopped and restarted Tomcat again.
I think I did not restart tomcat when i changed tomcat-users.xml .Thats why it was not accepting the username and passwords.
Well,I am happy now!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to access the servlet even on entering username/password set in tomcat-users.xml
 
Similar Threads
Trouble with Authentication
What's wrong with my Authentication
web security not working as expected,
Security Problem
Problem with security constraints while doing authentication & authorization