You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Tandel Sascha <sa...@tandel-online.com> on 2007/12/20 19:58:33 UTC
[T5] Dynamic created bean class not found
Hello all,
First of all i'm using Tapestry 5.0.7.
In a project i have to generate beans for use in grid and beanEditor
on the fly because the underlying class ist not a bean. The with
javassist generated bean simply delegates all calls. To use this bean
as source for the grid component i have written a ClassTransformWorker
(contributed as "before:Inject*") which generates getter/setter and a
custom beanModel. This works fine. Now i want the current row to get
stored in a property to add links etc.
I tried to use my generated bean as return type (the setter works
fine):
TransformMethodSignature sig =
new TransformMethodSignature(Modifier.PRIVATE,
"myGeneratedBean",
"getCurrentRow", null, null);
transformation.addMethod(sig, "return row;");
This always throws a ClassNotFoundException for myGeneratedBean. But
all class loaders (ClassPool.getDefault().get(), Class.forName()) do
find this class. Is this a bug in the ClassTransformWorker or am i
missing something?
Is there a other solution? I first though TypeCoerceing could solve
this but i do not know how to add a coercer at runtime. I'm open for
all suggestions ;)
Thanks in advance
Sascha Tandel
Re: [T5] Dynamic created bean class not found
Posted by Tandel Sascha <sa...@tandel-online.com>.
Thanks Howard!
Even when didn't understand my explantion ;) your hint for
ClassFactory worked. Before i created the bean class with plain
javassist and so bypassed the tapestry classloader i think. With
ClassFactory it works.
I think i have to take a much deeper look in to the docs then i
thought. ;)
Cheers
Am 20.12.2007 um 20:42 schrieb Howard Lewis Ship:
> I'm having trouble getting a handle on what you are trying to
> accomplish, and where you have gone wrong. Generally, when creating
> entirely new classes, you do this by injecting the @ComponentLayer
> ClassFactory service.
>
> On Dec 20, 2007 10:58 AM, Tandel Sascha <sa...@tandel-online.com>
> wrote:
>> Hello all,
>>
>>
>> First of all i'm using Tapestry 5.0.7.
>>
>> In a project i have to generate beans for use in grid and beanEditor
>> on the fly because the underlying class ist not a bean. The with
>> javassist generated bean simply delegates all calls. To use this bean
>> as source for the grid component i have written a
>> ClassTransformWorker
>> (contributed as "before:Inject*") which generates getter/setter and a
>> custom beanModel. This works fine. Now i want the current row to get
>> stored in a property to add links etc.
>>
>> I tried to use my generated bean as return type (the setter works
>> fine):
>>
>> TransformMethodSignature sig =
>> new TransformMethodSignature(Modifier.PRIVATE,
>> "myGeneratedBean",
>> "getCurrentRow", null, null);
>> transformation.addMethod(sig, "return row;");
>>
>> This always throws a ClassNotFoundException for myGeneratedBean. But
>> all class loaders (ClassPool.getDefault().get(), Class.forName()) do
>> find this class. Is this a bug in the ClassTransformWorker or am i
>> missing something?
>>
>> Is there a other solution? I first though TypeCoerceing could solve
>> this but i do not know how to add a coercer at runtime. I'm open for
>> all suggestions ;)
>>
>> Thanks in advance
>>
>> Sascha Tandel
>>
>>
>>
>
>
>
> --
> Howard M. Lewis Ship
> TWD Consulting, Inc.
>
> Creator Apache Tapestry and Apache HiveMind
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5] Dynamic created bean class not found
Posted by Howard Lewis Ship <hl...@gmail.com>.
I'm having trouble getting a handle on what you are trying to
accomplish, and where you have gone wrong. Generally, when creating
entirely new classes, you do this by injecting the @ComponentLayer
ClassFactory service.
On Dec 20, 2007 10:58 AM, Tandel Sascha <sa...@tandel-online.com> wrote:
> Hello all,
>
>
> First of all i'm using Tapestry 5.0.7.
>
> In a project i have to generate beans for use in grid and beanEditor
> on the fly because the underlying class ist not a bean. The with
> javassist generated bean simply delegates all calls. To use this bean
> as source for the grid component i have written a ClassTransformWorker
> (contributed as "before:Inject*") which generates getter/setter and a
> custom beanModel. This works fine. Now i want the current row to get
> stored in a property to add links etc.
>
> I tried to use my generated bean as return type (the setter works
> fine):
>
> TransformMethodSignature sig =
> new TransformMethodSignature(Modifier.PRIVATE,
> "myGeneratedBean",
> "getCurrentRow", null, null);
> transformation.addMethod(sig, "return row;");
>
> This always throws a ClassNotFoundException for myGeneratedBean. But
> all class loaders (ClassPool.getDefault().get(), Class.forName()) do
> find this class. Is this a bug in the ClassTransformWorker or am i
> missing something?
>
> Is there a other solution? I first though TypeCoerceing could solve
> this but i do not know how to add a coercer at runtime. I'm open for
> all suggestions ;)
>
> Thanks in advance
>
> Sascha Tandel
>
>
>
--
Howard M. Lewis Ship
TWD Consulting, Inc.
Creator Apache Tapestry and Apache HiveMind
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5] Dynamic created bean class not found
Posted by jo...@progs.be.
Are you running inside an application server?
You want need to configure javassist to use the context classloader.
See http://blog.progs.be/?p=52
Kind regards,
Joachim
Tandel Sascha <sa...@tandel-online.com> wrote:
> Hello all,
>
>
> First of all i'm using Tapestry 5.0.7.
>
> In a project i have to generate beans for use in grid and beanEditor
> on the fly because the underlying class ist not a bean. The with
> javassist generated bean simply delegates all calls. To use this bean
> as source for the grid component i have written a ClassTransformWorker
> (contributed as "before:Inject*") which generates getter/setter and a
> custom beanModel. This works fine. Now i want the current row to get
> stored in a property to add links etc.
>
> I tried to use my generated bean as return type (the setter works
> fine):
>
> TransformMethodSignature sig =
> new TransformMethodSignature(Modifier.PRIVATE,
> "myGeneratedBean",
> "getCurrentRow", null, null);
> transformation.addMethod(sig, "return row;");
>
> This always throws a ClassNotFoundException for myGeneratedBean. But
> all class loaders (ClassPool.getDefault().get(), Class.forName()) do
> find this class. Is this a bug in the ClassTransformWorker or am i
> missing something?
>
> Is there a other solution? I first though TypeCoerceing could solve
> this but i do not know how to add a coercer at runtime. I'm open for
> all suggestions ;)
>
> Thanks in advance
>
> Sascha Tandel
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org