[tomcat] Server http:/localhost:8080 requires a user name and a password. The server says: XDB

I am trying to access localhost:8080 but it is showing me I need to enter user name and pass word. I remember messing up with the server some 4 months ago while I was trying to develop a web application and hosting my domain name on my pc, Unfortunately I become unsuccessful. While working with servlets I was tring some security features and till some time i did not see and of these pop up windows asking for authentication.

I tried to enter the password that I was playing with but non of those are working. Is there anyway i could get out of this problem? enter image description here

This question is related to tomcat server localhost

The answer is


even i faced the same problem. The possibility of this could be usage of same port by two or more application/process. In Some cases you can use different port number which will avoid this problem, but in other case you have to manually kill the process with help of command prompt.

The command to kill is, In your command prompt first enter this command

C:\Users\A611003>tasklist

After this you can able to see list of process running with process ID. For example, enter image description here

From this select the process you want to stop, for example consider the process id 304 is your server and you have problem with that. Then enter this command.

C:\Users\A611003>Taskkill /PID 304 /F

This will kill that process now you can clean, publish your server and start it.

Note: If you fail to add /F in the above command it does nothing. It is the force kill. you can also try/? for list of available options.


I'll assume that uninstall and reinstall Tomcat is not acceptable to you. The screen shot show basic auth challenge screen from browser and on the default app. So most likely you have set up users on the tomcat using the conf/tomcat-users.xml Try going through this guide https://tomcat.apache.org/tomcat-7.0-doc/realm-howto.html#UserDatabaseRealm

There are several other realms that you could have possibly used. Hopefully you will remember when you start reading the doc


You can uninstall WAMP/XAMPP and install it again with default port number. It will work properly.


give username as admin

and leave the password empty


I was facing the same problem, I just change the jboss7.1 port from 8080 to 9090. and it worked perfectly for me. To change the jboss7.1 port go to jboss-as-7.1.0.Final\standalone\configuration open standalone.xml look for the line <socket-binding name="http" port="8080"/> change 8080 to 9090. save the file and Restart the server. it should work


Just change the port number used e.g. 8000 then call the http://localhost:8080


you can find the username and password details in your {tomcat installation directory}/conf/tomcat-users.xml


Open the file :

WEB-INF -> web.xml

In my case, it looks like as following. :

<security-constraint>
    <web-resource-collection>
        <web-resource-name>Integration Web Services</web-resource-name>
        <description>Integration Web Services accessible by authorized users</description>
        <url-pattern>/services/*</url-pattern>
        <http-method>GET</http-method>
        <http-method>POST</http-method>
    </web-resource-collection>
    <auth-constraint>
        <description>Roles that have access to Integration Web Services</description>
        <role-name>maximouser</role-name>
    </auth-constraint>
    <user-data-constraint>
        <description>Data Transmission Guarantee</description>
        <transport-guarantee>NONE</transport-guarantee>
    </user-data-constraint>
</security-constraint>

Remove or comment these lines.


This is caused because there is a database running on your computer. In my case, it was an Oracle data base. By default, everytime you start your computer, the services of the database automatically starts.

Go to Start >> find Oracle or whatever data-base in the list of programms >> and manually stop the database. It appears that there is a conflict of port.


Add username and password in application propreties files.

When adding spring security every http query must be authentified by login and password.

See Screenshot


Just change your default port 8080 to something else like below example

SQL> begin
 2   dbms_xdb.sethttpport('9090');
 3   end;
 4  /

Some other application(like oracle) is using the same port number. So you should change the tomcat port number in apachetomcat/conf/server.xml

Privious--->

<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

Updated ---->

<Connector port="8088" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

I just killed the Oracle processes and re-initiate JBoss. All was fine :)


Examples related to tomcat

Jersey stopped working with InjectionManagerFactory not found The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. on deploying to tomcat Spring boot: Unable to start embedded Tomcat servlet container Tomcat 404 error: The origin server did not find a current representation for the target resource or is not willing to disclose that one exists Spring Boot application in eclipse, the Tomcat connector configured to listen on port XXXX failed to start Kill tomcat service running on any port, Windows Tomcat 8 is not able to handle get request with '|' in query parameters? 8080 port already taken issue when trying to redeploy project from Spring Tool Suite IDE 403 Access Denied on Tomcat 8 Manager App without prompting for user/password Difference between Xms and Xmx and XX:MaxPermSize

Examples related to server

npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Nuwanst\package.json' Golang read request body currently unable to handle this request HTTP ERROR 500 How do I solve the "server DNS address could not be found" error on Windows 10? Server http:/localhost:8080 requires a user name and a password. The server says: XDB What does "app.run(host='0.0.0.0') " mean in Flask How to configure port for a Spring Boot application Apache2: 'AH01630: client denied by server configuration' Apache is not running from XAMPP Control Panel ( Error: Apache shutdown unexpectedly. This may be due to a blocked port) Express.js - app.listen vs server.listen

Examples related to localhost

Xampp localhost/dashboard Set cookies for cross origin requests Invalid Host Header when ngrok tries to connect to React dev server How to turn on/off MySQL strict mode in localhost (xampp)? What is IPV6 for localhost and 0.0.0.0? How do I kill the process currently using a port on localhost in Windows? How to run html file on localhost? Can't access 127.0.0.1 Server http:/localhost:8080 requires a user name and a password. The server says: XDB How to solve ERR_CONNECTION_REFUSED when trying to connect to localhost running IISExpress - Error 502 (Cannot debug from Visual Studio)?