Stefano--

Glad to hear you guys are finding it useful.  Forehead got sunsetted
pretty quickly though and has been replaced by Classworlds which has
slightly more robust concepts and also supports the 'uber-jar' for
running a complete app from a standalone jar and no external dependencies.

I'll be glad to integrate your change into forehead but you might find
classworlds a better solution overall.  (Though, it too may suffer from
this reflection issue).

Anyhow, http://classworlds.werken.com/ or 'maven uberjar' if you guys
are using maven.

        -bob


On Thu, 27 Feb 2003, Stefano Mazzocchi wrote:

> Bob,
> 
> Cocoon is using Forehead to bootstrap its services. We found a weird 
> problem related to JDK 1.3.1 which is probably a JDK bug that was fixed 
> on 1.4.1.
> 
> This is related to the fact that the entry point class we call extends 
> another class that exposes a main() method. It seems that Forehead calls 
> the right method, but JDK 1.3.1 invoques the method of the super class 
> instead of the one of the extending class.
> 
> I found out that if I modify the Forehead.run() method like the following:
> 
>      public void run(String[] args)
>         throws
>             NoSuchMethodException,
>             IllegalAccessException,
>             InvocationTargetException
>      {
>          Class[] method_param_types = new Class[1];
>          method_param_types[0] = args.getClass();
> 
>          Method main = 
> this.entryClass.getDeclaredMethod("main",method_param_types);
> 
>          Object[] method_params = new Object[1];
>          method_params[0] = args;
> 
>          Thread.currentThread().setContextClassLoader( this.entryLoader );
> 
>          main.invoke(null,method_params);
>      }
> 
> the problem goes away.
> 
> I'm recompiling forehead with this patch to include in Cocoon, but I'd 
> be happy to see this bug fixed in the main Forehead distribution.
> 
> Thanks.
> 
> -- 
> Stefano Mazzocchi                               <[EMAIL PROTECTED]>
>     Pluralitas non est ponenda sine necessitate [William of Ockham]
> --------------------------------------------------------------------
> 
> 

--
Bob McWhirter        [EMAIL PROTECTED]
The Werken Company   http://werken.com/

Reply via email to