4 Replies Latest reply on Feb 9, 2006 4:11 PM by anupama

    TreeCacheAop questions

    billbejeck

      Hi,

      I have questions regarding using TreeCacheAop.


      A) If I have an object that once created is used only for read only
      purposes, is there any problem with not-aspectizing the object
      and still using the method putObject()?

      B) It seems that objects in the TreeCacheAop do not
      need to be serializable. Is it ok to use serializable objects
      in TreeCacheAop? I noticed some inconsistent behavior until
      I stopped implementing Serializable in objects that I was aspectizing.



      Thanks,
      Bill


        • 1. Re: TreeCacheAop questions

          Bill,

          Q(A). You can but it will need to be serializable. In this case, putObject acts as put.

          Q(B). Declare it Serializable should be ok. Can you elborate on the inconsistency? I am interested to know because I think it should not. :-)

          -Ben

          • 2. Re: TreeCacheAop questions
            billbejeck

            Ok,

            I made a mistake before, and Serialized objects work fine in the TreeCacheAop. But I have another question now. I am having trouble using the org.jboss.aop.standalone.SystemClassLoader in Tomcat.

            The error is "failed to transform TreeCacheAOP" with a linked exception to the org.jboss.standalone.SystemClassLoader. I put the jboss-cache, jboss-aop, trove and javassist jar files in Tomcat common lib. Am I missing something in the configuration ?

            Thanks,
            Bill

            • 3. Re: TreeCacheAop questions

              My suggestion is to use aopc (the precompiler) if you can. THis way, you won't need the classloader during load time.

              -Ben

              • 4. Re: TreeCacheAop questions
                anupama

                Hi Ben and Bill,

                Bill you said Tree Cache AOP is working fine for serialized objects, but I have weird problem though. I am using Jboss Tree Cache AOP 1.2.4, I made serialized classes as apectized and placing them in TreeCacheAOP. By going through docs I realized that I need to have my classes apectized to use TreeCacheAOP and to take all of it's benefits. You can also cache non-aspectized classes in TreeCacheAOP but it will act as TreeCache. I really want to use all pros of TreeCacheAOP, I need to pass Object A to front-end and cache it till they need it via delegate call. So I made my Object A as serialized and placed into cache, I am able to retrieve object properly at server but When it goes to client, client is seeing following exception


                java.lang.reflect.UndeclaredThrowableException
                 at $Proxy1.getAnswer(Unknown Source)
                 at com.wdpro.commerce.wdw.be.client.delegate.WDWIBCAppDelegate.getAnswer(WDWIBCAppDelegate.java:211
                )
                 at TestCache.main(TestCache.java:20)
                Caused by: java.io.NotSerializableException: org.jboss.cache.aop.collection.CachedListInterceptor
                 at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
                 at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
                 at java.util.ArrayList.writeObject(ArrayList.java:529)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:324)
                 at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:809)
                 at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1296)
                 at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
                 at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
                 at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
                 at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
                 at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
                 at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
                 at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
                 at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
                 at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
                 at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
                 at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
                 at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
                 at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
                 at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
                 at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
                 at java.rmi.MarshalledObject.<init>(MarshalledObject.java:92)
                 at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:410)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:324)
                 at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
                 at sun.rmi.transport.Transport$1.run(Transport.java:148)
                 at java.security.AccessController.doPrivileged(Native Method)
                 at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
                 at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
                 at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
                 at java.lang.Thread.run(Thread.java:534)
                 at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
                 at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
                 at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
                 at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
                 at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:119)
                 at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:227)
                 at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:167)
                 at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
                 at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
                 at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:97)
                 at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
                 ... 3 more



                I tried making it non-serialized and moving contents to serialized object but still getting same exception.

                What this all means.

                Please let me know ASAP.

                Thanks alot,
                Anu