1 2 Previous Next 17 Replies Latest reply on Mar 23, 2005 2:20 PM by mikeg123

    IllegalAccessError when intercepting using

    mikeg123 Newbie

      hello.

      using jboss-3.2.6 and jboss-aop_1.0.0-FINAL

      i'm trying to to intercept a call to the protected method in the superclass from the concrete class, so here is my call

      bind pointcut="call( * com.com1.com2.BaseClass->method1(..))"
      advice name="method" aspect="MyAspect"/
      /bind

      first of this doesn't insert any interceptors on the calling concrete class, so I have to change to something like

      bind pointcut="call( * com.com1.*->method1(..))"
      advice name="adviceMethod" aspect="MyAspect"/
      /bind

      then when I run it I get inside of the advice adviceMethod, but then when it calls invocation.invokeNext(), I get the following exception (IllegalAccessError)

      stack trace:


      //////////////////////////////////
      2005-03-22 16:58:22,439 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackLocalException in method: public abstract void com.crossbeamsys.nms.status.DeviceStatusManagerLocal.clearDeviceAlarms(com.crossbeamsys.nms.device.DeviceDO) throws com.crossbeamsys.nms.NMSException, causedBy:
      javax.ejb.EJBException: Unexpected Error

      java.lang.IllegalAccessError: tried to access method com.crossbeamsys.nms.support.SessionBeanBase.checkDeviceAccess(JJ)V from class com.crossbeamsys.nms.status.DeviceStatusManagerBean_4_MByMInvocation
      at com.crossbeamsys.nms.status.DeviceStatusManagerBean_4_MByMInvocation.invokeNext(DeviceStatusManagerBean_4_MByMInvocation.java)
      at com.crossbeamsys.nms.aop.AuditAspect.auditMethod(AuditAspect.java:125)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.aop.advice.PerInstanceAdvice.invoke(PerInstanceAdvice.java:58)
      at com.crossbeamsys.nms.status.DeviceStatusManagerBean_4_MByMInvocation.invokeNext(DeviceStatusManagerBean_4_MByMInvocation.java)
      at com.crossbeamsys.nms.status.DeviceStatusManagerBean.clearDeviceAlarms(DeviceStatusManagerBean.java:737)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:315)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:148)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:111)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
      at org.jboss.ejb.Container.invoke(Container.java:709)
      at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:419)
      at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:83)
      at $Proxy87.clearDeviceAlarms(Unknown Source)
      at com.crossbeamsys.nms.device.DeviceManagerBean.deleteDeviceImpl(DeviceManagerBean.java:2304)
      at com.crossbeamsys.nms.device.DeviceManagerBean.deleteDevice(DeviceManagerBean.java:304)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:315)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:148)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:111)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
      at org.jboss.ejb.Container.invoke(Container.java:709)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:62)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:54)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:82)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:197)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:360)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:534)

      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:182)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:315)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:148)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:111)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
      at org.jboss.ejb.Container.invoke(Container.java:709)
      at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:419)
      at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:83)
      at $Proxy87.clearDeviceAlarms(Unknown Source)
      at com.crossbeamsys.nms.device.DeviceManagerBean.deleteDeviceImpl(DeviceManagerBean.java:2304)
      at com.crossbeamsys.nms.device.DeviceManagerBean.deleteDevice(DeviceManagerBean.java:304)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:315)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:148)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:111)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
      at org.jboss.ejb.Container.invoke(Container.java:709)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:62)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:54)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:82)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:197)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:360)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:534)
      2005-03-22 16:58:2


      PLease help

        • 1. Re: IllegalAccessError when intercepting using
          Bill Burke Master

          you should be using $instanceof{com.com1.com2.BaseClass}->method1(..).

          I need more help diagnosing this problem.

          So auditMethod() calls a protected method of its superclass?

          public class Base {
          protected void method1() {}
          }

          public class Concrete extends Base {

          public void auditMethod() {
          method1(); /********** THIS DOESNT WORK??? ****/
          }
          }

          • 2. Re: IllegalAccessError when intercepting using
            mikeg123 Newbie

            Hello,
            thank you for the reply,

            I tried instanceof and typedef(Base.class) with no success. (what is the best setup (jboss-aop.xml) whould you recommend for the following scenario)

            here the set up:

            public class Base {
            protected void method1() {}
            }

            public class Concrete extends Base {

            public void myMethod() {
            method1();
            }
            }

            public MyAspect {

            public Object auditMethod (MethodCalledByMethodInvocation invocation) throws Throwable {
            //do some loogging

            return invocation.invokeNext();
            }
            }


            so when "method1" is being called from the Concrete.class I get inside of the "auditMethod" in MyAspect.class and then when it calls invokeNext() I expect to be in the "method1" of the Base.class instead I get IllegalAccessError exception.


            Thank you, Michael

            • 3. Re: IllegalAccessError when intercepting using
              Bill Burke Master

              ok, that helps a lot with diagnosis. I'll try to reproduce with JBoss AOP 1.1.1 and get back to you.

              BTW, why are you using 1.0? Does 1.1.1 not work with 3.2.x?

              Ok, now the XML that should work should be

              <bind pointcut="call(void $instanceof{Base}->method1())">
               <advice name="auditMethod" aspect="MyAspect"/>
              </bind>
              
              
              
              Let me see if I can get this to work though! There probably is a bug.
              
              Bill
              


              • 4. Re: IllegalAccessError when intercepting using
                mikeg123 Newbie

                Hi

                1.1.1 and 1.1.0 don't work with 3.2.6, when you use Aspect and it's trying to load a class from one of the aop jar files that class calls a method on a super class from jboss package and this method doesn't exists, also you can not use "VM" or "CLASS" scope because RepositoryClassLoader.class is not in the jboss-jmx.jar

                Thank you, Michael

                • 5. Re: IllegalAccessError when intercepting using
                  Bill Burke Master

                  Ok, I could not reproduce this on AOP 1.1.1. Let's see if we can get you up and running with JBoss 3.2.6 and AOP 1.1.1.

                  Did you follow these instructions?

                  http://docs.jboss.org/aop/1.1/aspect-framework/reference/en/html/running.html#jboss32

                  Specifically using AspectManagerService32?

                  • 6. Re: IllegalAccessError when intercepting using
                    mikeg123 Newbie

                    Hello
                    are you using jboss-common.jar and concurrent.jar that come with 3.2.6 or you are using it from aop-1.1.1 because jboss-common.jar files are different?

                    • 7. Re: IllegalAccessError when intercepting using
                      mikeg123 Newbie

                      all I did was copied jar files from jboss-32-install dir (4 files)

                      • 8. Re: IllegalAccessError when intercepting using
                        mikeg123 Newbie

                        I'm sorry for writing in a separate window, but yes I did follow the instructions to setup jboss-service.xml and etc.

                        • 9. Re: IllegalAccessError when intercepting using
                          mikeg123 Newbie

                          here is what I get running with 1.1.1

                          005-03-23 11:04:42,843 DEBUG [net.sf.hibernate.engine.CacheSynchronization] transaction after completion callback, status: 4
                          2005-03-23 11:04:42,843 DEBUG [net.sf.hibernate.impl.SessionImpl] transaction completion
                          2005-03-23 11:04:42,843 ERROR [org.jboss.ejb.plugins.LogInterceptor] Unexpected Error in method: public abstract void com.crossbeamsys.nms.device.DeviceManager.deleteGroup(java.lang.String) throws com.crossbeamsys.nms.NMSException,java.rmi.RemoteException

                          java.lang.NoSuchMethodError: org.jboss.aop.joinpoint.MethodCalledByMethodInvocation.([Lorg/jboss/aop/advice/Interceptor;Ljava/lang/reflect/Method;[Ljava/lang/Object;Ljava/lang/Class;J)V
                          at com.crossbeamsys.nms.device.DeviceManagerBean_3_MByMInvocation.(DeviceManagerBean_3_MByMInvocation.java)
                          at com.crossbeamsys.nms.device.DeviceManagerBean.deleteGroup(DeviceManagerBean.java:1075)
                          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                          at java.lang.reflect.Method.invoke(Method.java:324)
                          at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
                          at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
                          at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
                          at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
                          at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:315)
                          at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:148)
                          at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:111)
                          at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
                          at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
                          at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
                          at org.jboss.ejb.Container.invoke(Container.java:709)
                          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                          at java.lang.reflect.Method.invoke(Method.java:324)
                          at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
                          at org.jboss.mx.server.Invocation.dispatch(Invocation.java:62)
                          at org.jboss.mx.server.Invocation.dispatch(Invocation.java:54)
                          at org.jboss.mx.server.Invocation.invoke(Invocation.java:82)
                          at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:197)
                          at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
                          at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:360)
                          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                          at java.lang.reflect.Method.invoke(Method.java:324)
                          at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
                          at sun.rmi.transport.Transport$1.run(Transport.java:148)
                          at java.security.AccessController.doPrivileged(Native Method)
                          at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
                          at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
                          at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
                          at java.lang.Thread.run(Thread.java:534)
                          2005-03-23 11:04:50,687 DEBUG [com.crossbeamsys.nms.config.ConfigManagerBean] ConfigManagerBean.ejbCreate()
                          2005-03-23 11:04:50,687 DEBUG [net.sf.hibernate.impl.SessionFactoryObjectFactory] JNDI lookup: hibernate/NMSSessionFactory
                          2005-03-23 11:04:50,687 DEBUG [net.sf.hibernate.impl.SessionFactoryObjectFactory] lookup: uid=8a81817002d027d60102d027de0e0000
                          2005-03-23 11:04:50,687 DEBUG [net.sf.hibernate.impl.SessionImpl] opened session

                          • 10. Re: IllegalAccessError when intercepting using
                            Bill Burke Master

                            you are using AOPC correct?

                            Did you remove all classfiles, recomple, and re-aopc before trying out AOP 1.1.1?

                            • 11. Re: IllegalAccessError when intercepting using
                              mikeg123 Newbie

                              absolutely, I did all of the menitoned steps!
                              so I guess I don't need to care about the jboss-common.jar, correct?

                              • 12. Re: IllegalAccessError when intercepting using
                                Bill Burke Master

                                if you could put together a small test using AOPC, AOP 1.1.1 and JBoss 3.2.6 that reproduces the problem that would be cool. Otherwise, you'll have to wait until I've got the time.

                                • 13. Re: IllegalAccessError when intercepting using
                                  mikeg123 Newbie

                                  Hi,
                                  I'll try to do it at some point, but I was able to get going with 1.1.1, the problem was that in was picking up the older version of jboss-aop.jar in the eclipse plugin, but still when running, I get IllegalAccessError, it almost seems like byte code some how gets out of sync:

                                  RemoteException occurred in server thread; nested exception is:
                                  java.rmi.ServerError: Unexpected Error:; nested exception is:
                                  java.lang.IllegalAccessError: tried to access method com.crossbeamsys.nms.support.SessionBeanBase.getCurrentUser()Lcom/crossbeamsys/nms/user/UserDO; from class com.crossbeamsys.nms.device.DeviceManagerBean_3_MByMInvocation

                                  • 14. Re: IllegalAccessError when intercepting using
                                    Bill Burke Master

                                    can you try outside of eclipse?

                                    1 2 Previous Next