You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by Alan Francis <al...@owl.co.uk> on 1999/11/10 14:38:44 UTC

Tomcat configuration

I've been banging my head off a brick wall for a while with the web.xml and
server.xml files....

Help appreciated.

Here's the scenario.

I have the tomcat directory, with examples, webpages etc as sub-dirs.  I've
added a new sub-dir for my web-app called wiki.

so I now have:
  <tomcat-base>\wiki\
  <tomcat-base>\wiki\web-inf\
  <tomcat-base>\wiki\web-inf\classes\

my server.xml has:

  <Context path="/wiki" docBase="wiki"
    defaultSessionTimeOut="30" isWARExpanded="true"
    isWARValidated="false" isInvokerEnabled="true"
    isWorkDirPersistent="false"/>

which was basically copied from "examples".

In my wiki\web-inf\classes directory I have a path structure for my
servlets. My assorted web-app servlets are in
uk\co\owl\wiki\servlet\XXXXX.class.

If I specify "http://localhost/wiki/servlet/uk.co.owl.servlet.Browse" as the
URL, it works, but what I want is just "http://localhost/wiki/browse"  What
is wrong with the following web.xml file ?

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">

<web-app>
  <DISPLAY-NAME>Wiki</DISPLAY-NAME>
  <SERVLET>
    <servlet-name>browse</servlet-name>
    <servlet-class>uk.co.owl.wiki.servlet.Browse</servlet-class>
  </SERVLET>
  <SERVLET-MAPPING>
    <servlet-name>browse</servlet-name>
    <url-pattern>/wiki/browse</url-pattern>
  </SERVLET-MAPPING>
</web-app>

--
Alan C Francis <al...@owl.co.uk> [ http://www.owl.co.uk/ ]



Re: Tomcat configuration

Posted by Hans Bergsten <ha...@gefionsoftware.com>.
Alan Francis wrote:
> 
> I've been banging my head off a brick wall for a while with the web.xml and
> server.xml files....
> 
> Help appreciated.
> 
> Here's the scenario.
> 
> I have the tomcat directory, with examples, webpages etc as sub-dirs.  I've
> added a new sub-dir for my web-app called wiki.
> 
> so I now have:
>   <tomcat-base>\wiki\
>   <tomcat-base>\wiki\web-inf\
>   <tomcat-base>\wiki\web-inf\classes\
> 
> my server.xml has:
> 
>   <Context path="/wiki" docBase="wiki"
>     defaultSessionTimeOut="30" isWARExpanded="true"
>     isWARValidated="false" isInvokerEnabled="true"
>     isWorkDirPersistent="false"/>
> 
> which was basically copied from "examples".
> 
> In my wiki\web-inf\classes directory I have a path structure for my
> servlets. My assorted web-app servlets are in
> uk\co\owl\wiki\servlet\XXXXX.class.
> 
> If I specify "http://localhost/wiki/servlet/uk.co.owl.servlet.Browse" as the
> URL, it works, but what I want is just "http://localhost/wiki/browse"  What
> is wrong with the following web.xml file ?
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app
>     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
>     "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
> 
> <web-app>
>   <DISPLAY-NAME>Wiki</DISPLAY-NAME>
>   <SERVLET>
>     <servlet-name>browse</servlet-name>
>     <servlet-class>uk.co.owl.wiki.servlet.Browse</servlet-class>
>   </SERVLET>
>   <SERVLET-MAPPING>
>     <servlet-name>browse</servlet-name>
>     <url-pattern>/wiki/browse</url-pattern>
>   </SERVLET-MAPPING>
> </web-app>

Change 
  <url-pattern>/wiki/browse</url-pattern> 
to
  <url-pattern>/browse</url-pattern>

All mappings within a context are releative to the context path, i.e.
the way you have it now you're saying that /wiki/wiki/browse should
call the browse servlet.

Hans
-- 
Hans Bergsten		hans@gefionsoftware.com
Gefion Software		http://www.gefionsoftware.com