Starting of Tomcat failed, the server port 8080 is already in use.

The Problem

So you've followed all the instructions on installing Tomcat and you're almost ready to create your first JSP web app. Unfortunately, you can't seem to access the web interface for Tomcat even though it's started and Netbeans throws this error:

Starting of Tomcat failed, the server port 8080 is already in use.
See the server log for details.

The truth is, it may not be anything to do with the port number assigned to Tomcat!

The Solution

  1. Open up the most recent log file for Tomcat by using an editor of your choice. Eg:

    cd /var/lib/tomcat6/conf/
    nano catalina.2010-08-26.log
  2. Scroll to the bottom of the log file and it should tell you what went wrong last time. It's a bit naughty that Tomcat says everything started up OK when there's actually an issue.

    Check for this error:

    SEVERE: Exception processing Global JNDI Resources
    javax.naming.NamingException: The value of attribute "rolename" associated with an element type "null" must not contain the '<' character.

    What this means is it didn't quite find the rolename it was expecting. What would cause an error like this would be something like a missing speech mark (in my case at least)

  3. If you have that error, it's a very simple fix! Simply open up the Tomcat users file and check that you've closed all your speech marks. That is what fixed it for me. Eg:

    sudo nano /var/lib/tomcat6/conf/tomcat-users.xml

  4. Now double-check the rolenames and make sure there's no missing speech marks or silly character. It should look like this:

    <role rolename="admin" />
    <role rolename="manager" />
    <user username="admin" password="secret" roles="admin,manager" />
  5. Don't forget to restart Tomcat after making any changes to the configuration file. Eg:
    sudo /etc/init.d/tomcat6 restart


Add new comment