see intermixed

> -----Original Message-----
> From: Lorenti, John [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 24, 2003 8:53 AM
> To: 'Tomcat Users List'
> Subject: RE: java.lang.NoClassDefFoundError: javax/servlet/Filter
> 
> 
> Tim,
> Maybe what I've done is taboo :-(  I've placed the top level 
> directory that
> has all of our custom Java classes (shared by all applications on the
> machine) on the Tomcat classpath.  Tomcat is finding my 
> TestFilter class
> there (since I chose to leave the class there instead of 
> placing it under
> the context's WEB-INF/classes directory) which in turn references
> javax.servlet.Filter.  

what do you mean "on the tomcat classpath"? You classes should be under
/common/classes for shared classes and /WEB-INF/classes for each webapp. If
you put your filter in /common/classes it will find the javax.servlet.Filter
class through tomcat's classloading heriarchy.

> Since other applications besides those 
> within Tomcat
> are using the "common" code, I'd like to keep it in one place 
> outside of
> Tomcat's structure.  

It is much easier to have 2 copies of the code. A simple ANT script can copy
the files to tomcat's directories after you build them.

When building web applications, you have to consider how the classes will be
used within Tomcat, since classes in the /common/lib(or classes) can not
access classes that reside in WEB-INF/lib. This may not be the same division
as your "code shared with another app" and your "tomcat code".

you should review Tomcat's classloader document:
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html

> However, from what you've mentioned, it 
> seems that I
> may need to keep any Tomcat/Servlet specific classes where Tomcat is
> expecting them to reside and not depend upon the classpath.
> 

yes, you need to keep *all* your classes that Tomcat will use within
Tomcat's structure.

> If this is the case, do you think that a Tomcat-friendly 
> solution would be
> to separate my classes into two disjoint sets - one having 
> anything related
> to servlets, and the other containing my "common" 
> (non-Servlet specific)
> classes?  The first set would live under the context's 
> WEB-INF hierarchy,
> and the other set living on the classpath.  If this can work, 
> then maybe I
> can "have my cake and eat it too."
> 

no, again avoid the classpath when possible. it will only cause you problems
as you have already seen.

> Is there a better/more preferred way to accomplish class 
> sharing beyond
> Tomcat's purview?
> 
> Thank you.
> -John
> 
> -----Original Message-----
> From: Tim Moore [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 23, 2003 4:02 PM
> To: Tomcat Users List
> Subject: RE: java.lang.NoClassDefFoundError: javax/servlet/Filter
> 
> 
> > -----Original Message-----
> > From: Lorenti, John [mailto:[EMAIL PROTECTED]] 
> > Sent: Thursday, January 23, 2003 3:53 PM
> > To: 'Tomcat Users List'
> > Subject: RE: java.lang.NoClassDefFoundError: javax/servlet/Filter
> > 
> > 
> > Hello all,
> > After *explicitly* placing the 
> > <TOMCAT_HOME>/common/lib/servlet.jar on the Tomcat classpath 
> > the Filter class is found.  However it is my understanding 
> > that Tomcat shouldn't require me to do this since all jars in 
> > that directory are loaded by Tomcat (aren't they?).  This is 
> > an ugly workaround, but I thought it an interesting anomaly 
> > to pass on. -John
> 
> Oh here's a thought I just had...is there a class trying to reference
> javax.servlet.Filter that was already explicitly on the 
> classpath?  The
> stuff in common/lib is higher up in the classloader hierarchy than the
> stuff on the base classpath is, so that might explain it.
> 
> Hopefully that made sense...
> -- 
> Tim Moore / Blackboard Inc. / Software Engineer
> 1899 L Street, NW / 5th Floor / Washington, DC 20036
> Phone 202-463-4860 ext. 258 / Fax 202-463-4863
> 
> 
> > 
> > -----Original Message-----
> > From: Lorenti, John [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, January 23, 2003 2:26 PM
> > To: 'Tomcat Users List'
> > Subject: RE: java.lang.NoClassDefFoundError: javax/servlet/Filter
> > 
> > 
> > Hi again,
> > This is the first install of Tomcat on this server (done 
> > about a month ago), and it is not presently running any jsp 
> > applications save the examples. I've set up a few contexts, 
> > but they're empty right now (except for this TestFilter in 
> > the /ws context), so I suspect the install is pretty clean.  
> > I too was curious about whether or not the servlet.jar was 
> > the correct version, so I listed the jar's table of contents 
> > and saw that the javax.servlet.Filter was present (so I'm 
> > guessing this is the 2.3 jar - dated 09/23/2002).
> > 
> > Thanks again for you input.
> > -John
> > 
> > -----Original Message-----
> > From: Shapira, Yoav [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, January 23, 2003 12:40 PM
> > To: Tomcat Users List
> > Subject: RE: java.lang.NoClassDefFoundError: javax/servlet/Filter
> > 
> > 
> > Howdy,
> > 
> > >Do you have any other thoughts?
> > 
> > I have many thoughts ;)  Most of which don't relate to your 
> > question unfortunately.  
> > 
> > Is there any possibility unpacked classes from the 
> > servlet.jar are scattered throughout your installation?  Or 
> > that the servlet.jar file in your installation is NOT the 
> > version 2.3 jar?  Doing a clean installation of tomcat in a 
> > different directory may help solve this.
> > 
> > Yoav Shapira
> > Millennium ChemInformatics
> 
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 
> 
> --
> To unsubscribe, e-mail:   
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to