You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Dain Sundstrom <da...@iq80.com> on 2006/02/14 23:15:19 UTC

Re: [cglib-devel] IllegalAccessError in fastclass

I'm copying Geronimo dev on this so, Jason Dillon can respond with  
more specifics.  To get the ball rolling, here is the top of the  
stack trace we are seeing:

java.lang.IllegalAccessError: tried to access class
org.springframework.ejb.support.AbstractEnterpriseBean from class
com.solidusnetworks.paycore.ach.model.merchant.service.MerchantViewServi 
ceBean$$FastClassByCGLIB$$e322b03a
         at  
com.solidusnetworks.paycore.ach.model.merchant.service.MerchantViewServi 
ceBean$$FastClassByCGLIB$$e322b03a.invoke(<generated>)
         at org.openejb.dispatch.AbstractMethodOperation.invoke 
(AbstractMethodOperation.java:90)
         at org.openejb.slsb.RemoveMethod.execute(RemoveMethod.java:69)
         at org.openejb.dispatch.DispatchInterceptor.invoke 
(DispatchInterceptor.java:72)

The target bean is MerchantViewServiceBean and the method we are  
calling is ejbRemote(), which is part of the javax.ejb.SessionBean  
interface.  MerchantViewServiceBean does not have its own ejbRemote 
(), it picks it up from AbstractStatelessSessionBean (from app),  
which picks it up from AbstractStatelessSessionBean (from spring).

-dain

On Feb 14, 2006, at 1:10 PM, Chris Nokleberg wrote:

> On Tue, Feb 14, 2006 at 12:31:45PM -0800, Dain Sundstrom wrote:
>> I'm getting an IllegalAccessError when using fastclass to invoke a
>> method on an instance where the method is inherited from a parent  
>> class.
>
> This works in general, so it must be something particular about your
> child/parent classes. What is the method declaration, and the
> package/access of the respective classes?
>
> Chris
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through  
> log files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD  
> SPLUNK!
> http://sel.as-us.falkag.net/sel? 
> cmd=lnk&kid=103432&bid=230486&dat=121642
> _______________________________________________
> cglib-devel mailing list
> cglib-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/cglib-devel


Re: [cglib-devel] IllegalAccessError in fastclass

Posted by Chris Nokleberg <ch...@sixlegs.com>.
On Tue, 14 Feb 2006 18:16:24 -0800, Jason Dillon wrote:
> I've added definitions for ejbRemove() which call super.ejbRemove() to
> get around this.  Do you know when the fix will make it into a CGLIB
> release that would be usable by G?

CGLIB CVS HEAD has the necessary fixes now. We'll probably cut a release
pretty soon but feel free to build your own jar and test it out.

Chris



Re: [cglib-devel] IllegalAccessError in fastclass

Posted by Jason Dillon <ja...@planet57.com>.
Weird... I did not notice that
org.springframework.ejb.support.AbstractSessionBean was package
private.  It makes a little sense that is is package private because
you only expect users to extend from one of its direct subclasses for
MDB or a SB.

Thanks for taking a look :-)

I've added definitions for ejbRemove() which call super.ejbRemove() to
get around this.  Do you know when the fix will make it into a CGLIB
release that would be usable by G?

--jason


On 2/14/06, Chris Nokleberg <ch...@sixlegs.com> wrote:
> > >On Tue, Feb 14, 2006 at 12:31:45PM -0800, Dain Sundstrom wrote:
> > >>I'm getting an IllegalAccessError when using fastclass to invoke a
> > >>method on an instance where the method is inherited from a parent
> > >>class.
>
> I've reproduced the bug. It is caused because the method is actually
> defined in a non-public class in another package: the public class
> org.springframework.ejb.support.AbstractStatelessSessionBean extends the
> non-public class org.springframework.ejb.support.AbstractSessionBean.
> IMHO this is kind of weird on Spring's part, but nonetheless it has
> exposed a bug in FastClass, which is calling invokevirtual on the
> ancestor class instead of the derived class.
>
> The workaround, as you have discovered, is to redefine the method in the
> derived class, even if it is just to call super.ejbRemove().
>
> Some other parts of CVS HEAD are in transition now (the
> MethodInterceptor startup optimizations) so even after I fix this bug
> you'll have to wait a little while. I'll let you know when there is a
> new version to test.
>
> Thanks,
> Chris
>
>

Re: [cglib-devel] IllegalAccessError in fastclass

Posted by Chris Nokleberg <ch...@sixlegs.com>.
> >On Tue, Feb 14, 2006 at 12:31:45PM -0800, Dain Sundstrom wrote:
> >>I'm getting an IllegalAccessError when using fastclass to invoke a
> >>method on an instance where the method is inherited from a parent  
> >>class.

I've reproduced the bug. It is caused because the method is actually
defined in a non-public class in another package: the public class
org.springframework.ejb.support.AbstractStatelessSessionBean extends the
non-public class org.springframework.ejb.support.AbstractSessionBean.
IMHO this is kind of weird on Spring's part, but nonetheless it has
exposed a bug in FastClass, which is calling invokevirtual on the
ancestor class instead of the derived class.

The workaround, as you have discovered, is to redefine the method in the
derived class, even if it is just to call super.ejbRemove().

Some other parts of CVS HEAD are in transition now (the
MethodInterceptor startup optimizations) so even after I fix this bug
you'll have to wait a little while. I'll let you know when there is a
new version to test.

Thanks,
Chris