tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Funk <funk...@joedog.org>
Subject Re: precompilation trouble
Date Mon, 17 Jan 2005 18:44:25 GMT
Oops, my bad. Forget newInstance() being called. But the line:
Class bean = ctxt.getClassLoader().loadClass(klass);

I believe does force my previous static statements to hold true.

-Tim

Marcus Beyer wrote:

> Tim Funk schrieb:
> 
>> Ahh. Here is your issue:
>>
>> if (beanName == null) {
>>     try {
>>         Class bean = ctxt.getClassLoader().loadClass(klass);
>>         int modifiers = bean.getModifiers();
>>         if (!Modifier.isPublic(modifiers) ||
>>             Modifier.isInterface(modifiers) ||
>>             Modifier.isAbstract(modifiers)) {
>>             throw new Exception("Invalid bean class modifier");
>>         }
>>         // Check that there is a 0 arg constructor
>>         bean.getConstructor(new Class[] {});
>>         generateNew = true;
>>     } catch (Exception e) {
>>         // Cannot instantiate the specified class
>>         if (ctxt.getOptions().getErrorOnUseBeanInvalidClassAttribute()) {
>>             err.jspError(n, "jsp.error.invalid.bean", klass);
>>         }
>>     }
>> }
>>
>> At compile time - jasper is checking that the default constructor of a 
>> bean may be invoked. By invoking the constructor at compile time - the 
>> class is loaded by the JVM. This will in turn cause the JVM to call 
>> any static initializers. (In which you have)
> 
> 
> Hmm, were is that code is an invokation of a constructor? As far as I 
> can see Jasper just checks if a zero argument constructor exists.
> 
> And why does Jasper instantiate beans? Just to check if it is possible 
> to instantiate them, or does Jasper do something with the beans?
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message