tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smith <d...@cornell.edu>
Subject Re: can not set up HelloWorldExample servlet to be called from a different directory
Date Fri, 08 Sep 2006 17:13:30 GMT
You need a servlet mapping in your web.xml file:

<servlet-mapping>
  <servlet-name>HelloWorldExample</servlet-name>
  <url-pattern>/servlet/HelloWorldExample</url-pattern>
</servlet-mapping>

Put it after </servlet> in your web.xml.  Also, the CLASSPATH 
environment variable is ignored in tomcat.  Don't try to set it.

--David

Alla Winter wrote:

>Hello,
>
>I think I am trying to do a very simple thing - to deploy my application to
>TOMCAT5.5.17.  I am using j2sdk1.4.2_12, and I did install the computability
>pack.  Windows 2000
>
>I was able to start tomcat and run HelloWorldExample servlet, but I am not
>able to access my application in the directory cobra_source 
>
> 
>
>To avoid any questions about my software, all I did is created another
>directory under webbapps , cobra_source, and put in there
>HelloWorldExample.class.  I also copied the web.xml file
>
> 
>
>Then I tried : http://localhost:8080/cobra_source/servlet/HelloWorldExample
>
> 
>
>And here it is the answer:
>HTTP Status 404 - /cobra_source/servlet/HelloWorldExample
>
> 
>
>What I am doing wrong?
>
> 
>
>Thanks for your help in advance
>
> 
>
>Here are my setups : 
>
>
>CLASSPATH ( environment variable)
>
>
>C:\Documents and Settings\Alla>echo %CLASSPATH%
>
>c:\apache-tomcat-5.5.17\webapps\cobra_source\WEB-INF\classes
>
> 
>
> 
>
>directory structure
>
>Directory of C:\apache-tomcat-5.5.17\webapps\cobra_source\WEB-IN
>
> 
>
>9/07/2006  03:41p      <DIR>          .
>
>9/07/2006  03:41p      <DIR>          ..
>
>9/07/2006  03:36p      <DIR>          classes
>
>9/07/2006  03:39p               3,356 cobra_web.xml
>
>8/29/2006  04:53p      <DIR>          lib
>
>9/07/2006  04:37p               1,198 web.xml
>
>              2 File(s)          4,554 bytes
>
>              4 Dir(s)  17,212,928,000 bytes free
>
> 
>
> 
>
>Directory of C:\apache-tomcat-5.5.17\webapps\cobra_source\WEB-INF\classes
>
> 
>
>09/07/2006  03:36p      <DIR>          .
>
>09/07/2006  03:36p      <DIR>          ..
>
>09/06/2006  03:36p      <DIR>          com
>
>06/28/2006  11:09a               3,609 Configuration.properties
>
>04/14/2006  02:09p               2,056 HelloWorldExample.class
>
>05/17/2004  02:00p                 538 LogManager.properties
>
>               3 File(s)          6,203 bytes
>
>               3 Dir(s)  17,212,907,520 bytes free
>
> 
>
>web.xml file
>
><?xml version="1.0" encoding="ISO-8859-1"?>
>
><!--
>
>  Copyright 2004 The Apache Software Foundation
>
> 
>
>  Licensed 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
>
> 
>
>      http://www.apache.org/licenses/LICENSE-2.0
>
> 
>
>  Unless required by applicable law or agreed to in writing, software
>
>  distributed under the License is distributed on an "AS IS" BASIS,
>
>  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>
>  See the License for the specific language governing permissions and
>
>  limitations under the License.
>
>-->
>
> 
>
><!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>
>
> 
>
>    <display-name>Servlet 2.4 Examples</display-name>
>
>    <description>
>
>      Servlet 2.4 Examples.
>
>    </description>
>
> 
>
>    
>
> 
>
>    
>
> 
>
>    <!-- Define servlets that are included in the example application -->
>
>    <servlet>
>
>        <servlet-name>HelloWorldExample</servlet-name>
>
>        <servlet-class>HelloWorldExample</servlet-class>
>
>    </servlet>
>
>    
>
>    
>
></web-app>
>
> 
>
> 
>
>
>  
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message