3 Replies Latest reply on Sep 10, 2004 4:35 AM by nthx

    java.lang.ClassCastException in Forum_new_$aop

      Hi.

      Don't know where to find cause of error:

       [java] java.lang.ClassCastException
       [java] at org.nthx.pat.demo.Forum.Forum_new_$aop(Unknown Source)
       [java] at org.nthx.pat.demo.Driver.main(Unknown Source)
       [java] Exception in thread "main"
      


      Decompiled Forum.class:
      public class Forum
       implements Advised, PrevalentSystem, IdentityMap, BusinessObject, Identificable, Persistable
      {
      ....
       public static Forum Forum_new_$aop()
       {
       if(((Advisor) (aop$classAdvisor$aop)).doesHaveAspects)
       return (Forum)aop$classAdvisor$aop.invokeNew((Object[])null, 0);
       else
       return new Forum();
       }
      


      Client's code for creating Forum:
      public class RootCreationInterceptor
      {
       public Object invoke(Invocation invocation)
       throws Throwable
       {
       ConstructorInvocation ci = (ConstructorInvocation) invocation;
       String patRootClassName = ci.getConstructor().getName();
       Class classOfPatRoot = Class.forName(patRootClassName);
       PrevalentSystem root = (PrevalentSystem) classOfPatRoot.newInstance();
      
      .....
      
      public class Driver
      {
      
       public static void main(String[] args)
       {
       Forum forum = new Forum();
       log.debug("-= Finished creating Forum object =-");
      
      jboss-aop.xml:
      <bind pointcut="execution(*->@pat.root(..))">
       <interceptor class="org.nthx.pat.RootCreationInterceptor" />
      </bind>
      


      JBossAOP version is CVS 10.08.2004 version. Modified not to create _transient_ mixin fields.

      Help!

      Tomasz

      ps. Can attach full source code if needed