commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geoff Longman" <glong...@intelligentworks.com>
Subject Re: [Hivemind] IllegalAccessError constructing interceptor
Date Tue, 16 Mar 2004 03:29:10 GMT
Good golly, I'm just getting the hang of Javassist!

Thanks for the tip. Will have a look at CGLib when I have the Javassist
version working.

Geoff
----- Original Message -----
From: "Harish Krishnaswamy" <hkrishnaswamy@comcast.net>
To: "Jakarta Commons Developers List" <commons-dev@jakarta.apache.org>
Sent: Monday, March 15, 2004 10:22 PM
Subject: Re: [Hivemind] IllegalAccessError constructing interceptor


> Have you tried CGLib interceptors instead? I find it very simple write
> and easy to maintain at a very affordable performance cost. Just curious.
>
> -Harish
>
> Geoff Longman wrote:
>
> >I figured it out. While my Interceptor superclass was abstract, I missed
> >making it public.
> >
> >duh. I had to go into the java language spec to figure this one out:
> >
> >12.3.3 Resolution of Symbolic References
> >
> >IllegalAccessError: A symbolic reference has been encountered that
specifies
> >a use or assignment of a field, or invocation of a method, or creation of
an
> >instance of a class, to which the code containing the reference does not
> >have access because the field or method was declared private, protected,
or
> >default access (not public), or because the class was not declared
public.
> >
> >Geoff
> >----- Original Message -----
> >From: "Geoff Longman" <glongman@intelligentworks.com>
> >To: "Jakarta Commons Developers List" <commons-dev@jakarta.apache.org>
> >Sent: Monday, March 15, 2004 9:44 PM
> >Subject: [Hivemind] IllegalAccessError constructing interceptor
> >
> >
> >
> >
> >>Having a problem instantiating an Interceptor built in a factory using
> >>ClassFab.
> >>
> >>Maybe another set of eyes can see what I'm missing!
> >>
> >>Class serviceInterfaceClass = stack.getServiceInterface();
> >>
> >>String name = ClassFabUtils.generateClassName("Interceptor");
> >>ClassFab classFab =
> >>    fClassFactory.newClass(name, Interceptor.class,
> >>stack.getServiceModule());
> >>                                                    ^^^^^^^^^^^^ No
error
> >>here!
> >>
> >>classFab.addInterface(serviceInterfaceClass);
> >>classFab.addField("_inner", serviceInterfaceClass);
> >>
> >>... add constructor
> >>
> >>classFab.addConstructor(
> >>    new Class[] {
> >>    Log.class,
> >>    SessionLocalManager.class,
> >>    String.class,
> >>    serviceInterfaceClass },
> >>    null,
> >>    "{ super($1, $2, $3); _inner = $4; }");
> >>
> >>
> >>... add methods, then
> >>
> >>
> >>Class interceptorClass = classFab.createClass()
> >>
> >>Last line, createClass() throws the following exception when
> >>_loader.loadClass(className, bytecode); is called inside it.
> >>
> >>java.lang.IllegalAccessError: class $Interceptor_fb5181fe18_9 cannot
> >>
> >>
> >access
> >
> >
> >>its superclass com.iw.session.local.Interceptor
> >>
> >>But of course the factory can see Interceptor.class or I would never
have
> >>made it as past
> >>ClassFab classFab =  fClassFactory.newClass(.... at the top of the src
> >>above.
> >>
> >>Geoff
> >>
> >>Geoffrey Longman
> >>Intelligent Works Inc.
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >>
> >>
> >>
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


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


Mime
View raw message