tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Darren Hall" <>
Subject RE: (newb) Tomcat servlet mapping problem
Date Mon, 23 Jan 2006 19:56:16 GMT
As an add-on -
I successfully mapped the Tomcat servlet example "HelloWorldServlet" to my
/servlet directory successfully through my web.xml file. I did this to make
sure that a servlet with no package could be deployed the way I am
attempting (HelloWorldExample has no package). The ONLY error I encountered
while deploying the HelloWorldExample, was it complained that the
ResourceBundle the code was looking for couldn't be found. I recompiled the
servlet without the ResourceBundle code and the servlet worked correctly.
(I wasn't sure how to configure the ResourceBundle in the code. I copied all
the files the resource bundle seemed to be referring to into my /servlet
directory along with the compiled HelloWorldServlet code, but it still
complained on execution that it couldn't locate the resource, so it was
easier for me to comment it out.)

This tells me I can definitely deploy a servlet the way I am trying to, but
it also raises questions about why the resource bundle couldn't be located.
Is all of this really a classpath or class loader issue in some way?

-----Original Message-----
From: Darren Hall [] 
Sent: Monday, January 23, 2006 2:46 PM
To: 'Tomcat Users List'
Subject: RE: (newb) Tomcat servlet mapping problem

> On 1/23/06, Darren Hall <> wrote:
> > > > From: Darren Hall []
> > > > Subject: RE: (newb) Tomcat servlet mapping problem
> > > >
> > > > Is there a way I can map these servlets (in the web.xml file) so
> > > > that Tomcat can see them and execute them?
> > >
> As far as I can see, it just works. Whether it's correct or not, it
> does seem work in Tomcat 5.5.12 and I know it worked in 5.0.28 too. So
> this is probably not the cause of your problem. Try putting one
> servlet in a package to see if that makes a difference, before you try
> to change them all.
> Here's a servlet declaration that I just tested:
> <servlet>
>   <servlet-name>Test</servlet-name>
>   <servlet-class>Test</servlet-class>
> </servlet>
> <servlet-mapping>
>   <servlet-name>Test</servlet-name>
>   <url-pattern>/test</url-pattern>
> </servlet-mapping>
> --
> Len

ok, the start of this thread got lost... let me try and do a brief

I'm working with Tomcat 5.0, Apache 2, and a whole bunch of servlets that I
inherited. The website is a combination of static HTML and java. 95% of the
java code is implemented in servlets (that write out the dynamic HTML) and
NONE of the Java code is in packages.

The HTML on the site, when referring to servlets, uses relative paths like
<form action="../servlet/<servlet-name>". In order to remove the invoker
servlet, I need to map all the servlets on the site through a web.xml file.

Initially, I was getting a "resource unavailable" error from Tomcat, but it
now appears as if my servlet mapping was wrong. (my app lived in the
${catalina.home}/webapp/servlet directory, and my web.xml was mapping a
servlet to <url-mapping>/servlet/[servlet-name]</url-mapping>.

I fixed this by removing the '/servlet' in the <url-mapping> tag, and I now
get a stack trace with a "ClassDefNotFound" [servlet-name] error. This error
occurs when I point at Tomcat directly, so I know the error has nothing to
do with Apache. I now have a stripped down web.xml file that looks like this
(minus the xml and DOCTYPE directives):

Now everytime I hit the servlet, I get the "ClassDefNotFound" error, and
after that I see an entry in the log file:

2006-01-23 11:35:53 StandardContext[/servlet]Marking servlet
FLCUpEvDisplayServlet as unavailable
2006-01-23 11:35:53 StandardContext[/servlet]Error loading WebappClassLoader
  delegate: false

after which I get a "resource is not available" error again, until I stop
and restart Tomcat.

So, my question is... why am I getting the "ClassDefNotFound" error, and how
do I correct it (or can I, given my current configuration)?



To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message