You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Fernando Donati <fe...@donati.com.br> on 2003/11/18 13:54:02 UTC
OGNL and Enhancing Classes problems
Hi,
could anyone please point me out where I can find something about
"enhancing classes" and how OGNL and Tapestry work together? I'm
getting this strange error.
thanks a lot,
fernando
org.apache.tapestry.ApplicationRuntimeException: Unable to update
expression "<parsed expression>" of
com.donati.tapestry.Exception@167c6fd[Exception] to
org.apache.tapestry.ApplicationRuntimeException: A code generation
error occured while enhancing class
org.apache.tapestry.components.Insert..
at org.apache.tapestry.util.prop.OgnlUtils.set(OgnlUtils.java:146)
at org.apache.tapestry.util.prop.OgnlUtils.set(OgnlUtils.java:125)
at
org.apache.tapestry.AbstractComponent.setProperty(AbstractComponent.java
:1157)
at
org.apache.tapestry.engine.AbstractEngine.activateExceptionPage(Abstract
Engine.java:497)
at
org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:95
4)
Re: OGNL and Enhancing Classes problems
Posted by Gereon Fassbender <gf...@startext.de>.
> to read or update the property. It is also valid to just implement one
> of the two accessors. The enhanced subclass will always include both a
> read and a write accessor.
I have a problem with exactly this part of the documentation. I defined a
property in the .jwc and implemented the get-method. But I get an error that
the component can't be enhanced because the read method is implemented.
Is it possible that this excerpt of the documentation is just wrong?
Or otherwise where can I find a working example?
Thanks,
Gereon
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: OGNL and Enhancing Classes problems
Posted by Paul Ferraro <pm...@columbia.edu>.
Actually, that is not true. Here's an exerpt from the User Guide:
You may also, optionally, make your class abstract, and define abstract
accessor methods that will be filled in by Tapestry in the generated
subclass. This allows you to read and update properties inside your
class, inside listener methods.
...
Again, making the class abstract, and defining abstract accessors is
/optional/. It is only useful when a method within the class will need
to read or update the property. It is also valid to just implement one
of the two accessors. The enhanced subclass will always include both a
read and a write accessor.
John Meredith wrote:
>Tapestry can only enhance abstract classes, so that'd be the first thing
>I'd check.
>
> - John
>
>On Tue, 2003-11-18 at 13:54, Fernando Donati wrote:
>
>
>>Hi,
>>
>>could anyone please point me out where I can find something about
>>"enhancing classes" and how OGNL and Tapestry work together? I'm
>>getting this strange error.
>>
>>thanks a lot,
>>
>>fernando
>>
>>org.apache.tapestry.ApplicationRuntimeException: Unable to update
>>expression "<parsed expression>" of
>>com.donati.tapestry.Exception@167c6fd[Exception] to
>>org.apache.tapestry.ApplicationRuntimeException: A code generation
>>error occured while enhancing class
>>org.apache.tapestry.components.Insert..
>>at org.apache.tapestry.util.prop.OgnlUtils.set(OgnlUtils.java:146)
>>at org.apache.tapestry.util.prop.OgnlUtils.set(OgnlUtils.java:125)
>>at
>>org.apache.tapestry.AbstractComponent.setProperty(AbstractComponent.java
>>:1157)
>>at
>>org.apache.tapestry.engine.AbstractEngine.activateExceptionPage(Abstract
>>Engine.java:497)
>>at
>>org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:95
>>4)
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: OGNL and Enhancing Classes problems
Posted by Fernando Donati <fe...@donati.com.br>.
After quite a bit of tampering, I managed to find the problem that is
generating this error. The class
org.apache.tapestry.enhance.javassist.ClassMapping, in its initialize
method, is trying to load several distinct types, here's an excerpt:
try
{
loadType("boolean[]");
loadType("short[]");
loadType("int[]");
loadType("long[]");
loadType("float[]");
loadType("double[]");
loadType("char[]");
loadType("byte[]");
loadType("java.lang.Object");
loadType("java.lang.Object[]");
loadType("java.lang.String");
loadType("java.lang.String[]");
}
catch (NotFoundException e)
{
// This exception should not occur since the types above
must exist.
// Nevertheless...
throw new CodeGenerationException(e);
}
It works fine until loadType("java.lang.Object"); when the exception
that should not occur occurs and a CodeGenerationException is thrown.
In the loadType method, the problem occurs when getting the type from
the pool:
public void loadType(String type) throws NotFoundException
{
CtClass objectType = _classPool.get(type);
_objectTypeMap.put(type, objectType);
}
(This _classPool is a javassist classPool. )
Any ideas of what's going on? Is this a permission problem? If so what
permission should be granted to the javassist jar? Is this a classpath
problem?
As always, any help is greatly appreciated.
tks,
fernando
On Tuesday, November 18, 2003, at 11:27 AM, John Meredith wrote:
> Tapestry can only enhance abstract classes, so that'd be the first
> thing
> I'd check.
>
> - John
>
> On Tue, 2003-11-18 at 13:54, Fernando Donati wrote:
>> Hi,
>>
>> could anyone please point me out where I can find something about
>> "enhancing classes" and how OGNL and Tapestry work together? I'm
>> getting this strange error.
>>
>> thanks a lot,
>>
>> fernando
>>
>> org.apache.tapestry.ApplicationRuntimeException: Unable to update
>> expression "<parsed expression>" of
>> com.donati.tapestry.Exception@167c6fd[Exception] to
>> org.apache.tapestry.ApplicationRuntimeException: A code generation
>> error occured while enhancing class
>> org.apache.tapestry.components.Insert..
>> at org.apache.tapestry.util.prop.OgnlUtils.set(OgnlUtils.java:146)
>> at org.apache.tapestry.util.prop.OgnlUtils.set(OgnlUtils.java:125)
>> at
>> org.apache.tapestry.AbstractComponent.setProperty(AbstractComponent.ja
>> va
>> :1157)
>> at
>> org.apache.tapestry.engine.AbstractEngine.activateExceptionPage(Abstra
>> ct
>> Engine.java:497)
>> at
>> org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:
>> 95
>> 4)
> --
> John Meredith <ps...@t-online.de>
> <signature.asc>
Re: OGNL and Enhancing Classes problems
Posted by John Meredith <ps...@t-online.de>.
Tapestry can only enhance abstract classes, so that'd be the first thing
I'd check.
- John
On Tue, 2003-11-18 at 13:54, Fernando Donati wrote:
> Hi,
>
> could anyone please point me out where I can find something about
> "enhancing classes" and how OGNL and Tapestry work together? I'm
> getting this strange error.
>
> thanks a lot,
>
> fernando
>
> org.apache.tapestry.ApplicationRuntimeException: Unable to update
> expression "<parsed expression>" of
> com.donati.tapestry.Exception@167c6fd[Exception] to
> org.apache.tapestry.ApplicationRuntimeException: A code generation
> error occured while enhancing class
> org.apache.tapestry.components.Insert..
> at org.apache.tapestry.util.prop.OgnlUtils.set(OgnlUtils.java:146)
> at org.apache.tapestry.util.prop.OgnlUtils.set(OgnlUtils.java:125)
> at
> org.apache.tapestry.AbstractComponent.setProperty(AbstractComponent.java
> :1157)
> at
> org.apache.tapestry.engine.AbstractEngine.activateExceptionPage(Abstract
> Engine.java:497)
> at
> org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:95
> 4)
--
John Meredith <ps...@t-online.de>