-
1. Re: aop-enabled objects not Serializable anymore?
ben.wang Oct 24, 2005 10:05 AM (in response to motormind)No, this is the AOP-associated interceptor that we attach. Problem is this is not Serializable. And it doesn't make sense for it to be Serializable, IMO.
Can you give me your use case? One way to do it is do "removeObject" first, then the pojo will become regular pojo. But that will destroy the cache content.
-Ben -
2. Re: aop-enabled objects not Serializable anymore?
motormind Oct 25, 2005 3:05 AM (in response to motormind)Well, I "solved" it by wrapping the result from the cache in an object that it still serializable. The next problem is: are Collections in stored objects also automatically stored when I use TreeCacheAop? I don't see that happening... when I ask the contents of a Collection with a cached object that is cupposed to be full, there is nothing there...
-
3. Re: aop-enabled objects not Serializable anymore?
ben.wang Oct 26, 2005 10:45 AM (in response to motormind)It should. Let's say a Person object has reference to List. Then when you store the Person object in the CacheAop, we will swap out the List reference with a proxy dynamically.
-Ben -
4. Re: aop-enabled objects not Serializable anymore?
anupama Feb 9, 2006 12:07 PM (in response to motormind)Hi Ben,
I have the following POJO class which needs to be apectized and has to send over wire to client.Code: import java.io.Serializable; import java.util.ArrayList; /** * * @@org.jboss.cache.aop.AopMarker */ public class Answer implements Serializable{ private String itemCode; private String description; private boolean defaultItem; private ArrayList parentItemCodeList; private ArrayList amenitiesList; private boolean hasSuite; private boolean hasConcierge; private int maxGuest; public Answer() { amenitiesList = new ArrayList (); parentItemCodeList = new ArrayList(); } public ArrayList getAmenitiesList() { return amenitiesList; } public void setAmenitiesList(ArrayList amenitiesList) { this.amenitiesList = amenitiesList; } public void addAmenity (String amenity){ amenitiesList.add(amenity); } public boolean getDefaultItem() { return defaultItem; } public void setDefaultItem(boolean defaultItem) { this.defaultItem = defaultItem; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public boolean isHasConcierge() { return hasConcierge; } public void setHasConcierge(boolean hasConcierge) { this.hasConcierge = hasConcierge; } public boolean isHasSuite() { return hasSuite; } public void setHasSuite(boolean hasSuite) { this.hasSuite = hasSuite; } public String getItemCode() { return itemCode; } public void setItemCode(String itemCode) { this.itemCode = itemCode; } public int getMaxGuest() { return maxGuest; } public void setMaxGuest(int maxGuest) { this.maxGuest = maxGuest; } public ArrayList getParentItemCodeList() { return parentItemCodeList; } public void setParentItemCodeList(ArrayList parentItemCodeList) { this.parentItemCodeList = parentItemCodeList; } public void addParentItemCode(String parentItemCode){ parentItemCodeList.add(parentItemCode); } }
it's doing AOPC properly and even caching and retrieving it from JBoss TreeCacheAOP. it's displaying Cached contents at server properly but at client side it's giving
Code: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
when I did
Answer ans = delegate.getAnswer()
I don't know what I am missing here, can't cached classes accessed at client.
Please let me know ASAP.
What are requirements for Cached classes to be accessed at client side.
Thanks alot Guys,
Anu