8 Replies Latest reply on Jan 13, 2009 4:35 AM by frankthetank

    Instrumentation required in order to use Lists?

    frankthetank

      Hello all.

      Of course the holidays could not keep me away from JBoss and I was diving into JBoss Cache. Sofar ok.
      I created a PojoCache and TreeCache and have both running.
      I can add serialized Pojos to the PojoCache but as soon as I try to add a List using

      pojoCache.attach(_CACHE_NAME_, new ArrayList());
      


      I get:

      00:54:16,448 ERROR [[HtmlAdaptor]] Servlet.service() for servlet HtmlAdaptor threw exception
      java.lang.NoSuchMethodError: org.jboss.aop.proxy.ClassProxyFactory.newInstance(Ljava/lang/Class;[Lorg/jboss/aop/proxy/ProxyMixin;Z)Lorg/jboss/aop/proxy/ClassProxy;
       at org.jboss.cache.pojo.collection.CollectionInterceptorUtil.createProxy(CollectionInterceptorUtil.java:50)
       at org.jboss.cache.pojo.collection.CollectionInterceptorUtil.createListProxy(CollectionInterceptorUtil.java:65)
       at org.jboss.cache.pojo.impl.CollectionClassHandler.put(CollectionClassHandler.java:157)
       at org.jboss.cache.pojo.impl.PojoCacheDelegate.putObject(PojoCacheDelegate.java:138)
       at org.jboss.cache.pojo.impl.PojoCacheImpl.attach(PojoCacheImpl.java:102)
       at org.jboss.cache.pojo.impl.PojoCacheImpl.attach(PojoCacheImpl.java:93)
       at org.jboss.cache.pojo.impl.PojoCacheImpl.attach(PojoCacheImpl.java:88)
      


      Do I have to instrument my Pojos or what?

      thanks

        • 1. Re: Instrumentation required in order to use Lists?
          frankthetank

          Also, would I need to instrument my Pojos in order to get field-level modification updates via a PojoCacheListener?

          • 2. Re: Instrumentation required in order to use Lists?
            frankthetank

            Ok, somehow instrumenting my classes is not working.

            The basics:
            jboss 4.2.3, jdk 6andsomeminornumber

            I have thrown everything into a ejb3 archive and the jboss-aop.xml with the contents I copied from the tutorials as well.
            My objects is annotated with Explicable and loadtime weaving is enabled.
            But when I start my server, nothing happens.

            As per Troubleshooting Guide I enabled the log levels for pojo and aop and even enabled verbose for the aop weaving but nowhere do I see my objects getting mentioned.

            I can tell that the jboss-aop.xml is getting read because if I add in the arraythingie part to the jboss-aop.xml it complains.

            I tried packing the jboss-aop.xml into a .aop archive but that did not change anything.

            I can get it to work using Serializable but that will not give me field level modification notifications via the listener.

            Can anyone help me out?
            Is there a dummies guide to getting PojoCache running under JB0ssAS 4.2.3?

            thanks!

            • 3. Re: Instrumentation required in order to use Lists?
              frankthetank

              As I am unable to edit my posts:

              That should be Replicable and not Explicable.

              Also I am using PojoCache 3.0.0 (or 3.0.1, not in front of my home PC).

              • 4. Re: Instrumentation required in order to use Lists?
                jason.greene
                • 5. Re: Instrumentation required in order to use Lists?
                  frankthetank

                  Thanks for the reply jason.
                  I really appreciate your help as I am new to both AOP and Cache.

                  While the thread given was for AS5.0.0 I knew what I had to modify:
                  Modify jboss-4.2.3.GA/server/default/deploy/jboss-aop-jdk50.deployer/META-INF/jboss-service.xml

                  <attribute name="EnableLoadtimeWeaving">true</attribute>
                  <attribute name="Include">org.jboss.test, org.jboss.injbossaop, com.tank.dom.</attribute>
                  


                  and also added the pluggable-instrumentor.jar to my start.sh

                  Still nothing. Only when I add Serializable it will work.
                  I also see nothing in the logs.

                  some questions:
                  1. ATM I have everything in a ejb3 archive. Can this stay like this or do I have to change it?
                  2. Do my classes have to be Serializable or not?
                  3. I have taken the contents of jboss-aop.xml from the examples:
                  <?xml version="1.0" encoding="UTF-8"?>
                  <aop>
                   <prepare expr="field(* instanceof{@org.jboss.cache.pojo.annotation.Replicable}->*)"/>
                   <introduction expr="class($instanceof{@org.jboss.cache.pojo.annotation.Replicable})"/>
                  </aop>
                  

                  Is this enough to have field level replication and notification?
                  4. As mentioned before my ejb3 archive looks like this:
                  project.ejb3
                   com.tank.dom <- Pojos
                   com.tank.cache <- Cache Stuff
                   META-INF/
                   MANIFEST.MF
                   ejb-jar.xml
                   orm.xml <- needed for ejb entity mapping
                   persistence.xml <- database mapping
                   jboss-aop.xml <- aop mapping as mentioned above
                  

                  5. is it required to run in the all (not default) config? ATM I just copied the required jars into default/lib.
                  Including the jbosscache-pojo.jar created by the ant build.xml in the jbosscache-pojo-3.0.0.GA archive.

                  Anything else I might be missing?
                  Probably broke it somewhere while looking how to fix it. :)

                  If all else fails I will just restart again with a clean jboss.

                  @Error with arrayreplacement I get this:
                  22:32:41,866 ERROR [STDERR] [error] Unknown AOP tag: arrayreplacement file:/home/frank/dev/jboss-4.2.3.GA/server/default/tmp/deploy/tmp9738ArgusTestCache.ejb3-contents/jboss-aop.xml
                  22:32:41,871 ERROR [STDERR] java.lang.IllegalArgumentException: Unknown AOP tag: arrayreplacement
                  


                  thanks again!

                  • 6. Re: Instrumentation required in order to use Lists?
                    frankthetank

                    Well anyway, I started fresh with AS 4.2.3 and used the PojoCache out of the box (1.4.1) and it works fine.
                    Also the change notification is coming in, but as this only reports that a node has been modified, I would like to upgrade to a newer version as iirc it also gave information what was changed.

                    Thus my newest question:
                    What versions of PojoCache can I deploy as an mbean into what versions of ApServer?

                    I am still working with AS 4.2.3 atm (have not even looked at 5.0.0 yet) and would prefer to stay for the time being.

                    • 7. Re: Instrumentation required in order to use Lists?
                      jason.greene

                      The previous error you had is because 4.2.x includes AOP 1.5 and POJO Cache 3.x needs 2.0. The easiest path to using 3.x is AS5. If you want to use it in 4, you have to update all the POJO Cache deps in the AS and remove any of the AS clustering components (since they rely on 1.4).

                      The other option for deploying 3 on 4.2.x is using jarjar create a single jar with renamed packages for POJO Cache and all of its deps.

                      • 8. Re: Instrumentation required in order to use Lists?
                        frankthetank

                        As hacking POJO Cache into jboss 4.2.3 is not an option for me I think we will just have to move to JBoss 5.0.0.

                        Thanks for all the help!