HTTP sessions and hence Wicket Pages get serialized and hence all it
components and variable must be serializable or transient. We enforced
that policy a little bit to make sure the error are detected earlier
and late when the application is deployed already. Just make sure your
components and component variable implement Serializable.

wicket.WicketRuntimeException: Internal error cloning object. Make sure
all dependent objects implement Serializable. Class:
wicket.util.tester.DummyHomePage


On 6/21/06, Gert Jan Verhoog <[EMAIL PROTECTED]> wrote:
> Hi list,
>
> After upgrading to Wicket 1.2, wicket tests for my project don't work
> anymore. Testing a page that is initialized using a custom constructor
> causes a WicketRuntimeException:
>
> wicket.WicketRuntimeException: Internal error cloning object. Make sure
> all dependent objects implement Serializable. Class:
> wicket.util.tester.DummyHomePage
>   at
> wicket.protocol.http.HttpSessionStore.setAttribute(HttpSessionStore.java:62)
> [... bits of stacktrace omitted for brevity ...]
> Caused by: java.io.NotSerializableException: com.example.MyPageTest$1
>        at 
> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1075)
>        at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
> [... rest of stacktrace omitted for brevity ...]
>
>
> I created the initialized page with an anonymous ITestPageSource, as per
> the WicketTester javadocs.
>
> Consider the following example code that causes the error:
>
> MyPage.html:
> - - - - - - - - - - - - - - - - - - - - - - - - - -
> <html xmlns:wicket="http://wicket.sourceforge.net/";>
>   <head><title>bla</title></head>
>   <body>
>     <h1><span wicket:id="title">(title)</span></h1>
>   </body>
> </html>
> - - - - - - - - - - - - - - - - - - - - - - - - - -
>
>
> MyPage.java:
> - - - - - - - - - - - - - - - - - - - - - - - - - -
> package com.example;
>
> import wicket.markup.html.WebPage;
> import wicket.markup.html.basic.Label;
>
> public class MyPage extends WebPage {
>
>   public MyPage() {
>     this("empty");
>   }
>
>   public MyPage(String title) {
>     add(new Label("title",title));
>   }
> }
> - - - - - - - - - - - - - - - - - - - - - - - - - -
>
>
> and finally, MyPageTest.java:
> - - - - - - - - - - - - - - - - - - - - - - - - - -
> package com.example;
>
> import junit.framework.TestCase;
> import wicket.Page;
> import wicket.util.tester.ITestPageSource;
> import wicket.util.tester.WicketTester;
>
> public class MyPageTest extends TestCase {
>
>   public void testRenderMyPage() {
>     WicketTester tester = new WicketTester();
>
>     // the following statement throws the exception:
>     tester.startPage(new ITestPageSource() {
>       public Page getTestPage() {
>         return new MyPage("hello world");
>       }
>     });
>   }
> }
> - - - - - - - - - - - - - - - - - - - - - - - - - -
>
> What's happening here? Most of my pages use custom constructors to
> initialize the page, and every test method that use these cause the
> error. What can I do about it?
>
> cheers,
> Gert
>
>
> --
> Gert Jan Verhoog
> Func. Internet Integration
> W http://www.func.nl
> T +31 30 2109750
> F +31 30 2109751
>
>
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>


_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to