You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Andrew McGhee <an...@netdecisions.co.uk> on 2001/07/20 13:59:01 UTC

RE: [3.2] JSP Compiling Classpath issues -- finding WEB-INF/class es

Guys,
I've copied in an email returned to a support desk regarding a problem
similar to this. There is a link to mikal.org that explains it in better
detail, but essentially it refers to where your classes are found, as to
what classloader they inherit. And the solution we found (similar to the
post) is to ensure your classpath is unset before starting Tomcat.

Regards,
Andrew Mc.Ghee

> Thanks again for your help on this,
> Looks like we have tracked down the problem, and it was due to a reference
to the Poet SDK on the CLASSPATH. References to > Poet code was finding the
class instance on the jar file specified within the CLASSPATH itself, and so
was not having
> access to the classloader from tomcat, making anything within
webapps/WEB-INF/lib unavailable. We have simply removed the
> reference to the poet jar files from the classpath, and placed the jar
file within the webapps/WEB-INF/lib directory, and
> voila! (No need to set the database classloader now either)

> Thanks again for your assistance in this, pointing out the classpath
loading help to isolate the problem.

> A useful link regarding this problem was;
http://mikal.org/interests/java/tomcat/archive/view?mesg=22444 (And probably
> explains the situation far better than I can)

-----Original Message-----

-----Original Message-----
From: David Rees [mailto:dbr@greenhydrant.com]
Sent: 19 July 2001 22:27
To: tomcat-dev@jakarta.apache.org
Subject: Re: [3.2] JSP Compiling Classpath issues -- finding
WEB-INF/classes


(Sorry about the double-qoute, I missed the original message)

> > -----Original Message-----
> > From: Will England [mailto:will@mylanders.com]
> > Sent: Thursday, July 19, 2001 10:49 AM
> > To: tomcat-dev@jakarta.apache.org
> > Subject: [3.2] JSP Compiling Classpath issues -- finding WEB-INF/classes
> >
> >
> > Greetings!
> >
> > Over on tomcat-users, theres been a discussion on JSP's finding the
> > WEB-INF/classes directory when compiling.  They can't.  From searches, I
> > understand this issue has come up before in regards to the Coocon
project.
> >
> > The root problem is that Jasper cannot find classes located in
> > WEB-INF/classes of the web application that the JSP's belong to.  This
> > occurs when a JSP is either first deployed or the TOMCAT_HOME/work
> > directory is cleared, requiring a recompile of the JSP's.
> >
> > The system is Tomcat 3.2 under Apache with mod_jk, running on SunOS 2.7
> > with JDK 1.2.

I have noticed the same problem while doing some development using
Tomcat 3.2.[23].  I worked around it by making sure that I unset the
classpath before calling startup.sh, then things seemed to work properly
and classes were found as expected.

It seems that certain combinations of classes in different ares
(CLASSPATH, WEB-INF/lib, or other) will break things, but I haven't
pinned it down, so it could simply be user stupidity.

-Dave

RE: [3.2] JSP Compiling Classpath issues -- finding WEB-INF/class es

Posted by Will England <wi...@mylanders.com>.
On Fri, 20 Jul 2001, Andrew McGhee wrote:

> Guys,
> I've copied in an email returned to a support desk regarding a problem
> similar to this. There is a link to mikal.org that explains it in better
> detail, but essentially it refers to where your classes are found, as to
> what classloader they inherit. And the solution we found (similar to the
> post) is to ensure your classpath is unset before starting Tomcat.
> 

The solution posted (unset your classpath, cause there might be a class
with the same name somewhere else) is fine for first year university
students.  Most likely, that *is* what causes their problems.  <grin>

But, I have set, unset, hard coded, soft coded and so on the classpath.

In tomcat.sh, I have a hard-coded classpath pointing to the .jar files in
TOMCAT_HOME/lib, and tools.jar.  Nothing else.  I try to hit a JSP for the
first time, the compile fails.  Jasper reports that it cannot find classes
that are located in the web applications WEB-INF/classes
directory.  Theoretically, the adaptive classloader should know about
WEB-INF/classes, and I thought Jaspter used the adaptive classloader.

If I change the hard-coded classpath in tomcat.sh to point to the web
applications WEB-INF/classes directory, so that the WEB-INF/classes folder
is in the system classpath, Jasper can now find the classes and
compilation continues normally.

Can one of the developers detail out where Jasper looks for classes for
compiling JSPs?

Thanks for any tips or suggestions!

Will