• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Tomcat's default classpath??

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, I have an application (named 'abc' application) deployed in Tomcat 5.5 on Solaris using the war deploy feature in the manager.

The application (lets call it 'foo') shows up in the manager as '/foo', so I know that it deploys. When I look in catalina.log, I see a ClassNotFound exception, alerting me that the ClassLoader wasn't able to find my ControllerServlet class. Here is the error from Catalina.log:

2006-07-24 09:38:46,987 DEBUG org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] - Sending application start events
2006-07-24 09:38:46,987 DEBUG org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] - Starting filters
2006-07-24 09:38:47,002 INFO org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] - Marking servlet controller as unavailable
2006-07-24 09:38:47,002 ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/foo] - Error loading WebappClassLoader
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@1c92535
com.abc.framework.controller.ControlServlet
java.lang.ClassNotFoundException: com.abc.framework.controller.ControlServlet

My ControlServlet class is located in this jar file webapps/foo/WEB-INF/lib/abc.jar in the package com.abc.framework.controller;.

I wanted to confirm that jar files in the WEB-INF/lib directory were included in the classpath for my application. In reading through the online documentation for Tomcat I found the following:

"WebappX - A class loader is created for each web application that is deployed in a single Tomcat 5 instance. All unpacked classes and resources in the /WEB-INF/classes directory of your web application archive, plus classes and resources in JAR files under the /WEB-INF/lib directory of your web application archive, are made visible to the containing web application, but to no others."

I am doing exactly this. My jar file (foo.jar) is in the webapps/abc/WEB-INF/lib directory for my 'abc' application. However, in the Catalina log file, when Tomcat starts, I get the above "ClassNotFound - com.abc.framework.ControlServlet" error. Why can my servlet not be found if it resides in abc.jar under the WEB-INF/lib directory???

Thanks,

Darren
[ July 24, 2006: Message edited by: Darren Hall ]
 
Darren Hall
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And, I found the cause of the problem.

Essentially, my build.xml file was not including my compiled classes in the jar file, so the jar was essentially empty and the resulting war file I was deploying contained an empty jar.

Thus the class loader was unable to find my servlet.

I've repaired my build.xml and fixed the issue.

Thanks.
 
I love a good mentalist. And so does this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic