tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smith <d...@cornell.edu>
Subject Re: Setting the classpath for my application
Date Mon, 24 Jul 2006 20:18:09 GMT
Ok..... Confirmed.  Per the servlet spec, all jars in the WEB-INF/lib 
folder are included in the webapp's classloader.

Now, here are some questions that might help narrow down what's happening:

1. Is the jar a valid jar file?  Does it's internal folder structure 
mirror the package structure?
2. Are there any permission problems that might prevent tomcat from 
reading the jar file?
3. After placing this jar file in WEB-INF/lib, did you restart the 
webapp from the manager or tomcat itself?
4. Is there any indication in the logs that tomcat is having an issue 
loading your 'foo.jar' file?
5. Is foo.jar really in WEB-INF/lib or did you do some symlink/shortcut 
scheme that tomcat might not follow?

--David


Darren Hall wrote:

>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 a "ClassNotFound -
>com.abc.framework.ControlServlet" error. Why can my servlet not be found if
>it resides in the jar under the WEB-INF/lib directory???
>
>Any help would be appreciated.
>
>Thanks,
>
>Darren
>
>
>
>-----Original Message-----
>From: Darren Hall [mailto:dhall@utrs.com] 
>Sent: Monday, July 24, 2006 1:59 PM
>To: 'Tomcat Users List'
>Subject: Setting the classpath for my application
>
>Is the fact that I'm receiving a ClassNotFound error from Tomcat's
>ClassLoader for a class that I've created indicative of a bad classpath?
>Are jar files stored in WEB-INF/lib automatically included in Tomcat's
>classpath for my application?
>
>If so, how do I set the classpath for my application in Tomcat?
>
>Thanks,
>
>Darren
>
>-----Original Message-----
>From: Darren Hall [mailto:dhall@utrs.com] 
>Sent: Monday, July 24, 2006 11:19 AM
>To: 'Tomcat Users List'
>Subject: ClassNotFound - Is WEB-INF/lib in my app's classpath?
>
>Ok, I've deployed my application 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;.
>
>Are the jar files in WEB-INF/lib included in my application's classpath by
>default? Do I need to make a classpath change somewhere? Is the fact that
>WEB-INF/lib not show up in the repositories listing above meaningful?
>
>Why can't Tomcat's classloader find my ControlServlet class?
>
>Thanks,
>
>Darren
>
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>  
>


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


Mime
View raw message