Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 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!

share|improve this question

migrated from Oct 25 '12 at 15:13

This question came from our site for professional and enthusiast programmers.

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 '12 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 '12 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 '12 at 16:52
I have a webapp calls MyApp and is working, but when visiting 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 '12 at 12:07
Try this: – Ofir Farchy Oct 25 '12 at 13:45

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 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,

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)

share|improve this answer

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.

share|improve this answer
this is comment; not an answer; please consider commenting in future when you get more points. thanks – Hrvoje Špoljar Nov 13 '14 at 10:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.