Is it possible to remove the tomcat ROOT directory? We have several applications running on a tomcat instance. I was asked to clean the webapps directory up and remove any unused folders. I removed manager host-manager docs examples Everything is fine, as I expected. I looked at the ROOT folder an there are images, a couple of jsp pages and a WEB-INF directory. None of these are used by our applications, so I removed the ROOT directory. Now the server hangs on startup and my applications don't start. Can the ROOT directory be removed? It appears that according to the Apache docs it is optional:

"The ROOT web application presents a very low security risk but it does include the version of Tomcat that is being used. The ROOT web application should normally be removed from a publicly accessible Tomcat instance, not for security reasons, but so that a more appropriate default page is shown to users."

I tried leaving just an empty ROOT directory, but it still hangs. Is there a configuration that I'm missing somewhere that could be looking for the ROOT directory?

Tomcat version 8.5.15


Many Tomcat components assume that an org.apache.catalina.Context is available for each request. If you delete the ROOT application, this won't be true for all URI paths and NullPointerExceptions will follow. This certainly happens with the RewriteValve, but may apply to other components.

Therefore it is better to have a ROOT application, but it can also be an empty directory.

Whether this behaviour of Tomcat components is a bug or not is susceptible to discussion. Personally I consider a missing ROOT context as a misconfiguration, but you can file a bug report if you think otherwise.

  • Thank you, Piotr, very helpful information – dcNaswa Apr 15 '20 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.