You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Berin Loritsch <bl...@apache.org> on 2001/10/04 21:19:11 UTC

Re: Updated Patch for Context Class Loader problems

Glen Daniels wrote:
> 
> This looks OK - I wonder what the performance hit ends up being for doing
> this every request, though...?

The performance hit is minimal (unless an exception is thrown--which is practically
never).  Cocoon is still able to have sub-millisecond response times when pages
are served from cache.  (processing time = 0ms).

> 
> > -----Original Message-----
> > From: Davanum Srinivas [mailto:dims@yahoo.com]
> > Sent: Thursday, October 04, 2001 12:43 PM
> > To: axis-dev@xml.apache.org
> > Subject: Updated Patch for Context Class Loader problems
> >
> >
> > Hi Team,
> > Here's an updated patch for the Class Loader problems (after
> > a brief chat on IRC with Glen & Sam).
> >
> > Thanks,
> > dims
> >
> > --------------------------------------- CUT HERE
> > -------------------------------------------------Index:
> > AxisServlet.java
> > ===================================================================
> > RCS file:
> > /home/cvs/xml-axis/java/src/org/apache/axis/transport/http/Axi
> > sServlet.java,v
> > retrieving revision 1.50
> > diff -u -r1.50 AxisServlet.java
> > --- AxisServlet.java  2001/10/04 14:36:50     1.50
> > +++ AxisServlet.java  2001/10/04 16:35:28
> > @@ -96,6 +96,15 @@
> >      private static final String AXIS_ENGINE = "AxisEngine" ;
> >
> >      public void init() {
> > +        /*
> > +         * HACK: Some Servlet Engines have bad Context Class
> > Loader (Like Tomcat3.2.3)
> > +         * Since by definition, The  Class Loader that
> > loaded this Servlet should be
> > +         * the Context Class Loader, We set the Context
> > Class Loader explicity.
> > +         */
> > +        try {
> > +
> > Thread.currentThread().setContextClassLoader(AxisServlet.class
> > .getClassLoader());
> > +        } catch (Exception e){}
> > +
> >          String param = getInitParameter("transport.name");
> >          ServletContext context =
> > getServletConfig().getServletContext();
> >
> > @@ -108,6 +117,20 @@
> >          if ((param != null) && (param.equalsIgnoreCase("true"))) {
> >              securityProvider = new ServletSecurityProvider();
> >          }
> > +    }
> > +
> > +    public void service(HttpServletRequest req,
> > HttpServletResponse res)
> > +    throws ServletException, IOException {
> > +        /*
> > +         * HACK: Some Servlet Engines have bad Context Class
> > Loader (Like Tomcat3.2.3)
> > +         * Since by definition, The  Class Loader that
> > loaded this Servlet should be
> > +         * the Context Class Loader, We set the Context
> > Class Loader explicity.
> > +         */
> > +        try {
> > +
> > Thread.currentThread().setContextClassLoader(AxisServlet.class
> > .getClassLoader());
> > +        } catch (Exception e){}
> > +
> > +        super.service(req,res);
> >      }
> >
> >      public AxisServer getEngine() {
> > --------------------------------------- CUT HERE
> > -------------------------------------------------
> >
> >
> > =====
> > Davanum Srinivas, JNI-FAQ Manager
> > http://www.jGuru.com/faq/JNI
> >
> > __________________________________________________
> > Do You Yahoo!?
> > NEW from Yahoo! GeoCities - quick and easy web site hosting,
> > just $8.95/month.
> > http://geocities.yahoo.com/ps/info1
> >