Tomcat: “localhost:8080” Error 401: Unauthorized

To sum up the unauthorized: 401 error encountered for the first time, in fact, a very simple error:

When running tomcat, when I enter localhost: 8080, a prompt box pops up:

requires a user name and password to log in, that is, I do not have access rights. When clicking cancel:

error 401: unauthorized

analysis

Any client (such as your browser) needs to pass the following cycle: obtain an IP address from the IP name of the site (i.e. your site URL, without the initial ‘http://’). This correspondence (i.e. the correspondence from IP name to IP address translation) is provided by domain name servers (dnss).

Open an IP socket to connect to the IP address. Write HTTP data stream through this socket. The HTTP data stream that receives the response from the web server. The data stream includes a status code whose value depends on the HTTP protocol. Parse the data stream to get state code and other useful information.

The error is generated in the last step described above, that is, when the client receives the HTTP status code and identifies it as 401. After the browser receives the 401 error message, it explains it and provides a dialog box for entering user name/password. Send to the server after completion. After the server verifies, it sends the requested resources to the browser when the verification passes, otherwise it may send 401 error messages.

Solution:

My error at that time was that the port number was occupied: so release the port or redefine the new port number
extension
HTTP 400 – the request is invalid;

Http 401.1 – unauthorized: login failed;

Http 401.2 – unauthorized: login failed due to server configuration problems;

Http 401.3 – ACL prohibits access to resources;

Http 401.4 – unauthorized: authorization is rejected by the filter;

Http 401.5 – unauthorized: ISAPI or CGI authorization failed


Read More: