Miro,

Your ReassignGrantsOfficerPage obviously _implements_ Serializable (since
Component does, as you correctly say) but that does not mean that the
subclasser can't break the contract himself by, usually inadvertently,
giving his sub-class non-serialisable state!
 
It seems that other people have experienced 
http://markmail.org/message/ddorsz5t5o3c2jnn?q=cglib+serialisable similar
issues with CGLIB .

If you can't get around the CGLIB issue take a look at the 2 alternative
approaches in my first response on this thread.

Regards - Cemal
http://www.jWeekend.co.uk http://jWeekend.co.uk 



miro wrote:
> 
> is ReassignGrantsOfficerPage Serializable? Do you want it to be serialised
> in the page store?
> 
> Yes   ReassignGrantsOfficerPage  is Serializable  because all wicket
> components are serializable, yes.
>  
> ReassignGrantsOfficerDTO   represents the user entered form values and no
> lookup values so I dont want to use   detachable model ,   I am just
> wrapping my  form model with additonal meta information   needed by my
> service layer,so please tell me will there be any problem with cglib proxy
> serialization ?  like can we have cglib generated proxies   in wicket
> pages ?
> 
> jWeekend wrote:
>> 
>> Miro,
>> 
>> [Edited ... wrapped myProxyModelInstance in a CompoundPropertyModel (typo
>> fixed below) so it works in the same way as you probably intended.]
>> 
>> Your use of the ProxyFactory looks fine (although you could also do the
>> Spring configuration in your application context and use @SpringBean to
>> inject your proxy in a Wicket-safe way).
>> 
>> Anyway ... is ReassignGrantsOfficerPage Serializable? Do you want it to
>> be serialised in the page store?
>> 
>> Also, since CompoundPropertyModel is an IChainingModel, you can try try
>> something like:
>> 
>> class MyProxyModel extends LoadableDetachableModel{
>>   protected Object load(){
>>     return getProxy();      
>>   }
>> }
>> 
>> ... and ...
>> 
>> public ReassignGrantsOfficerForm() {
>>    super("reassignGrantsOfficerForm", new
>> CompoundPropertyModel(myProxyModelInstance));
>>    ...
>> }
>> 
>> so your CompoundPropertyModel is not holding on to an instance of your
>> proxy (which, incidentally, is fixed when your form's constructor is run
>> - ie it is not dynamic/evaluated per render).
>> 
>> I'd be interested to know if that's what you needed as the code provided
>> may not tell your whole story.
>> 
>> Regards - Cemal
>>  http://www.jWeekend.co.uk http://jWeekend.co.uk 
>> 
>> 
>> 
>> miro wrote:
>>> 
>>> I am  creating a spring  proxy for my model before attaching it to the
>>> form and i get notserializable exception
>>> 
>>> here is the code
>>>     protected Object getproxy(){
>>>             ProxyFactory factory = new ProxyFactory(new
>>> ReassignGrantsOfficerDTO());
>>>             factory.addAdvisor(new WorkflowMetaDataAdvisor());
>>>         factory.setProxyTargetClass(true);
>>>         Advised  advised=(Advised)factory.getProxy();
>>>         advised.setExposeProxy(true);
>>>         System.out.println(advised instanceof  WorkflowMetaData ); 
>>>         System.out.println(advised instanceof  ReassignGrantsOfficerDTO ); 
>>>         return  advised;
>>>     }
>>>      private class ReassignGrantsOfficerForm  extends Form{
>>> 
>>>              public ReassignGrantsOfficerForm() {
>>>                             super("reassignGrantsOfficerForm", new
>>> CompoundPropertyModel(getproxy()));
>>> 
>>> 
>>> here the exception
>>> 
>>> - Error serializing object class
>>> gov.hhs.acf.web.pages.auditprog.ReassignGrantsOfficerPage [object=[Page
>>> class = gov.hhs.acf.web.pages.auditprog.ReassignGrantsOfficerPage, id =
>>> 3, version = 0]]
>>> org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException:
>>> Unable to serialize class:
>>> gov.hhs.acf.dto.ReassignGrantsOfficerDTO$$EnhancerByCGLIB$$4657904b
>>> Field hierarchy is:
>>>   3 [class=gov.hhs.acf.web.pages.auditprog.ReassignGrantsOfficerPage,
>>> path=3]
>>>     private java.lang.Object org.apache.wicket.MarkupContainer.children
>>> [class=[Ljava.lang.Object;]
>>>       java.lang.Object org.apache.wicket.Component.data[2]
>>> [class=org.apache.wicket.markup.html.WebMarkupContainer,
>>> path=3:reassignGrantsOfficerContainer]
>>>         private java.lang.Object
>>> org.apache.wicket.MarkupContainer.children [class=[Ljava.lang.Object;]
>>>           private java.lang.Object
>>> org.apache.wicket.MarkupContainer.children[0]
>>> [class=gov.hhs.acf.web.pages.auditprog.ReassignGrantsOfficerPage$ReassignGrantsOfficerForm,
>>> path=3:reassignGrantsOfficerContainer:reassignGrantsOfficerForm]
>>>             java.lang.Object org.apache.wicket.Component.data
>>> [class=org.apache.wicket.model.CompoundPropertyModel]
>>>               private java.lang.Object
>>> org.apache.wicket.model.CompoundPropertyModel.target
>>> [class=gov.hhs.acf.dto.ReassignGrantsOfficerDTO$$EnhancerByCGLIB$$4657904b]
>>> <----- field that is not serializable
>>>     at
>>> org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:342)
>>>     at
>>> org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:610)
>>>     at
>>> org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:533)
>>>     at
>>> org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:610)
>>>     at
>>> org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:533)
>>>     at
>>> org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:388)
>>>     at
>>> org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:610)
>>>     at
>>> org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:533)
>>>     at
>>> org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:388)
>>>     at
>>> org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:610)
>>>     at
>>> org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:533)
>>>     at
>>> org.apache.wicket.util.io.SerializableChecker.writeObjectOverride(SerializableChecker.java:678)
>>>     at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:322)
>>>     at
>>> org.apache.wicket.util.io.IObjectStreamFactory$2.writeObjectOverride(IObjectStreamFactory.java:125)
>>>     at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:322)
>>>     at
>>> org.apache.wicket.util.lang.Objects.objectToByteArray(Objects.java:1091)
>>>     at
>>> org.apache.wicket.protocol.http.pagestore.AbstractPageStore.serializePage(AbstractPageStore.java:197)
>>>     at
>>> org.apache.wicket.protocol.http.pagestore.DiskPageStore.storePage(DiskPageStore.java:811)
>>>     at
>>> org.apache.wicket.protocol.http.SecondLevelCacheSessionStore$SecondLevelCachePageMap.put(SecondLevelCacheSessionStore.java:332)
>>>     at org.apache.wicket.Session.requestDetached(Session.java:1370)
>>>     at org.apache.wicket.RequestCycle.detach(RequestCycle.java:1085)
>>>     at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1372)
>>>     at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)
>>>     at
>>> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:355)
>>>     at
>>> org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:124)
>>>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
>>>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>>>     at
>>> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
>>>     at
>>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1124)
>>>     at
>>> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)
>>>     at
>>> org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:229)
>>>     at
>>> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
>>>     at
>>> org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148)
>>>     at
>>> org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
>>>     at
>>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1115)
>>>     at
>>> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
>>>     at
>>> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
>>>     at
>>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1115)
>>>     at
>>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:361)
>>>     at
>>> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
>>>     at
>>> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>>>     at
>>> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
>>>     at
>>> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417)
>>>     at
>>> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
>>>     at
>>> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
>>>     at
>>> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>>>     at org.mortbay.jetty.Server.handle(Server.java:324)
>>>     at
>>> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
>>>     at
>>> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
>>>     at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
>>>     at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
>>>     at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
>>>     at
>>> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
>>>     at
>>> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:499)
>>> Caused by: java.io.NotSerializableException:
>>> gov.hhs.acf.dto.ReassignGrantsOfficerDTO$$EnhancerByCGLIB$$4657904b
>>>     at
>>> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
>>>     at
>>> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
>>>     at
>>> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
>>>     at
>>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
>>>     at
>>> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>>>     at
>>> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
>>>     at
>>> java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:416)
>>>     at org.apache.wicket.Component.writeObject(Component.java:4216)
>>>     at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
>>>     at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>     at java.lang.reflect.Method.invoke(Method.java:597)
>>>     at
>>> java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
>>>     at
>>> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
>>>     at
>>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
>>>     at
>>> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>>>     at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
>>>     at
>>> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
>>>     at
>>> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
>>>     at
>>> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
>>>     at
>>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
>>>     at
>>> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>>>     at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
>>>     at
>>> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
>>>     at
>>> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
>>>     at
>>> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
>>>     at
>>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
>>>     at
>>> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>>>     at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
>>>     at
>>> org.apache.wicket.util.io.IObjectStreamFactory$2.writeObjectOverride(IObjectStreamFactory.java:117)
>>>     ... 40 more
>>> 
>>> 
>>> please help me resolve this ?
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/spring-proxy---for-my-model-causes-notSerializable-exception-tp20883658p20900927.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to