Recently I upgraded my tomcat server from 6.x version to the most recent 7.x version.

I came up with little trouble, hoping to get help.

I have an application calls MyApp

On tomcat6, when I went to http://www.example.com/MyApp/page/ I normally would get the wanted result.

Now, on tomcat7, visiting the same exact url (with the trailing slash) I'm getting the error: "Resource is not avaliable", as the tomcat thinks that /MyApp/page/ is a whole webapp name instead of being request names page under the MyApp webapp.

I need the slash at the end on my url because otherwise I'm getting the error: "HTTP Status 405 - Request method 'GET' not supported" which is OK because I really did not permit the GET method to the "page" request.

If someone knows how to tell tomcat that trailing slash after path of existing webapp should not suppose to redirect it to new webapp calls the whole "string" and just process the request like on tomcat6, it would be great!

  • Is there a default servlet in the web.xml that is mapped to /*? Otherwise tomcat uses a welcome-file-list. Normally only the first path segment is interpredet as a context root. So not finding your webapp does not seem to be the problem.
    – mana
    Oct 24, 2012 at 15:18
  • the first path segment is a context root and really works, it finds it, but the follows paths instead of being part of the first path, the tomcat search for webapp with all the path.. I don't have anything that is configure that is non-default..
    – Avihoo Mamka
    Oct 24, 2012 at 15:43
  • I don't really get what you are saying. Sorry. If you have a webapp configured with the name MyApp then tomcat will use this web application context using the remaining path page/. If not, it will look for the ROOT context, using the full path for a lookup.
    – mana
    Oct 24, 2012 at 16:52
  • I have a webapp calls MyApp and example.com/MyApp is working, but when visiting example.com/MyApp/foo instead of looking for foo content inside MyApp, it searches for a webapp calls "MyApp/foo/" and not looking for the content under MyApp calls foo ..
    – Avihoo Mamka
    Oct 25, 2012 at 12:07
  • 2
    Try this: stackoverflow.com/q/11055608/1031900
    – Ofir Farchy
    Oct 25, 2012 at 13:45

3 Answers 3


Ancient question, but since I have recently battled with the terminating slash in Tomcat 8, I know that problems with the slash continues to plague the Tomcat user world. :-)

What you might be running into is changes in the way that Tomcat handles redirects when loading the root context. Check out bug 58660 and read some of the developer discussion there. You may need to turn off the default mapper by modifying the mapperContextRootRedirectEnabled attribute of the Context element in conf/context.xml.


Check your welcome-file-list .. what follows is speculation ...

I believe the essence of issue is when Tomcat is presented with a / - It has a few options - Iterate over the welcome file list - On nothing being there -- show directory listing (if enabled)

Here's where the fun begins ... Lots of folks want to use *.do for things like struts. So they want index.do to be the home page. Or also common is index.jsp where *.jsp is mapped to the JspServlet.

Here's where things get fun. So lets say your welcome files is index.jsp, index.do.

What Tomcat (IIRC) is doing is first iterating over the welcome file list looking for resources of that name.

Then it will do a second pass looking for mappings that match. So if index.jsp is specified in the welcome list and *.jsp is mapped. Then tomcat will try to forward to index.jsp and you'll get a 404.

So I'm going to guess you have a servlet mapping and welcome file overlapping. And the behavior of that servlet doesn't support GET. (Hence the 405)


If your project is using dynamic web module of v2.2, you need to explicitly create atleast one file (can be empty html file) present in web.xml(eg:index.html) in your WebContent.

  • 1
    this is comment; not an answer; please consider commenting in future when you get more points. thanks Nov 13, 2014 at 10:58

You must log in to answer this question.