tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Darren Hall" <dh...@utrs.com>
Subject RE: (newb) Tomcat servlet mapping problem
Date Mon, 23 Jan 2006 19:46:01 GMT
> On 1/23/06, Darren Hall <dhall@utrs.com> wrote:
> > > > From: Darren Hall [mailto:dhall@utrs.com]
> > > > 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
refresher...

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):
...
<web-app>
  <servlet>
    <servlet-name>FLCUpEvDisplayServlet</servlet-name>
    <servlet-class>FLCUpEvDisplayServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>FLCUpEvDisplayServlet</servlet-name>
    <url-pattern>/FLCUpEvDisplayServlet</url-pattern>
  </servlet-mapping>
</web-app>

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
  repositories:
    /WEB-INF/classes/

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)?

Thanks

Darren



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


Mime
View raw message