tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Young Neil" <YoungN...@JohnDeere.com>
Subject serving servlets from jar files
Date Thu, 23 May 2002 21:07:35 GMT
I'm using Tomcat 4.0.3 and I'm having a problem getting it to find servlets
that are in jar files.  All the documentation seems to point me in the same
direction, yet it still does not work for me.

I installed the bin distribution without any mod's...on both Linux and Win2k
and running this test with a simple servlet that displays the date and
relies on nothing that isn't in the base JRE 1.3.x classes.

If I put my servlet in the <tchome>/webapps/cediac01/WEB-INF/classes
directory I'm able to serve it just fine.  If I try to put it in a jar file
(date.jar):
[root@fdxdspc2 lib]# /usr/local/jdk1.3.1_03/bin/jar -tvf date.jar
     0 Mon May 20 14:31:26 CDT 2002 META-INF/
    71 Mon May 20 14:31:26 CDT 2002 META-INF/MANIFEST.MF
     0 Mon May 20 14:30:22 CDT 2002 com/
     0 Mon May 20 14:30:22 CDT 2002 com/test/
     0 Mon May 20 14:30:32 CDT 2002 com/test/date/
   925 Fri Apr 05 13:46:20 CST 2002 com/test/date/DateServlet.class

with the <tchome>/webapps/cediac01/WEB-INF/web.xml entry of:
<servlet>
<servlet-name>DateServlet</servlet-name>
<servlet-class>com.test.date.DateServlet.class</servlet-class>
</servlet>

When I try to load it after moving the jar file to the lib directory, and
making the config change I get this in the log:
2002-05-23 14:02:29 StandardWrapper[/cediac01:DateServlet]: Marking servlet
DateServlet as unavailable
2002-05-23 14:02:29 invoker: Cannot allocate servlet instance for path
/cediac01/servlet/DateServlet
javax.servlet.ServletException: Wrapper cannot find servlet class
com.test.date.DateServlet.class or a class it depends
on
        at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:87
1)
        at
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:653)
        [...]
        at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107
)
        at java.lang.Thread.run(Thread.java:479)
----- Root Cause -----
java.lang.ClassNotFoundException: com.test.date.DateServlet.class
        at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a:1394)
        at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a:1243)
        [....]
        at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107
)
        at java.lang.Thread.run(Thread.java:479)

At startup the jar file is at least recognized:

2002-05-23 14:51:07 WebappLoader[/cediac01]: Deploy JAR
/WEB-INF/lib/date.jar to /usr/local/jakarta-tomcat-4.0.3/webapps
/cediac01/WEB-INF/lib/date.jar

I know this is a fundamental function of Tomcat, so I must be missing
something, but can't seem to find any clues in the documentation.  Does
anyone have an idea as to what it could be?

-Thanks
Neil Young




--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message