7 Replies Latest reply on Feb 6, 2008 10:54 PM by brian.stansberry

    Fails to run on  Jboss4.2.2

    emailmsgbox

      Hi,
      I want to switch from jboss4.0.4(jdk1.5) with jbossCache 1.4.0.SP1
      To jboss4.2.2(jdk1.5) (jbossCache 1.4.0.SP5)
      With the same code
      I use POJO-Cache and I do Post compile waving with ant aopc

      package com.test;
      import org.jboss.cache.aop.annotation.PojoCacheable;
      import java.io.Serializable;
      @PojoCacheable
      public class A implements Serializable //extends BaseDataObject{
       private int intVal;
       private boolean boolVal;
       private String StringVal;
      
       public int getIntVal() { return intVal; }
       public void setIntVal(int intVal) {this.intVal = intVal; }
       public boolean isBoolVal() { return boolVal; }
       public void setBoolVal(boolean boolVal) { this.boolVal = boolVal; }
       public String getStringVal() {return StringVal; }
       public void setStringVal(String stringVal) {StringVal = stringVal; }
      
      
      


      And when doing this without any cache use , just this
       (1) A aa = new A();
       (2) aa.setBoolVal(true);
      


      In the line (2) I get


      java.lang.ClassCastException: com.test.A
      org.jboss.aspects.patterns.observable.SubjectInterceptor.invoke(SubjectInterceptor.java:50)
      com.test.A$boolVal_Set.invokeNext(A$boolVal_Set.java)
      com.test.A.boolVal_w_$aop(A.java)
      com.test.A.setBoolVal(A.java:35)
      com.test.mbean.TestService.test2(ConferenceService.java:352)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      java.lang.reflect.Method.invoke(Unknown Source)
      org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
      org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
      org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
      ...


      I tried jbossCache 1.4.0.SP6-8 with no success

      Ideas? :-(

      thanks

        • 1. Re: Fails to run on  Jboss4.2.2
          emailmsgbox

          Small clarification :
          this happen regardless to any cache action (putObject).

          It just due to the fact that I run apoc in the post compile .
          If I do not do post compile weaving it will run just fine

          • 2. Re: Fails to run on  Jboss4.2.2
            emailmsgbox

            Ok,
            So I guest I'm missing something simple here.
            Can you give me a hint?
            Any one?

            • 3. Re: Fails to run on  Jboss4.2.2
              genman

              Take a look here:
              http://www.jboss.org/wiki/Wiki.jsp?page=ClassLoadingConfiguration

              I would first check you aren't deploying two copies of the same class.

              • 4. Re: Fails to run on  Jboss4.2.2
                emailmsgbox

                thank you for your replay

                I'm trying to check the ClassLoading issue...

                If I run the DEFAULT server with additional JGroup.jar from ALL in works find
                but when I try to run it on the ALL server I get this problem

                Ideas? :-(

                • 5. Re: Fails to run on  Jboss4.2.2
                  emailmsgbox

                  I was able to narrow it down to the components :jboss-web.deployer and jboss-web-cluster.sar from the All server.

                  If I replace them with jboss-web.deployer from DEFAULT server it works fine

                  Ideas? :-(

                  • 6. Re: Fails to run on  Jboss4.2.2
                    emailmsgbox

                    anyone ?

                    • 7. Re: Fails to run on  Jboss4.2.2
                      brian.stansberry

                      I think it's this bit from jboss-web-cluster.sar/jboss-web-cluster.aop/META-INF/jboss-aop.xml that is causing you trouble:

                       <!-- Make any POJO with a JDK5 PojoCacheable annotation as a Subject/Observerable -->
                       <bind pointcut="set(* @org.jboss.cache.aop.annotation.PojoCacheable->*)">
                       <interceptor class="org.jboss.aspects.patterns.observable.SubjectInterceptor"/>
                       </bind>
                      
                       <introduction class="@org.jboss.cache.aop.annotation.PojoCacheable">
                       <mixin>
                       <interfaces>org.jboss.aspects.patterns.observable.Subject</interfaces>
                       <class>org.jboss.aspects.patterns.observable.SubjectImpl</class>
                       <construction>new org.jboss.aspects.patterns.observable.SubjectImpl(this)</construction>
                       </mixin>
                       </introduction>
                      


                      The latter causes the AspectManager to insert a SubjectInterceptor when you deploy your class. But when you did your aopc, your jboss-aop.xml didn't include the "introduction" element. So your class doesn't implement the Subject interface and you get a CCE when the SubjectInterceptor gets invoked.

                      Two possible solutions:

                      1) Add the "introduction" element above to your jboss-aop.xml and run aopc again.

                      2) If you don't use FIELD granularity web session replication, remove the jboss-web-cluster.sar/jboss-web-cluster.aop file.