Velocity Reviews

Velocity Reviews (
-   Java (
-   -   Servlet URL Mapping Evil! (

Fran Cotton 07-25-2003 03:41 PM

Servlet URL Mapping Evil!
I was wondering if anyone could help? I've read the
docs and thought I understood what was going on!

Set-up: Tomcat 4.1 and JSDK 1.4.1 on Windows 2000

under the Tomcat webapps directory I have the
following structure set-up:


The HelloWorld servlet runs fine with the following URL:

http://localhost:8080/ServletAdventure/fred -- OK!

The web.xml file found below sets up the relationship
between fred and HelloWorld as expected. However, when
I try my truncated URL derived from the specified URL
pattern, it all blows up:

http://localhost:8080/john -- NOT OK!




I thought the purpose of URL mapping was to allow
aliases to be setup to point at your servlet in a
short-hand form.

However, I get the following error:

javax.servlet.ServletException: Wrapper cannot find
servlet class HelloWorld or a class it depends on

I'm assuming that it cannot find the HelloWorld
class because it is looking relative to the webapps
directory for it as I'm no longer proving the app context
in the URL i.e. ServletAdventure.

Why it cannot find it I do not
understand as it works out that john maps onto
fred which in turn maps onto HelloWorld. If it can find
the appropriate web.xml file, why can it not as per
non url-patterned instances, find the class file relative
to web.xml?

Please help!

Should I be adding the classpath of url-patterned servlets
to some classpath or other? Please don't say the global one!
Have I not configured TomCat properly!?

Many thanks in advance,

Fran Cotton

All times are GMT. The time now is 04:59 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.