0 Replies Latest reply on May 16, 2009 2:54 AM by gunaranjanc

    Class Cast Exception when AOP enabled

      Hi All,
      I am trying AOP in an application running on JBOSS 5.01 GA. The application has some JBPM code. The process handler calls an EJB internally. When this call happens I get the below class cast exception. Any ideas?
      I have an AOP interceptor for all public methods (MethodInterceptor.java)

      I also have an ejb3 EJBInterceptor. I avoid AOP on the EJBInterceptor itself (using Joinpoint exclusion on its package). However the target EJB itself (all of them) is compiled for AOP and bound to the AOP based MethodInterceptor. Is this the problem and if so should I avoid the MethodInterceptor on ejbs - and just let the ejb3 EJBInterceptor handle them (Just need the simple AOP method-interceptor to kick in when they are invoked as POJOs though). Any advise?

      009-05-14 16:38:06,994 ERROR [STDERR] (WorkManager(2)-12) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
      2009-05-14 16:38:06,994 ERROR [STDERR] (WorkManager(2)-12) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
      2009-05-14 16:38:06,994 ERROR [STDERR] (WorkManager(2)-12) at java.lang.Thread.run(Thread.java:613)

      2009-05-14 16:38:06,994 ERROR [STDERR] (WorkManager(2)-12) Caused by: java.lang.ClassCastException: org.jboss.aop.joinpoint.MethodInvocation
      2009-05-14 16:38:06,995 ERROR [STDERR] (WorkManager(2)-12) at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:55)

      2009-05-14 16:38:06,995 ERROR [STDERR] (WorkManager(2)-12) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
      2009-05-14 16:38:06,995 ERROR [STDERR] (WorkManager(2)-12) at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
      2009-05-14 16:38:06,995 ERROR [STDERR] (WorkManager(2)-12) ... 189 more

      Guna