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

2001-07-20 Thread Andrew McGhee

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:[EMAIL PROTECTED]]
Sent: 19 July 2001 22:27
To: [EMAIL PROTECTED]
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:[EMAIL PROTECTED]]
  Sent: Thursday, July 19, 2001 10:49 AM
  To: [EMAIL PROTECTED]
  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/classes

2001-07-20 Thread Will England

On Thu, 19 Jul 2001, David Rees wrote:

 (Sorry about the double-qoute, I missed the original message)
 
 
 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.

Tried that.  Tried hard-coding the classpath.  If the web applications
WEB-INF/classes directory was in the system classpath, it compiles.  If it
is not in the system classpath, the JSP's do not compile.  

So, why does Jasper not know about the web-application classpath?  

Will




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

2001-07-20 Thread Will England

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





Re: [3.2] JSP Compiling Classpath issues -- finding WEB-INF/classes

2001-07-20 Thread David Haraburda

Oops,

That's right, you can read any file you want from WEB-INF/classes using
getResource() (which is probably what you are doing) -- that is implemented
correctly in AdaptiveClassLoader.  If you want to find all resources of a
specified name (for example, you have a properties file of the same name at
the web-application level and the system level, and you want to concatenate
values from both places together), the ClassLoader class provides a
getResources() method.  (This method in turn calls findResources which is
supposed to be implemented in all subclasses of ClassLoader, but isn't for
AdaptiveClassLoader)

I'm glad to know that fixed it.

David

Will England wrote:

 On Fri, 20 Jul 2001, David Haraburda wrote:

  Have you tried using the Jdk12Interceptor?  That fixed class loading
  problems for me.  In your server.xml do:
 
  RequestInterceptor
  className=org.apache.tomcat.request.Jdk12Interceptor/

 Got that, and it fixed the finding of my .conf files that I store in
 WEB-INF/classes.  I can now read any text file I want from WEB-INF/classes
 from a servlet.

  Note this will only fix the loading of CLASSES... if you have resources
  in your WEB-INF/classes directory, such as .properties files, that the
  ClassLoader is supposed to pick up, this will not happen.  I submitted a
  patch for this to the mailing list last night, but haven't heard
  anything from a developer/committer yet.

 Odd.  Worked well for me.  As soon as the admin gets the box back up, I'll
 drop you a copy of my server.xml and the code I use to read a text file.

  A good way to see what ClassLoader is being used is by sticking in a
  System.out.println( CL:  +
  Thread.currentThread().getContextClassLoader().toString() );
 
  If it says com.sun.misc.something (I forget the package name), you are
  using the System classloader... if it says AdaptiveClassLoader, you are
  using the Tomcat one which knows about stuff in the WEB-INF directory.

 Nice tip - I'll try that!

 Will




[3.2] JSP Compiling Classpath issues -- finding WEB-INF/classes

2001-07-19 Thread Will England

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.

The code in question is coming from a production Tomcat 3.1 system.

I cannot add the WEB-INF/classes directory to my classpath.  This will
break several other parts of the system.

What is the problem with Jasper reading WEB-INF/classes?

I understand the the Coocon users found some kind of workaround, but I
have been unable to find it.

Thank you for any pointers or tips!

Will


-- 
  /~'find `funny quote`': Command not found; humor not installed.  
  1986 Concours 72,xxx  1982 Maxim 12,xxx (For Sale!) CDA #00046
  Overland Park, KS [EMAIL PROTECTED] PCS: 316-371-FOAD
http://will.mylanders.com/




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

2001-07-19 Thread Rob S.

I guess I don't follow, cuz I use this functionality of Tomcat every single
day.

Whether or not its under Apache shouldn't matter.

- r

 -Original Message-
 From: Will England [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, July 19, 2001 10:49 AM
 To: [EMAIL PROTECTED]
 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.

 The code in question is coming from a production Tomcat 3.1 system.

 I cannot add the WEB-INF/classes directory to my classpath.  This will
 break several other parts of the system.

 What is the problem with Jasper reading WEB-INF/classes?

 I understand the the Coocon users found some kind of workaround, but I
 have been unable to find it.

 Thank you for any pointers or tips!

 Will


 --
   /~'find `funny quote`': Command not found; humor not installed.
   1986 Concours 72,xxx  1982 Maxim 12,xxx (For Sale!) CDA #00046
   Overland Park, KS [EMAIL PROTECTED] PCS: 316-371-FOAD
 http://will.mylanders.com/






Re: [3.2] JSP Compiling Classpath issues -- finding WEB-INF/classes

2001-07-19 Thread David Rees

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

  -Original Message-
  From: Will England [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, July 19, 2001 10:49 AM
  To: [EMAIL PROTECTED]
  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