Juergen Donnerstag wrote:
> 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.

I am aware of that. Please look at the example code I included in my 
previous post. It's a trivial WebPage with a single label, and some 
WicketTester test code. That's all that's needed to cause the exception. 
   This is code that I almost copied verbatim from the WicketTester api 
docs.

There are no custom beans, so I don't see what I could make 
Serializable. In the actual project where I'm running into these 
problems, all beans are serializable or transient, and all business 
objects are injected with Spring proxies. (using @SpringBean annotations).

The webapplication runs fine, it's *just* the WicketTester code that fails.

Maybe there is a simple solution to this problem, but I'm obviously 
overlooking it.

cheers,
Gert



> 
> 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


-- 
Gert Jan Verhoog
Func. Internet Integration
W http://www.func.nl
T +31 30 2109750
F +31 30 2109751

All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to