i am going to guess that inside "//stuff happens here..." you access the final cart field. when you do this inside an anonymous class it keeps a reference, so that is what is causing your serialization problem. instead of having the final field, do the lookup "((UserSession)getSession()).getCart();" directly inside the "//stuff happens here..."
-igor On Thu, Nov 19, 2009 at 9:57 AM, VGJ <[email protected]> wrote: > I reference the bean's interface in order to use it, yes. What's the > alternative? Would I instead access everything through a proxy class and > store the proxy itself into the WebSession, to retain a reference? As it > is, each page in the checkout process changes the Stateful bean's properties > and stores it back into the WebSession. Here is what the Cart page looks > like, in summary: > > public class Cart extends BasePage > { > public Cart() > { > //get session - derives from Wicket's WebSession > UserSession session = (UserSession)getSession(); > > //get cart from session > final ShoppingCartLocal cart = ((UserSession)getSession()).getCart(); > > //create form > Form form = new Form("cartForm"); > > //add list of non-bundle Configuration objects to form > form.add(new ListView("orderLinesView", cart.getOrderLines()) > { > protected void populateItem(ListItem item) > { > //stuff happens here... > } > } > > //...and so on...and so forth... > } > } > > On Thu, Nov 19, 2009 at 10:07 AM, Igor Vaynberg > <[email protected]>wrote: > >> according to the stacktrace, this component: >> >> path=3:cartForm:orderLinesView] >> >> has this reference: final com.myapp.session.ShoppingCartLocal >> >> so looks like you are holding on to your bean directly instead of using a >> proxy. >> >> -igor >> >> On Thu, Nov 19, 2009 at 8:48 AM, VGJ <[email protected]> wrote: >> > One would think...however I tried it and it makes no difference. None of >> my >> > proxy classes implement Serializable and this exception occurs nowhere >> else, >> > also. >> > >> > Just to be certain, I just went through and implemented it on *all* of my >> > proxy classes in this app. No change. >> > >> > >> > On Thu, Nov 19, 2009 at 9:30 AM, Igor Vaynberg <[email protected] >> >wrote: >> > >> >> your CartProxy does not implement serialiazable so it cannot be >> >> serialized... >> >> >> >> -igor >> >> >> >> On Thu, Nov 19, 2009 at 7:30 AM, VGJ <[email protected]> wrote: >> >> > I'm not injecting it directly. I'm using a "proxy" class to get a >> >> reference >> >> > to the stateless bean's interface like so: >> >> > >> >> > public class CartProxy >> >> > { >> >> > private static ShoppingCartLocal lookupCartInterface() >> >> > { >> >> > ShoppingCartLocal cart = null; >> >> > >> >> > try >> >> > { >> >> > InitialContext ctx = new InitialContext(); >> >> > cart = >> >> > (ShoppingCartLocal)ctx.lookup("java:comp/env/ShoppingCartBean"); >> >> > } >> >> > catch (NamingException exp) >> >> > { >> >> > LogProxy.saveEntry(exp); >> >> > } >> >> > >> >> > return cart; >> >> > } >> >> > } >> >> > >> >> > The reference in web.xml makes this possible: >> >> > >> >> > <ejb-local-ref> >> >> > <ejb-ref-name>ShoppingCartBean</ejb-ref-name> >> >> > <ejb-ref-type>Session</ejb-ref-type> >> >> > <local>com.myapp.session.ShoppingCartLocal</local> >> >> > <ejb-link>MyProjectEJB.jar#ShoppingCartBean</ejb-link> >> >> > </ejb-local-ref> >> >> > >> >> > Is this not supposed to work? It's been in production for over 3 >> >> yrs...so I >> >> > hope it does! :) >> >> > >> >> > The entire app is built this way and this one page is the only one >> >> throwing >> >> > this exception. It works, it doesn't stop the show or affect anything >> >> > negatively, so far as I can tell. I would just like to get rid of it >> and >> >> > figure out what it is. >> >> > >> >> > Thanks again, >> >> > >> >> > -v >> >> > >> >> > On Wed, Nov 18, 2009 at 11:49 PM, Igor Vaynberg < >> [email protected] >> >> >wrote: >> >> > >> >> >> wicket stuff contains a wicket-jee module which supports injecting >> ejb >> >> >> beans into wicket components the same way that wicket-spring injects >> >> >> wicket beans. >> >> >> >> >> >> -igor >> >> >> >> >> >> On Wed, Nov 18, 2009 at 10:37 PM, Pieter Degraeuwe >> >> >> <[email protected]> wrote: >> >> >> > Your cart has a reference to the sessionBean ShopingCart. This is >> not >> >> >> > allowed, however. The IOC incjectionsupport makes this possible by >> >> >> wrapping >> >> >> > this EJB reference with a serializable proxy. >> >> >> > >> >> >> > I only have expecience with wicket-spring end it works great. (In >> your >> >> >> case, >> >> >> > define your ejb reference in spring and inject it via wicket-spring >> >> >> support >> >> >> > in your page. >> >> >> > problem solved! >> >> >> > >> >> >> > Pieter >> >> >> > >> >> >> > On Wed, Nov 18, 2009 at 10:50 PM, VGJ <[email protected]> wrote: >> >> >> > >> >> >> >> I'm completely at wits end here and I hope someone can point out >> >> what's >> >> >> >> wrong. >> >> >> >> >> >> >> >> I've got an e-commerce application that is simply moving between >> two >> >> >> pages >> >> >> >> using setRedirectPage() when going from a product detail page to >> the >> >> >> >> shopping cart page. There isn't anything remarkable about either >> of >> >> >> these >> >> >> >> two pages, they're basically like any other in the app. However, >> >> when >> >> >> the >> >> >> >> cart page loads, I get the exception at the bottom of this >> message. >> >> >> >> >> >> >> >> I've tried implementing Serializable on the Cart() page class but >> it >> >> >> makes >> >> >> >> no difference. It points out >> >> >> >> "com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate" >> as >> >> the >> >> >> >> culprit. I use a stateful session bean (ShoppingCart) which is >> >> passed >> >> >> >> around the app as part of the session (custom WebSession-derived >> >> class) >> >> >> >> >> >> >> >> This is the only page this occurs on. There are several other >> steps >> >> in >> >> >> the >> >> >> >> cart's checkout process that look exactly like this one and the >> >> >> exception >> >> >> >> doesn't happen on any of the others >> >> >> >> >> >> >> >> Any ideas? >> >> >> >> >> >> >> >> Exception: >> >> >> >> >> >> >> >> 25717 [httpSSLWorkerThread-8080-1] ERROR >> >> >> >> org.apache.wicket.util.lang.Objects >> >> >> >> - Error serializing object class com.myapp.ui.Cart [object=[Page >> >> class = >> >> >> >> com.myapp.ui.Cart, id = 3, version = 0]] >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException: >> >> >> >> Unable to serialize class: >> >> >> >> com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate >> >> >> >> Field hierarchy is: >> >> >> >> 3 [class=com.myapp.ui.Cart, path=3] >> >> >> >> private java.lang.Object >> >> org.apache.wicket.MarkupContainer.children >> >> >> >> [class=[Ljava.lang.Object;] >> >> >> >> private >> >> >> >> org.apache.wicket.markup.html.ContainerWithAssociatedMarkupHelper >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.wicket.markup.html.WebMarkupContainerWithAssociatedMarkup.markupHelper[6] >> >> >> >> [class=org.apache.wicket.markup.html.form.Form, path=3:cartForm] >> >> >> >> private java.lang.Object >> >> >> org.apache.wicket.MarkupContainer.children >> >> >> >> [class=[Ljava.lang.Object;] >> >> >> >> private java.lang.Object >> >> >> >> org.apache.wicket.MarkupContainer.children[0] >> >> >> [class=com.myapp.ui.Cart$1, >> >> >> >> path=3:cartForm:orderLinesView] >> >> >> >> final com.myapp.session.ShoppingCartLocal >> >> >> >> com.myapp.ui.Cart$1.val$cart [class=$Proxy92] >> >> >> >> protected java.lang.reflect.InvocationHandler >> >> >> >> java.lang.reflect.Proxy.h >> >> >> >> >> >> [class=com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate] >> >> >> >> <----- field that is not serializable >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:346) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:615) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:538) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:615) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:538) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:392) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:615) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:538) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:392) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:615) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:538) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.wicket.util.io.SerializableChecker.writeObjectOverride(SerializableChecker.java:684) >> >> >> >> at >> >> >> >> >> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:322) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.wicket.util.io.IObjectStreamFactory$DefaultObjectStreamFactory$2.writeObjectOverride(IObjectStreamFactory.java:129) >> >> >> >> at >> >> >> >> >> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:322) >> >> >> >> at >> >> >> >> >> >> org.apache.wicket.util.lang.Objects.objectToByteArray(Objects.java:1120) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.wicket.protocol.http.pagestore.AbstractPageStore.serializePage(AbstractPageStore.java:203) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.wicket.protocol.http.pagestore.DiskPageStore.storePage(DiskPageStore.java:840) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.wicket.protocol.http.SecondLevelCacheSessionStore$SecondLevelCachePageMap.put(SecondLevelCacheSessionStore.java:332) >> >> >> >> at >> >> org.apache.wicket.Session.requestDetached(Session.java:1404) >> >> >> >> at >> >> org.apache.wicket.RequestCycle.detach(RequestCycle.java:1176) >> >> >> >> at >> >> org.apache.wicket.RequestCycle.steps(RequestCycle.java:1454) >> >> >> >> at >> >> org.apache.wicket.RequestCycle.request(RequestCycle.java:545) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:456) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:289) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577) >> >> >> >> at >> >> com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571) >> >> >> >> at >> >> >> >> >> >> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571) >> >> >> >> at >> >> >> >> >> >> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080) >> >> >> >> at >> >> >> >> >> >> org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214) >> >> >> >> at >> >> >> >> >> >> com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265) >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106) >> >> >> >> Caused by: java.io.NotSerializableException: >> >> >> >> com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate >> >> >> >> 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.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.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$DefaultObjectStreamFactory$2.writeObjectOverride(IObjectStreamFactory.java:121) >> >> >> >> ... 38 more >> >> >> >> >> >> >> > >> >> >> > >> >> >> > >> >> >> > -- >> >> >> > Pieter Degraeuwe >> >> >> > Systemworks bvba >> >> >> > Belgiëlaan 61 >> >> >> > 9070 Destelbergen >> >> >> > GSM: +32 (0)485/68.60.85 >> >> >> > Email: [email protected] >> >> >> > visit us at http://www.systemworks.be >> >> >> > >> >> >> >> >> >> --------------------------------------------------------------------- >> >> >> To unsubscribe, e-mail: [email protected] >> >> >> For additional commands, e-mail: [email protected] >> >> >> >> >> >> >> >> > >> >> >> >> --------------------------------------------------------------------- >> >> To unsubscribe, e-mail: [email protected] >> >> For additional commands, e-mail: [email protected] >> >> >> >> >> > >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
