tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Stevens <>
Subject getContextPath reflection tricks are broken
Date Thu, 15 Jun 2000 20:17:52 GMT
This is mostly a question for Craig/Costin.

I guess that the new facade stuff has broken a part of Turbine where we were
using a reflection hack to get around JSDK 2.0/2.2 issues. With the recent
facade stuff checked into Tomcat CVS, we cannot use this trick any longer
because the methods are not visible to us any longer.

Is there some way that this can be fixed in Tomcat to allow us to do the
trick? See below for more details about the problem.


From: Sean Legassick <>
Reply-To: "Turbine" <>
Date: Thu, 15 Jun 2000 20:10:33 +0000
To: Turbine <>
Subject: Re: reload fixes

On Thu, Jun 15, 2000 at 12:40:20PM -0700, Jon Stevens wrote:
> now, what was that other problem we were having with the latest CVS of
> tomcat/turbine?

The reflection trick in RunDataFactory to call getContextPath is broken
now because it is trying to reflect a package-visibility class

> what is the solution?

I dunno right now. If there's a clever way anyone knows of fixing the
reflection to work that would be best.

The workaround I'm using is to remove the reflection and call
getContextPath directly. However that won't compile with JSDK2.0, and it
doesn't seem to even run with JServ - although I would have thought the
'catch (Exception ex)' would cope (?)

My patch is below anyway, but I don't think it should be put in CVS...


RCS file: 
retrieving revision 1.12
diff -u -r1.12
--- 2000/05/24 17:22:06 1.12
+++ 2000/06/15 20:03:24
@@ -132,12 +132,9 @@
         // Allow Turbine to work with both 2.2 (and 2.1) and 2.0 Servlet
         String scriptName = null;
-        Class jsdkClass = req.getClass();
-            java.lang.reflect.Method meth =
-                jsdkClass.getDeclaredMethod("getContextPath", null);
-            scriptName = (String)meth.invoke(req, null);
+            scriptName = req.getContextPath();
         catch (Exception ex)
Sean Legassick

To subscribe:
To unsubscribe:
Search: <>

View raw message