Howard Lewis Ship wrote:
Are you using anything interesting, like loading modules from
different class loaders?
On 5/24/05, David J. M. Karlsen <[EMAIL PROTECTED]> wrote:
Hi list!
I'm trying to make an interceptor the same way as HM's
LoggingInterceptorFactory, but I have some problems with the following code:
private void createInfrastructure(InterceptorStack stack, ClassFab
classFab){
Class topClass = ClassFabUtils.getInstanceClass(stack.peek(),
stack.getServiceInterface());
classFab.addField("_delegate", topClass);
classFab.addConstructor(new Class[]{ topClass }, null, "{_delegate =
$1;}");
}
the debugger tells me topClass is: Class ($PooledProxy_1040f7af339_32)
which is the pooled instance of my real underlying class.
The function fails at line two, with this message:
Unable to process content of element construct/service: Unable to lookup
$PooledProxy_1040f7af339_32: $PooledProxy_1040f7af339_32
(DefaultErrorHandler.java:37)
I guess that this is beacuse topClass is no real class - but a dynamic
one - but the same should be true for the LoggingInterceptor - so I
cannot understand why this is a problem for my class ??
I posted a mail earlier with the same problem - and Knut's response:
"
The problem is a class loader issue. You're creating your own
ClassFactory instance, which in turn uses its own Javassist ClassPool,
which can't find the PooledProxy class HiveMind created using its own
ClassPool. You'll have to use HiveMind's ClassFactory.
For this you should define a setFactory(ClassFactory) method on your
interceptor factory and then add a line like this to the <construct>
of your interceptor factory service:
<set-service property="factory" service-id="hivemind.ClassFactory"/>
"
fixed the problem.
But I've fallen into a new one - on some methods I get this:
"
Unable to create class $Interceptor_1041511b5ba_38: (class:
$Interceptor_1041511b5ba_38, method: defaultIntValueOf signature:
(Ljava/lang/String;Ljava/lang/Object;I)I) Expecting to find object/array
on stack
"
which I posted on the same mail thread.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]