wood burning stoves 2.0*
The moose likes Tomcat and the fly likes The requested resource (/review/HelloServlet) is not available Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "The requested resource (/review/HelloServlet) is not available" Watch "The requested resource (/review/HelloServlet) is not available" New topic

The requested resource (/review/HelloServlet) is not available

Elsy Mena

Joined: Mar 12, 2009
Posts: 8

I am starting with servlets, jsp and Tomcat.

I am trying to complete a simple HelloServlet example.

I have Tomcat 6.0.18 and the relevant java. I can view the Tomcat main page from http://localhost:8080/

I created the directory structure:


I have a web.xml file under the WEB-INF directory:

<?xml version="1.0" encoding="ISO-8859-1"?>
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at


Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

<display-name>Welcome to Tomcat</display-name>
Welcome to Tomcat


I have a HelloServlet.java file in the classes folder. I compiled it, and it worked fine.

However, when I try to view the page http://localhost:8080/review/HelloServlet it displays:

type Status report

message /review/HelloServlet

description The requested resource (/review/HelloServlet) is not available.

I don't know why, if I have my web.xml file with the descriptions needed to the servlet. May I did a mistake with the pathname? or there is something else missing?

Thank you very much.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
At quick glance I see two mistakes:
1) Classes ought to be placed in packages. There are circumstances wherein packageless servlets work, but you should never make your application dependent on that. That's a bad practice.
2) url-pattern is relative to the context root. So with this configuration your servlet is effectively to be accessed as http://localhost:8080/review/review

I'd to say, go through a decent JSP/Servlet tutorial or book. This all is namely fairly trivial.
Elsy Mena

Joined: Mar 12, 2009
Posts: 8
Thank you very much Bauke, it worked with http://localhost:8080/review/review

I did not used a package because it was a little example, but I usually put my classes into packages. Do you know a good JSP/Servlet tutorial or book?

Thank you again.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Head First Servlets & JSP.
Elsy Mena

Joined: Mar 12, 2009
Posts: 8
Thank you very much
I agree. Here's the link: http://aspose.com/file-tools
subject: The requested resource (/review/HelloServlet) is not available
Similar Threads
HTTP Status 503 - This application is not currently available
unable to run servlet in tomcat
Configuring Tomcat...
Apache 2 and Tomcat 7 on Ubuntu 10.04 in VirtualBox 4.06xxx
Unable to execute Servlet