[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Servlet - Requested Resource is not available

Posted on 2009-02-15
4
Medium Priority
?
884 Views
Last Modified: 2012-06-21
I have a servlet named ControllerServlet in this directory C:\Tomcat 6.0\webapps\burnaby\WEB-INF\classes\  
I have the following deployment descriptor.  I keep getting the error that the requested resource is not available.  I use this link on my local machine.  http://localhost:8081/burnaby/servlet/ControllerServlet

I am stuck and am not sure what I am doing wrong.  

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
  "http://java.sun.com/dtd/web-app_2_3.dtd">
 
<web-app>
  <!-- Define the controller servlet -->
  <servlet>
    <servlet-name>ControllerServlet</servlet-name>
    <servlet-class>ControllerServlet</servlet-class>
    
    <servlet-mapping>
    <servlet-name>ControllerServlet</servlet-name>
    <url-pattern>/servlet/ControllerServlet</url-pattern>
    </servlet-mapping>
 
    <!-- Define initial parameters that will be loaded into 
       the ServletContext object in the controller servlet -->
    <init-param>
      <param-name>base</param-name>
      <param-value>http://localhost:8081/burnaby/servlet/ControllerServlet</param-value>
    </init-param>
    <init-param>
      <param-name>jdbcDriver</param-name>
      <param-value>sun.jdbc.odbc.JdbcOdbcDriver</param-value>
    </init-param>
    <init-param>
      <param-name>imageUrl</param-name>
      <param-value>http://localhost:8081/burnaby/images/</param-value>
    </init-param>
    <init-param>
      <param-name>dbUrl</param-name>
      <param-value>jdbc:odbc:Burnaby</param-value>
    </init-param>
    <init-param>
      <param-name>dbUserName</param-name>
      <param-value></param-value>
    </init-param>
    <init-param>
      <param-name>dbPassword</param-name>
      <param-value></param-value>
    </init-param>
  </servlet>
</web-app>

Open in new window

0
Comment
Question by:monica73174
  • 3
4 Comments
 
LVL 92

Expert Comment

by:objects
ID: 23647276
try moving ControllerServlet class into a package

0
 
LVL 92

Expert Comment

by:objects
ID: 23647282
eg. to move it into package controller you would

1. add package statement to ControllerServlet class

package controller;

public class ControllerServlet ....

2. The class will now be in WEB-INF/classes/controller

3.  change mapping to:

 
    ControllerServlet
    controller.ControllerServlet
   

0
 
LVL 92

Accepted Solution

by:
objects earned 2000 total points
ID: 23647289
 
    ControllerServlet
    ControllerServlet


thats also missing a closing
0
 

Author Comment

by:monica73174
ID: 23647311
I had the servlet-mapping inside the servlet tag.  Your last answer helped a lot.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month19 days, 7 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question