cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <stef...@apache.org>
Subject problem with forehead
Date Thu, 27 Feb 2003 16:51:58 GMT
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                               <stefano@apache.org>
    Pluralitas non est ponenda sine necessitate [William of Ockham]
--------------------------------------------------------------------



Mime
View raw message