14 Replies Latest reply on Sep 18, 2008 5:57 AM by Jerry Jacob

    PojoCache: java.lang.NoSuchMethodException: addObserver

    cao chen Newbie

      Hi All,
      I am trying to use jBoss PojoCache in my application and I am using AOP pre-compiler to precompile my POJO. I am getting an exception when trying to create an instance of the POJO in Windows.

      I am running jBoss 4.0.5.GA and JDK 1.5.0_06
      I am using jboss-cache-jdk50.jar and I am attaching the MANIFEST below


      Manifest-Version: 1.0
      Ant-Version: Apache Ant 1.6.2
      Created-By: 1.5.0_10-b03 (Sun Microsystems Inc.)
      Built-By: smcgowan
      Created-On: December 20 2006
      Main-Class: org.jboss.cache.Version
      Specification-Title: JBossCache
      Specification-Version: 1.4.1.CR1
      Specification-Vendor: JBoss Inc.
      Implementation-Title: JBossCache
      Implementation-Version: 1.4.1.CR1
      Implementation-Vendor: JBoss Inc.

      I am using jboss-aop-jdk50.jar and I am attaching the MANIFEST below

      Manifest-Version: 1.0
      Ant-Version: Apache Ant 1.6.5
      Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.)
      Specification-Title: JBoss AOP Framework
      Specification-Version: jboss-aop-1.5.2.GA
      Specification-Vendor: JBoss (http://www.jboss.org/)
      Implementation-Title: JBoss AOP Framework
      Implementation-URL: http://www.jboss.org/
      Implementation-Version: jboss-aop-1.5.2.GA
      Implementation-Vendor: JBoss.org
      Implementation-Vendor-Id: http://www.jboss.org/
      Premain-Class: org.jboss.aop.standalone.Agent
      Can-Redefine-Classes: true

      replSync-in-service.xml is below

      <mbean code="org.jboss.cache.TreeCache"
       name="jboss.cache:service=TestPojoCache">
      
       <depends>jboss:service=Naming</depends>
       <depends>jboss:service=TransactionManager</depends>
      
      
       <attribute name="TransactionManagerLookupClass">org.jboss.cache.JBossTransactionManagerLookup</attribute>
      
      
       <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
      
      
       <attribute name="CacheMode">REPL_SYNC</attribute>
      
       <attribute name="UseReplQueue">false</attribute>
      
       <attribute name="ReplQueueInterval">0</attribute>
      
      
       <attribute name="ReplQueueMaxElements">0</attribute>
      
       <attribute name="ClusterName">Messi</attribute>
      
       <attribute name="ClusterConfig">
       <config>
       <UDP mcast_addr="228.1.2.3" mcast_port="48866"
       ip_ttl="64" ip_mcast="true"
       mcast_send_buf_size="150000" mcast_recv_buf_size="80000"
       ucast_send_buf_size="150000" ucast_recv_buf_size="80000"
       loopback="false"/>
       <PING timeout="2000" num_initial_members="3"
       up_thread="false" down_thread="false"/>
       <MERGE2 min_interval="10000" max_interval="20000"/>
       <!-- <FD shun="true" up_thread="true" down_thread="true" />-->
       <FD_SOCK/>
       <VERIFY_SUSPECT timeout="1500"
       up_thread="false" down_thread="false"/>
       <pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800"
       max_xmit_size="8192" up_thread="false" down_thread="false"/>
       <UNICAST timeout="600,1200,2400" window_size="100" min_threshold="10"
       down_thread="false"/>
       <pbcast.STABLE desired_avg_gossip="20000"
       up_thread="false" down_thread="false"/>
       <FRAG frag_size="8192"
       down_thread="false" up_thread="false"/>
       <pbcast.GMS join_timeout="5000" join_retry_timeout="2000"
       shun="true" print_local_addr="true"/>
       <pbcast.STATE_TRANSFER up_thread="true" down_thread="true"/>
       </config>
       </attribute>
      
      
       <attribute name="FetchInMemoryState">true</attribute>
      
       <attribute name="InitialStateRetrievalTimeout">15000</attribute>
      
       <attribute name="SyncReplTimeout">15000</attribute>
      
       <!-- Max number of milliseconds to wait for a lock acquisition -->
       <attribute name="LockAcquisitionTimeout">10000</attribute>
      
       <!-- Name of the eviction policy class. -->
       <attribute name="EvictionPolicyClass"></attribute>
      
       <attribute name="UseRegionBasedMarshalling">true</attribute>
       </mbean>


      Class is below
      public class StudentMaintTest {
      
       private Student mary_;
      
       private PojoCache cache1_;
      
       public StudentMaintTest() {
      
       cache1_ = createCache("Messi");
      
       init();
      
       testPropagation();
       }
      
       private static PojoCache createCache(String name) {
       try {
       PojoCache tree = new PojoCache();
       PropertyConfigurator config = new PropertyConfigurator();
       config.configure(tree, "replSync-in-service.xml");
       tree.setClusterName(name); // We can set a different cluster group.
       tree.start(); // kick start the cache
       return tree;
       } catch (Exception ex) {
       ex.printStackTrace();
       return null;
       }
      
       }
      
       protected void init() {
      
       mary_ = new Student();
       mary_.setName("Mary Smith");
      
       Address address = new Address();
       address.setStreet("456 Oak Drive");
       address.setCity("Pleasantville, CA");
       address.setZip(94555);
      
       mary_.setAddress(address);
      
       }
      
       public void testPropagation() {
       try {
      
       cache1_.putObject("/students/54321", mary_);
      
       } catch (Exception ex) {
       ex.printStackTrace();
       }
      
       }
      
      }


      stack trace is below

      * org.jboss.aop.ClassAdvisor.attachClass(ClassAdvisor.java:312)
      * org.jboss.aop.AspectManager.initialiseClassAdvisor(AspectManager.java:590)
      * org.jboss.aop.AspectManager.getAdvisor(AspectManager.java:578)
      * cn.net.ce.cache.pojo.Address.(Address.java)
      * cn.net.ce.web.tapestry4.Home.pageBeginRender(Home.java:99)
      * org.apache.tapestry.AbstractPage.firePageBeginRender(AbstractPage.java:478)
      * org.apache.tapestry.AbstractPage.renderPage(AbstractPage.java:268)
      * org.apache.tapestry.engine.RequestCycle.renderPage(RequestCycle.java:366)
      * org.apache.tapestry.services.impl.ResponseRendererImpl.renderResponse(ResponseRendererImpl.java:71)
      * $ResponseRenderer_110079a410f.renderResponse($ResponseRenderer_110079a410f.java)
      * org.apache.tapestry.engine.HomeService.service(HomeService.java:65)
      * $IEngineService_110079a4177.service($IEngineService_110079a4177.java)
      * org.apache.tapestry.services.impl.EngineServiceInnerProxy.service(EngineServiceInnerProxy.java:77)
      * org.apache.tapestry.services.impl.EngineServiceOuterProxy.service(EngineServiceOuterProxy.java:66)
      * org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:248)
      * org.apache.tapestry.services.impl.InvokeEngineTerminator.service(InvokeEngineTerminator.java:60)
      * $WebRequestServicer_110079a4157.service($WebRequestServicer_110079a4157.java)
      * $WebRequestServicer_110079a4153.service($WebRequestServicer_110079a4153.java)
      * org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service(WebRequestServicerPipelineBridge.java:56)
      * $ServletRequestServicer_110079a4139.service($ServletRequestServicer_110079a4139.java)
      * org.apache.tapestry.request.DecodedRequestInjector.service(DecodedRequestInjector.java:55)
      * $ServletRequestServicerFilter_110079a4135.service($ServletRequestServicerFilter_110079a4135.java)
      * $ServletRequestServicer_110079a413b.service($ServletRequestServicer_110079a413b.java)
      * org.apache.tapestry.multipart.MultipartDecoderFilter.service(MultipartDecoderFilter.java:52)
      * $ServletRequestServicerFilter_110079a4133.service($ServletRequestServicerFilter_110079a4133.java)
      * $ServletRequestServicer_110079a413b.service($ServletRequestServicer_110079a413b.java)
      * org.apache.tapestry.services.impl.SetupRequestEncoding.service(SetupRequestEncoding.java:53)
      * $ServletRequestServicerFilter_110079a4137.service($ServletRequestServicerFilter_110079a4137.java)
      * $ServletRequestServicer_110079a413b.service($ServletRequestServicer_110079a413b.java)
      * $ServletRequestServicer_110079a412d.service($ServletRequestServicer_110079a412d.java)
      * org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:123)
      * org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:79)
      * javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
      * javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      * org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      * org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      * org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      * org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      * org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      * org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      * org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      * org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
      * org.jboss.web.tomcat.tc5.session.ClusteredSessionValve.invoke(ClusteredSessionValve.java:87)
      * org.jboss.web.tomcat.tc5.session.JvmRouteValve.invoke(JvmRouteValve.java:84)
      * org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
      * org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      * org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      * org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      * org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
      * org.jboss.web.tomcat.tc5.sso.ClusteredSingleSignOn.invoke(ClusteredSingleSignOn.java:676)
      * org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      * org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      * org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199)
      * org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282)
      * org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767)
      * org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:697)
      * org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:889)
      * org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
      * java.lang.Thread.run(Thread.java:595)
      * Caused by: java.lang.NoSuchMethodException: addObserver
      * org.jboss.aop.ClassAdvisor.getMethod(ClassAdvisor.java:323)
      * org.jboss.aop.ClassAdvisor.getMethod(ClassAdvisor.java:331)
      * org.jboss.aop.ClassAdvisor.populateMixinMethods(ClassAdvisor.java:394)
      * org.jboss.aop.ClassAdvisor$1.run(ClassAdvisor.java:290)
      * java.security.AccessController.doPrivileged(Native Method)
      * org.jboss.aop.ClassAdvisor.attachClass(ClassAdvisor.java:271)
      * ... 58 more

      Anybody could help me.
      Thanks.


        • 1. Re: PojoCache: java.lang.NoSuchMethodException: addObserver
          Ben Wang Master

          It complains about when AOP trying to instrument a mixin, it does not find the addObserver method.

          This is probably due to classpath or version compatiblity. But I don't understand where this mixin coming from?

          How do you do pre-compilation of your POJO?

          • 2. Re: PojoCache: java.lang.NoSuchMethodException: addObserver
            cao chen Newbie

            Thanks for your reply.

            My POJO are Person.class, Student.class, Address.class

            Person.java
            @org.jboss.cache.aop.annotation.InstanceOfPojoCacheable
            public class Person implements Serializable {
            ...
            }
            
            Student.java
            public class Student extends Person {
            ...
            }
            
            Address.java
            @org.jboss.cache.aop.annotation.PojoCacheable
            public class Address implements Serializable {
            ...
            }
            


            snippets in my build.xml
            <path id="build.classpath">
             <pathelement location="${basedir}"/>
             <fileset dir="${jboss.home}/lib">
             <include name="**/*.jar"/>
             </fileset>
             <fileset dir="${jboss.home}/server/${jboss.server.config}/lib">
             <include name="**/*.jar"/>
             </fileset>
             <fileset dir="${jboss.home}/server/${jboss.server.config}/deploy/ejb3.deployer">
             <include name="*.jar"/>
             </fileset>
             <fileset dir="${jboss.home}/server/${jboss.server.config}/deploy/jboss-aop-jdk50.deployer">
             <include name="*.jar"/>
             </fileset>
             <fileset dir="${lib.dir}">
             <include name="**/*.jar"/>
             </fileset>
             <fileset dir="${cache.lib.50.dir}">
             <include name="**/*.jar"/>
             </fileset>
             <pathelement location="${classes.dao.dir}"/>
             <pathelement location="${classes.web.dir}"/>
             <pathelement location="${classes.test.dir}"/>
             <pathelement location="${conf.hivemind.dir}"/>
             </path>
            
            <!-- set local properties for this build -->
             <path id="pojocache.lib.classpath">
             <fileset dir="${cache.lib.50.dir}">
             <include name="jboss-common.jar"/>
             <include name="concurrent.jar"/>
             <include name="javassist.jar"/>
             <include name="trove.jar"/>
             <include name="jboss-cache-jdk50.jar"/>
             <include name="jboss-aop-jdk50.jar"/>
             </fileset>
             </path>
            
            <!-- pre-compile directory with aopc -->
             <target name="aopc" depends="compile" description="Precompile aop test classes">
             <taskdef name="aopc" classname="org.jboss.aop.ant.AopC" classpathref="pojocache.lib.classpath"/>
             <aopc compilerclasspathref="pojocache.lib.classpath" verbose="true">
             <src path="${classes.dao.dir}"/>
             <aoppath path="${cache.resources.dir}/jboss-aop.xml"/>
             <classpath refid="build.classpath"/>
             </aopc>
             </target>
            


            jboss-app.xml
            <prepare expr="field(* @org.jboss.cache.aop.AopMarker->*)" />
            
            
             <prepare expr="field(* $instanceof{@org.jboss.cache.aop.InstanceOfAopMarker}->*)" />
            
            
            
             <prepare expr="field(* @org.jboss.cache.aop.annotation.PojoCacheable->*)" />
            
             <prepare expr="field(* $instanceof{@org.jboss.cache.aop.annotation.InstanceOfPojoCacheable}->*)" />
            



            the versions of the jboss-aop-jdk50.jar and jboss-cache-jdk50.jar are the same above.



            • 3. Re: PojoCache: java.lang.NoSuchMethodException: addObserver
              Ben Wang Master

              OK, this

              <fileset dir="${jboss.home}/server/${jboss.server.config}/lib">
               <include name="**/*.jar"/>
              </fileset>
              

              has jbosscache jar (and jgroups) as well. So can you exclude them and try again? Or is it in sync already?


              • 4. Re: PojoCache: java.lang.NoSuchMethodException: addObserver
                cao chen Newbie

                Thanks.

                I edited my build.xml below

                <path id="build.classpath">
                 <pathelement location="${basedir}"/>
                 <fileset dir="${jboss.home}/lib">
                 <include name="**/*.jar"/>
                 </fileset>
                 <fileset dir="${jboss.home}/server/${jboss.server.config}/lib">
                 <include name="**/*.jar"/>
                 </fileset>
                 <fileset dir="${jboss.home}/server/${jboss.server.config}/deploy/ejb3.deployer">
                 <include name="*.jar"/>
                 </fileset>
                 <fileset dir="${jboss.home}/server/${jboss.server.config}/deploy/jboss-aop-jdk50.deployer">
                 <include name="*.jar"/>
                 </fileset>
                 <fileset dir="${lib.dir}">
                 <include name="**/*.jar"/>
                 </fileset>
                 <!--fileset dir="${cache.lib.50.dir}">
                 <include name="**/*.jar"/>
                 </fileset-->
                 <pathelement location="${classes.dao.dir}"/>
                 <pathelement location="${classes.web.dir}"/>
                 <pathelement location="${classes.test.dir}"/>
                 <pathelement location="${conf.hivemind.dir}"/>
                 </path>
                
                <!-- pre-compile directory with aopc -->
                 <target name="aopc" depends="compile" description="Precompile aop test classes">
                 <taskdef name="aopc" classname="org.jboss.aop.ant.AopC" classpathref="build.classpath"/>
                 <aopc compilerclasspathref="build.classpath" verbose="true">
                 <src path="${classes.dao.dir}"/>
                 <aoppath path="${cache.resources.dir}/jboss-aop.xml"/>
                 <classpath refid="build.classpath"/>
                 </aopc>
                 </target>
                


                It use the same jar, also should be in sync. But the problem remains. :(


                • 5. Re: PojoCache: java.lang.NoSuchMethodException: addObserver
                  Ben Wang Master

                  Have you tried it outside of AS first to see if that works? If it does, would you mind giving me your sample war file that I can try it out here.

                  • 6. Re: PojoCache: java.lang.NoSuchMethodException: addObserver
                    cao chen Newbie

                    Yes, I tried it outside of the AS and it work fine.
                    Test class

                    public class StudentMaintTest {
                    
                     private Student joe_;
                    
                     private Student mary_;
                    
                     private Course foo_;
                    
                     private Course bar_;
                    
                     private Course c1;
                    
                     private Course c2;
                    
                     private Course c3;
                    
                     private List<Course> couses = new ArrayList<Course>();
                    
                     private List<String> ss = new ArrayList<String>();
                    
                     // cache1 and cache2 are in the same clustering group.
                     private PojoCache cache1_;
                    
                     private PojoCache cache2_;
                    
                     public StudentMaintTest() {
                    
                     }
                    
                     public void setUp() throws Exception {
                     cache1_ = createCache("Messi2");
                     cache2_ = createCache("Messi2");
                     init();
                     }
                    
                     public void tearDown() throws Exception {
                     cache1_.remove("/");
                     cache1_.stop();
                     cache2_.stop();
                     }
                    
                     private PojoCache createCache(String name) {
                     try {
                     PojoCache tree = new PojoCache();
                     PropertyConfigurator config = new PropertyConfigurator();
                     config.configure(tree, "replSync-in-service.xml");
                     tree.setClusterName(name); // We can set a different cluster group.
                     tree.start(); // kick start the cache
                     return tree;
                     } catch (Exception ex) {
                     ex.printStackTrace();
                     return null;
                     }
                    
                     }
                    
                     protected void init() {
                    
                     mary_ = new Student();
                     mary_.setName("Mary Smith");
                    
                     Address address = new Address();
                     address.setStreet("456 Oak Drive");
                     address.setCity("Pleasantville, CA");
                     address.setZip(94555);
                    
                     mary_.setAddress(address);
                    
                     joe_ = new Student();
                     joe_.setName("Joe Smith");
                     joe_.setSchool("Engineering");
                    
                     // Mary and Joe have the same address
                     joe_.setAddress(address);
                    
                     foo_ = new Course();
                     foo_.setTitle("Intro to Foo");
                     foo_.setInstructor("Jones");
                    
                     joe_.addCourse(foo_);
                     mary_.addCourse(foo_);
                    
                     bar_ = new Course();
                     bar_.setTitle("Advanced Bar");
                     bar_.setInstructor("Woods");
                     bar_.setRoom("104 Encina");
                    
                     c1 = new Course();
                     c1.setTitle("tttt 1");
                     c1.setInstructor("WWW 1");
                     c1.setRoom("rrrr 1");
                    
                     c2 = new Course();
                     c2.setTitle("tttt 2");
                     c2.setInstructor("WWW 2");
                     c2.setRoom("rrrr 2");
                    
                     c3 = new Course();
                     c3.setTitle("tttt 3");
                     c3.setInstructor("WWW 3");
                     c3.setRoom("rrrr 3");
                    
                     couses.add(c1);
                     couses.add(c2);
                     couses.add(c3);
                    
                     ss.add("11111111");
                     ss.add("222222222");
                     ss.add("333333333");
                     }
                    
                     public void testPropagation() {
                     try {
                     // Here we ask the pojo cache to manage mary_ and joe_
                     cache1_.putObject("/students/54321", mary_);
                     cache1_.putObject("/students/65432", joe_);
                     cache1_.putObject("/courses/101", foo_);
                     cache1_.putObject("/courses/401", bar_);
                     cache1_.putObject("/courses/c1", c1);
                     cache1_.putObject("/courses/c2", c2);
                     cache1_.putObject("/courses/c3", c3);
                    
                     cache1_.putObject("/string/ss", ss);
                     cache1_.putObject("/messi/0524", couses);
                    
                     ss.add("44444444");
                     printStrings(ss);
                    
                     couses.add(bar_);
                     printMessi(couses);
                     List<Course> cc = (List<Course>) cache2_.getObject("/messi/0524");
                     // printMessi(cc);
                    
                     List<String> s2 = (List<String>) cache2_.getObject("/string/ss");
                     printStrings(s2);
                    
                     // Output
                     printStatus("Initial state for Mary", mary_);
                     printStatus("Initial state for Joe", joe_);
                    
                     // Retrieve the pojos from the Server #2
                     Student mary2 = (Student) cache2_.getObject("/students/54321");
                     Student joe2 = (Student) cache2_.getObject("/students/65432");
                     Course foo2 = (Course) cache2_.getObject("/courses/101");
                    
                     System.out.println("---------------------------------------------");
                     System.out.println("Modified on Server #1");
                     // Change state in one of the items. This will be fine-grained
                     // replicated
                     foo_.setRoom("101 Alvarez"); // Modified state on cache #2
                     printStatus(
                     "Course Update: id: 401 room: null->101 Alvarez (retrieved from cache #2)",
                     foo2);
                    
                     System.out.println("---------------------------------------------");
                     System.out.println("Modified on Server #2");
                     // Change state in one of the items. This will be fine-grained
                     // replicated
                     joe2.addCourse(bar_); // Modified state on cache #2
                     printStatus(
                     "Student Update: id: 65432 addCourse: Advanced Bar (retrieved from cache #1)",
                     joe_);
                    
                     System.out.println("---------------------------------------------");
                     System.out.println("Modified on Server #1");
                     // Change state in one of the items. This will be fine-grained
                     // replicated.
                     mary_.setSchool("Engineering");
                     printStatus(
                     "Student Update: id: 65432 school: null->Engineering (retrieved from cache #2)",
                     mary2);
                    
                     if (!mary_.getSchool().equals(mary2.getSchool())) {
                     throw new RuntimeException(
                     "School field is not replicated correctly. on cache1: "
                     + mary_.getSchool() + " on cache2: "
                     + mary2.getSchool());
                     }
                     } catch (Exception ex) {
                     ex.printStackTrace();
                     }
                    
                     }
                    
                     private void printStatus(String msg, Object obj) {
                     System.out.println("---------------------------------------------");
                     System.out.println(msg);
                     System.out.println("---------------------------------------------");
                     System.out.println(obj.toString());
                     }
                    
                     private void printMessi(List<Course> cs) {
                     if (cs != null && !cs.isEmpty()) {
                     System.out.println("????????????size:" + cs.size());
                     for (Course c : cs) {
                     System.out.println(c);
                     }
                     }
                     }
                    
                     private void printStrings(List<String> cs) {
                     if (cs != null && !cs.isEmpty()) {
                     System.out.println("????????????size:" + cs.size());
                     for (String c : cs) {
                     System.out.println(c);
                     }
                     }
                     }
                    
                    
                     public static void main(String[] args) throws Exception {
                     StudentMaintTest smTest = new StudentMaintTest();
                     smTest.setUp();
                     smTest.testPropagation();
                     smTest.tearDown();
                     }
                    
                    }
                    


                    build.xml
                    <path id="build.classpath">
                     <pathelement location="${basedir}"/>
                     <fileset dir="${jboss.home}/lib">
                     <include name="**/*.jar"/>
                     </fileset>
                     <fileset dir="${jboss.home}/server/${jboss.server.config}/lib">
                     <include name="**/*.jar"/>
                     </fileset>
                     <fileset dir="${jboss.home}/server/${jboss.server.config}/deploy/ejb3.deployer">
                     <include name="*.jar"/>
                     </fileset>
                     <fileset dir="${jboss.home}/server/${jboss.server.config}/deploy/jboss-aop-jdk50.deployer">
                     <include name="*.jar"/>
                     </fileset>
                     <fileset dir="${lib.dir}">
                     <include name="**/*.jar"/>
                     </fileset>
                     <!--fileset dir="${cache.lib.50.dir}">
                     <include name="**/*.jar"/>
                     </fileset-->
                     <pathelement location="${classes.dao.dir}"/>
                     <pathelement location="${classes.web.dir}"/>
                     <pathelement location="${classes.test.dir}"/>
                     <pathelement location="${conf.hivemind.dir}"/>
                     </path>
                    
                    <target name="run.pojo" depends="ejb3" description="run standalone server replicator.">
                     <java classname="cn.net.ce.web.cache.pojo.StudentMaintTest" fork="yes">
                     <classpath refid="build.classpath"/>
                     <classpath path="${build.dir}"/>
                     <classpath path="resources/sar/META-INF"/>
                     </java>
                     </target>
                    


                    Thanks for your help, I will prepare the smallest application for you. Pls wait a moment. :-)

                    • 7. Re: PojoCache: java.lang.NoSuchMethodException: addObserver
                      cao chen Newbie

                      Application had been sent to your email. :-)

                      • 8. Re: PojoCache: java.lang.NoSuchMethodException: addObserver
                        cao chen Newbie

                        Hi ben, the problem was resolved.
                        I just added a path to build.classpath, show below

                        <path id="build.classpath">
                         <pathelement location="${basedir}"/>
                         <fileset dir="${jboss.home}/lib">
                         <include name="**/*.jar"/>
                         </fileset>
                         <fileset dir="${jboss.home}/server/${jboss.server.config}/lib">
                         <include name="**/*.jar"/>
                         </fileset>
                         <fileset dir="${jboss.home}/server/${jboss.server.config}/deploy/ejb3.deployer">
                         <include name="*.jar"/>
                         </fileset>
                         <fileset dir="${jboss.home}/server/${jboss.server.config}/deploy/jboss-aop-jdk50.deployer">
                         <include name="*.jar"/>
                         </fileset>
                         <fileset dir="${lib.dir}">
                         <include name="**/*.jar"/>
                         </fileset>
                         <fileset dir="${deploy.dir}/tc5-cluster.sar">
                         <include name="tc5-cluster.aop" />
                         </fileset>
                         <!--fileset dir="${cache.lib.50.dir}">
                         <include name="**/*.jar"/>
                         </fileset-->
                         <pathelement location="${classes.dao.dir}"/>
                         <pathelement location="${classes.web.dir}"/>
                         <pathelement location="${classes.test.dir}"/>
                         <pathelement location="${conf.hivemind.dir}"/>
                         </path>
                        
                        
                        <!-- pre-compile directory with aopc -->
                         <target name="aopc" depends="compile" description="Precompile aop test classes">
                         <taskdef name="aopc" classname="org.jboss.aop.ant.AopC" classpathref="build.classpath"/>
                         <aopc compilerclasspathref="build.classpath" verbose="true">
                         <src path="${classes.dao.dir}"/>
                         <aoppath path="${cache.resources.dir}/jboss-aop.xml"/>
                         <classpath refid="build.classpath"/>
                         </aopc>
                         </target>
                        
                        


                        Now, it's ok.
                        Is that snippet of path must been contained in the classpath?

                        Thanks a lot for your help!

                        • 9. Re: PojoCache: java.lang.NoSuchMethodException: addObserver
                          Ben Wang Master

                          Yeah, I have just found it out from my own test here. What happens is that tc5-cluster.aop contains a jboss-aop.xml as well. So either you use it all the way, or you remove it from AS deployment.

                          Thanks,

                          -Ben

                          • 10. Re: PojoCache: java.lang.NoSuchMethodException: addObserver
                            Jamie Reifsnyder Newbie

                             

                            Yeah, I have just found it out from my own test here. What happens is that tc5-cluster.aop contains a jboss-aop.xml as well. So either you use it all the way, or you remove it from AS deployment.


                            Could you elaborate on this? Do the PojoCacheable classes always need to be built with this in the classpath? Or is the runtime error I'm getting caused by having it included in the deployment?

                            I am also getting this addObserver error, and when I include the tc5-cluster.aop file in the classpath for building, I get a different error.

                            [aopc] javassist.NotFoundException: org.jboss.aspects.patterns.observable.SubjectImpl
                            [aopc] at javassist.ClassPool.get(ClassPool.java:416)
                            [aopc] at org.jboss.aop.instrument.Instrumentor.addMixin(Instrumentor.java:250)
                            [aopc] at org.jboss.aop.instrument.Instrumentor.instrumentIntroductions(Instrumentor.java:336)
                            [aopc] at org.jboss.aop.instrument.Instrumentor.transform(Instrumentor.java:672)
                            [aopc] at org.jboss.aop.AspectManager.translate(AspectManager.java:908)
                            [aopc] at org.jboss.aop.AspectManager.transform(AspectManager.java:820)
                            [aopc] at org.jboss.aop.standalone.Compiler.compileFile(Compiler.java:345)
                            [aopc] at org.jboss.aop.standalone.Compiler.compile(Compiler.java:234)
                            [aopc] at org.jboss.aop.standalone.Compiler.main(Compiler.java:90)
                            [aopc] java.lang.RuntimeException: failed to transform: oracle.otnsamples.oc4jjms.ChatSubscriberValue
                            [aopc] at org.jboss.aop.instrument.Instrumentor.transform(Instrumentor.java:732)
                            [aopc] at org.jboss.aop.AspectManager.translate(AspectManager.java:908)
                            [aopc] at org.jboss.aop.AspectManager.transform(AspectManager.java:820)
                            [aopc] at org.jboss.aop.standalone.Compiler.compileFile(Compiler.java:345)
                            [aopc] at org.jboss.aop.standalone.Compiler.compile(Compiler.java:234)
                            [aopc] at org.jboss.aop.standalone.Compiler.main(Compiler.java:90)
                            [aopc] Caused by: javassist.NotFoundException: org.jboss.aspects.patterns.observable.SubjectImpl
                            [aopc] at javassist.ClassPool.get(ClassPool.java:416)
                            [aopc] at org.jboss.aop.instrument.Instrumentor.addMixin(Instrumentor.java:250)
                            [aopc] at org.jboss.aop.instrument.Instrumentor.instrumentIntroductions(Instrumentor.java:336)
                            [aopc] at org.jboss.aop.instrument.Instrumentor.transform(Instrumentor.java:672)
                            [aopc] ... 5 more
                            [aopc] Exception in thread "main" java.lang.RuntimeException: failed to transform: oracle.otnsamples.oc4jjms.ChatSubscriberValue
                            [aopc] at org.jboss.aop.instrument.Instrumentor.transform(Instrumentor.java:732)
                            [aopc] at org.jboss.aop.AspectManager.translate(AspectManager.java:908)
                            [aopc] at org.jboss.aop.AspectManager.transform(AspectManager.java:820)
                            [aopc] at org.jboss.aop.standalone.Compiler.compileFile(Compiler.java:345)
                            [aopc] at org.jboss.aop.standalone.Compiler.compile(Compiler.java:234)
                            [aopc] at org.jboss.aop.standalone.Compiler.main(Compiler.java:90)
                            [aopc] Caused by: javassist.NotFoundException: org.jboss.aspects.patterns.observable.SubjectImpl
                            [aopc] at javassist.ClassPool.get(ClassPool.java:416)
                            [aopc] at org.jboss.aop.instrument.Instrumentor.addMixin(Instrumentor.java:250)
                            [aopc] at org.jboss.aop.instrument.Instrumentor.instrumentIntroductions(Instrumentor.java:336)
                            [aopc] at org.jboss.aop.instrument.Instrumentor.transform(Instrumentor.java:672)
                            [aopc] ... 5 more

                            Thanks,
                            Jamie



                            • 11. Re: PojoCache: java.lang.NoSuchMethodException: addObserver
                              Ben Wang Master

                              Jamie, what I was saying is that:

                              1. If you don't use http session clustering, you can remove tc5-cluster.aop from your deploy directory and use your own jboss-aop.xml. That should work.

                              2. If you do, you will need to include tc5-cluster.aop in your classpath. Furthermore, you will need jboss-aop-aspect.jar (for aop aspects) in your classpath as well during compilation.

                              • 12. Re: PojoCache: java.lang.NoSuchMethodException: addObserver
                                Jamie Reifsnyder Newbie

                                Thanks!

                                Also, I wrote down all the steps it took to install and run PojoCache in JBoss 4.0.5. Since I found the info scattered across various documents and questions in the forum, it was a several day effort which could be cut to 15 mins with a list of steps in one place. Would you like me to pass it along to you?
                                J

                                • 13. Re: PojoCache: java.lang.NoSuchMethodException: addObserver
                                  Ben Wang Master

                                  Sure. Please open up a jira for it and attach your doc. I will then merge it into the regular doc.

                                  thanks again!

                                  • 14. Re: PojoCache: java.lang.NoSuchMethodException: addObserver
                                    Jerry Jacob Newbie

                                    I am having the same issue with Jboss 4.2.2 GA. I am using POJO Cache 1.4.1 SP3. It works out of the AS. 4.2.2 has jboss-aop-jdk50.deployer which has another version of jboss-aop-jdk50.jar. My POJO's are annotted and I tried to pre-compile them using this version of jar but it did not help. below is the stack trace. I am using jdk1.5.0_11

                                    java.lang.NoSuchMethodException: addObserver
                                     at org.jboss.aop.ClassAdvisor.getMethod(ClassAdvisor.java:261)
                                     at org.jboss.aop.ClassAdvisor.getMethod(ClassAdvisor.java:269)
                                     at org.jboss.aop.ClassAdvisor.populateMixinMethods(ClassAdvisor.java:332)
                                     at org.jboss.aop.ClassAdvisor$1.run(ClassAdvisor.java:228)
                                     at java.security.AccessController.doPrivileged(Native Method)
                                     at org.jboss.aop.ClassAdvisor.attachClass(ClassAdvisor.java:209)
                                     at org.jboss.aop.AspectManager.getAdvisor(AspectManager.java:459)
                                     at com.pindar.cache.pojocache.Person.<clinit>(Person.java)
                                     at com.pindar.cache.pojocache.PojoCacheHandler.doGet(PojoCacheHandler.java:41)
                                     at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
                                     at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
                                     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                                     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                                     at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                                     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                                     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                                     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                                     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                                     at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                                     at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                                     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                                     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                                     at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                                     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                                     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
                                     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                                     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                                     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                                     at java.lang.Thread.run(Thread.java:595)
                                    


                                    Could somebody help me?

                                    Thanks in advance