tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tony LaPaso" <t...@absolutejava.com>
Subject Re: ?? Sharing the JSTL JARS and Classloading ??
Date Sat, 22 Jan 2005 23:33:45 GMT
You have some good points, Jake. Thank you for the response. If you happen 
to run across the statement from Craig M. regarding Struts I'd like to see 
it.

Incidentally, in reading the Tomcat docs for "Classloading", it seems that 
any classes in a web app's "lib" directory *should* be able to see classes 
in the "shared/lib" directory. Similarly, any classes in "shared/lib" 
*should* be able to see what's in "common/lib".

<angry-rant>
The crappy, incomplete Tomcat documentation strikes again. One of the bad 
things about these open source projects is that since no one "owns them" no 
one has responsibility to work on anything except what they're interested 
in. The result is often neglected, shoddy and incomplete documentation.
</angry-rant>

So, again, it seems weird that putting the JSTL JARs in "common/lib" works 
fine while putting them in "shared/lib" doesn't. When I put them in 
"shared/lib" I get the exception shown below. From the exception below it 
seems to me that the classes in "common/lib" (e.g., 
javax.servlet.http.HttpServlet) do not have access to classes in 
"shared/lib" (e.g., org.apache.taglibs.standard.tag.rt.core.ForEachTag) 
although the classes in "common/lib" *DO* obviously have access to classes 
in a web app's "lib" directory.

If only the classloader docs were better....


exception
  javax.servlet.ServletException: 
org.apache.taglibs.standard.tag.rt.core.ForEachTag
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
    org.apache.jsp.index_jsp._jspService(Unknown Source)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause
  java.lang.NoClassDefFoundError: 
org.apache.taglibs.standard.tag.rt.core.ForEachTag
    org.apache.jsp.index_jsp.class$(Unknown Source)
    org.apache.jsp.index_jsp._jspx_meth_c_forEach_0(Unknown Source)
    org.apache.jsp.index_jsp._jspService(Unknown Source)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)




----- Original Message ----- 
From: "Jacob Kjome" <hoju@visi.com>
To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
Sent: Saturday, January 22, 2005 10:30 AM
Subject: Re: ?? Sharing the JSTL JARS and Classloading ??


> Not all libraries are written in a way that allows for them to be used 
> from different webapps.  Struts has a statement on this written by Craig 
> McClanahan, but I can't find it at the moment.  The gist of it is that 
> Struts (at least with 1.1) cannot be guaranteed to work properly if placed 
> in a shared classloader.  One example of where this might be problematic 
> is with non-final static variables.  If it they get changed by one app, 
> the other app sees the change.  Usually, this is not the desired behavior 
> as it will make each app using the shared library behave in unpredictable 
> ways.
>
> Anyhow, what error are you getting when you add the library to the shared 
> classloader?  I haven't looked at the classloader hierarchy in Tomcat for 
> a little while, but it is possible that shared/lib cannot see common/lib, 
> and if there are libraries that standard.jar and jstl.jar depend on 
> libraries that exist in common/lib, then you might get the error you are 
> seeing.
>
>
> Jake
>
> At 01:24 AM 1/22/2005 -0600, you wrote:
> >Hi all,
> >
> >I'm using TC 5.0.30.
> >
> >JSTL Is working fine -- I have the standard.jar and jstl.jar files in my
> >"WEB-INF/lib" directory.
> >
> >The problem is that I have several web applications that use JSTL and
> >therefore several "WEB-INF/lib" directories. Rather than copy the
> >aforementioned JAR files to *every* "WEB-INF/lib" directory I'd rather 
> >put
> >them in one central location and have them available for *ALL* web
> >applications.
> >
> >According to the crappy Tomcat documentation that's never updated, I 
> >should
> >be able to put the JARs in "$CATALINA_HOME/shared/lib".  Unfortunately, 
> >that
> >doesn't seem to work with these two JARs for some reason. Instead, I have 
> >to
> >put them in $CATALINA_HOME/common/lib (which seems to work, for some
> >reason).
> >
> >Why can't I just put these two JARs in "$CATALINA_HOME/shared/lib" and 
> >have
> >them shared across all web applications, as the Tomcat documentation on
> >"Classloading" indicates I should be able to? It seems very odd that I 
> >can
> >either copy the JARs to every WEB-INF/lib directory *OR* put them in
> >$CATALINA_HOME/common/lib, but not put them "$CATALINA_HOME/shared/lib".
> >
> >
> >Thanks....
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message