You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Craig R. McClanahan" <Cr...@eng.sun.com> on 2000/10/04 18:00:11 UTC
Re: Why does including struts.jar to CLASSPATH makes problem?
Yun Sang Jung wrote:
>
>
> [Image]
> Hi.. Struts user.
>
> Until now, I have used struts & tomcat 3.2 beta 5 for building my application.
> Today, I placed struts.jar file to CLASSPATH directory and removed struts.jar file
> from $TOMCAT_HOME/webapps/myapps/WEB-INF/lib directory.
> Then I met resource missing message. (org.apache.struts.????.MESSAGE)
>
> Before moving struts.jar file, there was no problem!
>
> My Question is as follows:
> [Q1]
> What is the difference placing struts.jar into CLASSPATH directory between
> $TOMCAT_HOME/webapps/myapps/WEB-INF/lib directory?
> Isn't it the same configuration?
>
No, it is actually not the same.
The JAR files in the $TOMCAT_HOME/lib directory end up on the system
classpath, which is shared across all webapps. The WEB-INF/lib
directory contains classes that are only visible from within that
web-app. And that is what causes the difficulty.
Consider the Struts example application, for example. It uses form
beans and other classes from the WEB-INF/classes and WEB-INF/lib
directories. But, if you load Struts itself from the system classpath,
these classes are not visible to Struts itself -- Struts looks only in
the system classpath because that is where it was loaded.
Thus, the rule is you *must* put the "struts.jar" file in your
WEB-INF/lib directory to work on Tomcat 3.2, and most other current
generation servlet containers.
> [Q2]
> Should struts.jar file be loaded application specific classloader?
> If yes, why?
>
Yes, for the reasons described above.
> Regards,
> Jung
>
Craig McClanahan
====================
See you at ApacheCon Europe <http://www.apachecon.com>!
Session VS01 (23-Oct 13h00-17h00): Sun Technical Briefing
Session T06 (24-Oct 14h00-15h00): Migrating Apache JServ
Applications to Tomcat