As a general principle, J2EE 1.4 (and later) requires app servers to make
the webapp's class loader available via the getContextClassLoader() call.
This feature is already supported by nearly every other server in the
world.  Therefore, I'd really recommend that the TriFork folks upgrade
their server to do the same.

Please don't make this change until we've had more time to evaluate it's
potential impacts.  I'm particularly concerned about the semantics of
Class.forName() versus the current approach that uses the class loader
that loaded RequestUtils itself.  That needs to be looked at more
carefully, particularly with respect to multi-class-loader hierarchies
like the one Tomcat 4 supports.

Craig


On Thu, 7 Nov 2002, James Mitchell wrote:

> Date: Thu, 7 Nov 2002 11:13:35 -0500
> From: James Mitchell <[EMAIL PROTECTED]>
> Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> To: Struts Developers List <[EMAIL PROTECTED]>
> Subject: [Vote] Modify classloading in RequestUtils
>
>
> Not sure if you caught the thread on the users list, or the bug recently
> posted by Kjeld Froberg:
>
>  http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14332
>
>
> Here's the proposed code change:
>
> RequestUtils.java
> -----------------------------------------------
> From:
>     public static Class applicationClass(String className)
>         throws ClassNotFoundException {
>
>         // Look up the class loader to be used
>         ClassLoader classLoader =
>             Thread.currentThread().getContextClassLoader();
>         if (classLoader == null) {
>             classLoader = RequestUtils.class.getClassLoader();
>         }
>
>         // Attempt to load the specified class
>         return (classLoader.loadClass(className));
>     }
> -----------------------------------------------
> To:
>     public static Class applicationClass(String className)
>         throws ClassNotFoundException {
>               ClassLoader ctxLoader = null;
>               try {
>                       ctxLoader = Thread.currentThread().getContextClassLoader();
>                       return Class.forName(className, true, ctxLoader);
>
>               } catch(ClassNotFoundException ex) {
>                       if(ctxLoader == null) { throw ex; }
>               } catch(SecurityException ex) {
>
>               }
>               return Class.forName(className);
>       }
>
> By changing these few lines, I am able to run the full test suite without
> error. (And that includes the new test.tomcat.33)
>
> I'm not sure if this should be a [Vote] or a [commit and wait till they
> complain], so I opted for the former.
>
> Even though I'm not truly sure of the consequences of this change, I'm +1.
>
>
> James Mitchell
> Software Engineer/Struts Evangelist
> http://www.open-tools.org
>
> "Only two things are infinite, the universe and human stupidity, and I'm not
> sure about the former."
> - Albert Einstein (1879-1955)
>
>
> --
> To unsubscribe, e-mail:   <mailto:struts-dev-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail: <mailto:struts-dev-help@;jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <mailto:struts-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-dev-help@;jakarta.apache.org>

Reply via email to