tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Warren Pace <wap...@bellsouth.net>
Subject Re: (newb) Tomcat servlet mapping problem
Date Thu, 01 Jan 1970 00:00:00 GMT

> 
> From: "Darren Hall" <dhall@utrs.com>
> Date: 2006/01/20 Fri PM 02:28:22 EST
> To: <users@tomcat.apache.org>
> Subject: (newb) Tomcat servlet mapping problem
> 
> I'm running Tomcat 5.0.30 and Apache 2.0 (both are running fine and without
> errors).
> 
> I've connected them using mod_jk2, and I can see that apache is correctly
> forwarding URLs specified in the workers2.properties file correctly.
> 
> 
> I am now attempting to map a test servlet called "SimpleServlet" to an URL.
> 
> I've deployed the servlet in the directory "SimpleServlet". In the
> webapps/SimpleServlet/WEB-INF directory I've added the following web.xml
> file:
> 
>  
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> 
> <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
> 
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 
>     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
> 
>     version="2.4">
> 
>  
> 
>     <servlet>
> 
>         <servlet-name>SimpleServlet</servlet-name>
> 
>         <servlet-class>us.souther.simple.SimpleServlet</servlet-class>
> 
>     </servlet>
> 
> 
>     <servlet-mapping>
> 
>         <servlet-name>SimpleServlet</servlet-name>
> 
>         <url-pattern>/simple-servlet</url-pattern>
> 
>     </servlet-mapping>
> 
>  
> 
> </web-app>
> 
>  
> 
> In the ${catalina.home}/conf/Catalina/localhost directory, I've added the
> following SimpleServlet.xml file:
> 
>  
> 
> <?xml version='1.0' encoding='utf-8'?>
> 
> <!-- Make the servlet reloadable -->
> 
> <Context path="/simple-servlet" docBase="SimpleServlet" reloadable="true"
> debug="99">
> 
>   <Logger className="org.apache.catalina.logger.FileLogger"
> 
>           directory="logs"  prefix="simple." suffix=".log"
> 
>           timestamp="true"/>
> 
> </Context>
> 
>  
> 
> In the workers2.properties file (on the Apache side), I've added the
> following entry:
> 
>  
> 
> [uri:localhost/simple-servlet/*]
> 
> worker=ajp13:localhost:8009
> 
> debug=99
> 
>  
> 
> When I try to hit the URL http://localhost/simple-servlet I get back this
> response from Tomcat:
> 
>  
> 
> HTTP Status 404 -/simple-servlet
> 
> type Status report
> 
> message /simple-servlet
> 
> description The requested resource (/simple-servlet) is not available.
> 
> Apache Tomcat / 5.0.30
> 
>  
> 
> Can anyone please tell me why my servlet is not mapped to the URL properly?
> 
>  
> 
> Thanks.
> 
>  
> 
> Darren
> 
> 
Darren,
     I'm pretty new to this as well.  Here are a couple of things I do know.  mod_jk2 is deprecated.
 That doesn't mean it won't work but all development effort has been re-focusted to mod_jk.
 It's simple enough to download and build.
 1)  Is your servlet in a package (us.souther.simple)?  Did it compile without error?
 2)  Generally the directory tree for servlets in packages = WEB-INF/classes/us/souther/simple
(which is where your web.xml is telling tomcat to look for the class file).
 3)  Double-check the path entry in your context tag.  I moved from tomcat 4 to tomcat 5.5,
skipping the 5.0 releases so I can't provide any insight on the context directives (in 5.5
you don't specify a context path).  Just make sure it's pointing tomcat to something real.
 4) Some good resources are Jayson Falkner & Kevin Jones book "Servlets and JSP The J2EE
Web Tier", this mailing list, and Google.
Hope this helps.
Warren
> 


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


Mime
View raw message