[Wicket-user] Why does everything need to be Serializable when I use AjaxEventBehavior?
I'm a wicket newbie, but have been making relatively steady progress on a new webapp. I have an ExternalLink which is part of a Panel, and I want to make it notify the server asynchronously when the user clicks on it, so I've added an AjaxEventBehavior as follows: ExternalLink titleLink = new ExternalLink(title, link, title); titleLink.add(new AjaxEventBehavior(onclick) { protected void onEvent(AjaxRequestTarget target) { log.debug(Clicked title); } }); I do this and suddenly I start getting WicketMessage: Internal error cloning object. Make sure all dependent objects implement Serializable. ... messages for all sorts of different classes, when I make one Serializable per the error messages suggestion, it complains about another one. What is going on? Why does my attempt to use Ajax suddenly mean that all of these classes need to be Serializable? Thanks, Ian. PS. Here is an example of the full error: WicketMessage: Internal error cloning object. Make sure all dependent objects implement Serializable. Class: thoof.Index Root cause: java.io.NotSerializableException: thoof.model.Story at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1151) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326) at java.util.ArrayList.writeObject(ArrayList.java:570) at java.lang.reflect.Method.invoke(Method.java:589) at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1456) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1387) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1145) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1504) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1387) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1145) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1504) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1387) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1145) at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1333) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1141) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1504) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1387) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1145) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326) at wicket.protocol.http.HttpSessionStore.setAttribute(HttpSessionStore.java:57) at wicket.Session.setAttribute(Session.java:930) at wicket.PageMap.put(PageMap.java:526) at wicket.Session.touch(Session.java:718) at wicket.Page.renderPage(Page.java:416) at wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:226) at wicket.request.compound.DefaultResponseStrategy.respond(DefaultResponseStrategy.java:49) at wicket.request.compound.AbstractCompoundRequestCycleProcessor.respond(AbstractCompoundRequestCycleProcessor.java:66) at wicket.RequestCycle.doProcessEventsAndRespond(RequestCycle.java:858) at wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:885) at wicket.RequestCycle.step(RequestCycle.java:966) at wicket.RequestCycle.steps(RequestCycle.java:1040) at wicket.RequestCycle.request(RequestCycle.java:454) at wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:216) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:358) at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:294) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567) at org.mortbay.http.HttpContext.handle(HttpContext.java:1807) at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:525) at org.mortbay.http.HttpContext.handle(HttpContext.java:1757) at org.mortbay.http.HttpServer.service(HttpServer.java:879) at org.mortbay.http.HttpConnection.service(HttpConnection.java:789) at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:960) at org.mortbay.http.HttpConnection.handle(HttpConnection.java:806) at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:218) at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:331) at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:520) Complete stack: wicket.WicketRuntimeException: Internal error cloning object. Make sure all dependent
Re: [Wicket-user] Why does everything need to be Serializable when I use AjaxEventBehavior?
Somewhere you're holding a reference to the thoof.model.Story object, which is (or is attempted to be) serialized along with the referencing component to the user's session. You should look into detachable models to get around this. There are other ways to do it, but understanding detachable models in Wicket will make your life easier. Let me know if you still have questions. On 12/17/06, Ian Clarke [EMAIL PROTECTED] wrote: I'm a wicket newbie, but have been making relatively steady progress on a new webapp. I have an ExternalLink which is part of a Panel, and I want to make it notify the server asynchronously when the user clicks on it, so I've added an AjaxEventBehavior as follows: ExternalLink titleLink = new ExternalLink(title, link, title); titleLink.add(new AjaxEventBehavior(onclick) { protected void onEvent(AjaxRequestTarget target) { log.debug(Clicked title); } }); I do this and suddenly I start getting WicketMessage: Internal error cloning object. Make sure all dependent objects implement Serializable. ... messages for all sorts of different classes, when I make one Serializable per the error messages suggestion, it complains about another one. What is going on? Why does my attempt to use Ajax suddenly mean that all of these classes need to be Serializable? Thanks, Ian. PS. Here is an example of the full error: WicketMessage: Internal error cloning object. Make sure all dependent objects implement Serializable. Class: thoof.Index Root cause: java.io.NotSerializableException: thoof.model.Story at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1151) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326) at java.util.ArrayList.writeObject(ArrayList.java:570) at java.lang.reflect.Method.invoke(Method.java:589) at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java :1456) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java :1387) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1145) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java :1504) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java :1469) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java :1387) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1145) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java :1504) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java :1469) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java :1387) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1145) at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1333) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1141) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java :1504) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java :1469) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java :1387) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1145) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326) at wicket.protocol.http.HttpSessionStore.setAttribute( HttpSessionStore.java:57) at wicket.Session.setAttribute(Session.java:930) at wicket.PageMap.put(PageMap.java:526) at wicket.Session.touch(Session.java:718) at wicket.Page.renderPage(Page.java:416) at wicket.request.target.component.BookmarkablePageRequestTarget.respond( BookmarkablePageRequestTarget.java:226) at wicket.request.compound.DefaultResponseStrategy.respond( DefaultResponseStrategy.java:49) at wicket.request.compound.AbstractCompoundRequestCycleProcessor.respond( AbstractCompoundRequestCycleProcessor.java:66) at wicket.RequestCycle.doProcessEventsAndRespond(RequestCycle.java:858) at wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:885) at wicket.RequestCycle.step(RequestCycle.java:966) at wicket.RequestCycle.steps(RequestCycle.java:1040) at wicket.RequestCycle.request(RequestCycle.java:454) at wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:216) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:358) at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch( WebApplicationHandler.java:294) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java :567) at org.mortbay.http.HttpContext.handle(HttpContext.java:1807) at org.mortbay.jetty.servlet.WebApplicationContext.handle( WebApplicationContext.java:525) at org.mortbay.http.HttpContext.handle(HttpContext.java:1757) at org.mortbay.http.HttpServer.service(HttpServer.java:879) at org.mortbay.http.HttpConnection.service(HttpConnection.java:789) at
Re: [Wicket-user] Why does everything need to be Serializable when I use AjaxEventBehavior?
On 12/17/06, Nick Heudecker [EMAIL PROTECTED] wrote: Somewhere you're holding a reference to the thoof.model.Story object, which is (or is attempted to be) serialized along with the referencing component to the user's session. You should look into detachable models to get around this. There are other ways to do it, but understanding detachable models in Wicket will make your life easier. Let me know if you still have questions. Thanks for the help Nick, you were right, and with the help of mr_smith on ##wicket, I was able to solve the problem - which essentially boiled down to me not using Models where I should be using Models. The fact that there are people so willing to provide advice and help is a big vindication for my decision to go with Wicket for my current project, and bodes well for Wicket's future - thanks! An unrelated question: I'm currently using Wicket 1.2.2. I know the current version is 1.2.3, and there is a 2.0 in the works. My project is scheduled for launch around April of next year, and we have used Quickstart as a starting point. Should we be thinking about upgrading now or later? Are there major advances in these new versions? Ian. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Why does everything need to be Serializable when I use AjaxEventBehavior?
Hi Ian, Since you are replying to another thread your question will probably go unnoticed. In addition the threads on nabble.com get polluted. So the message is: please only reply when you have a reply. Meanwhile: the question is very valid, so you could resend it. Regards, Erik. Ian Clarke schreef: An unrelated question: I'm currently using Wicket 1.2.2. I know the current version is 1.2.3, and there is a 2.0 in the works. My project is scheduled for launch around April of next year, and we have used Quickstart as a starting point. Should we be thinking about upgrading now or later? Are there major advances in these new versions? Ian. -- Erik van Oosten http://www.day-to-day-stuff.blogspot.com/ - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user