The point is that those tabs shouldn't be serialized at all; this is the entire trick behind the annotation. This seams to be a bug in PW. I'll try to nail it down.
Kind regards, Andreas 2011/8/12 Łukasz Dywicki <[email protected]> > Well, maybe that is because messy versions of artifacts I had installed in > my Karaf copy, but generally - always when I wanted open page different than > Dashboard I've got a: > > 13:17:04,076 | ERROR | 9573-279 - /cns/ | Objects > | .apache.wicket.util.lang.Objects 1138 | 110 - > org.ops4j.pax.wicket.service - 0.8.0.SNAPSHOT | Error serializing object > class org.apache.karaf.webconsole.core.internal.DashboardPage [object=[Page > class = org.apache.karaf.webconsole.core.internal.DashboardPage, id = 1, > version = 0]] > org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException: > Unable to serialize class: org.apache.felix.framework.BundleContextImpl > Field hierarchy is: > 1 [class=org.apache.karaf.webconsole.core.internal.DashboardPage, path=1] > private java.lang.Object org.apache.wicket.MarkupContainer.children > [class=[Ljava.lang.Object;] > java.lang.Object org.apache.wicket.Component.data[1] > [class=org.apache.karaf.webconsole.core.BasePage$1, path=1:tabs] > java.lang.Object org.apache.wicket.Component.data > [class=org.apache.wicket.model.util.WildcardListModel] > private java.lang.Object > org.apache.wicket.model.util.GenericBaseModel.object > [class=org.ops4j.pax.wicket.util.proxy.$Proxy63] > private final > org.ops4j.pax.wicket.util.proxy.IProxyTargetLocator > org.ops4j.pax.wicket.util.proxy.LazyInitProxyFactory$ProxyReplacement.locator > [class=org.ops4j.pax.wicket.internal.injection.blueprint.BlueprintBeanProxyTargetLocator] > private org.osgi.framework.BundleContext > org.ops4j.pax.wicket.internal.injection.AbstractProxyTargetLocator.bundleContext > [class=org.apache.felix.framework.BundleContextImpl] <----- field that is > not serializable > > Making tabs transient solved this problem and allowed Pax-Wicket to inject > new value every time without need to take care about serialization. So far > it works. > > Regards, > Lukasz > > > Did you encounter an error that you've added transient here? This > shouldn't > > be required. > > > > Kind regards, > > Andreas > > On Aug 12, 2011 1:23 PM, <[email protected]> wrote: > >> Author: ldywicki > >> Date: Fri Aug 12 11:22:33 2011 > >> New Revision: 1157052 > >> > >> URL: http://svn.apache.org/viewvc?rev=1157052&view=rev > >> Log: > >> Fix problem with serialization of @PaxWicketBean annotated field > >> > >> Modified: > >> > > > karaf/sandbox/pieber/karaf-webconsole/trunk/core/src/main/java/org/apache/karaf/webconsole/core/BasePage.java > >> > >> Modified: > > > karaf/sandbox/pieber/karaf-webconsole/trunk/core/src/main/java/org/apache/karaf/webconsole/core/BasePage.java > >> URL: > > > http://svn.apache.org/viewvc/karaf/sandbox/pieber/karaf-webconsole/trunk/core/src/main/java/org/apache/karaf/webconsole/core/BasePage.java?rev=1157052&r1=1157051&r2=1157052&view=diff > >> > > > ============================================================================== > >> --- > > > karaf/sandbox/pieber/karaf-webconsole/trunk/core/src/main/java/org/apache/karaf/webconsole/core/BasePage.java > > (original) > >> +++ > > > karaf/sandbox/pieber/karaf-webconsole/trunk/core/src/main/java/org/apache/karaf/webconsole/core/BasePage.java > > Fri Aug 12 11:22:33 2011 > >> @@ -5,6 +5,7 @@ import org.apache.wicket.extensions.mark > >> import org.apache.wicket.markup.html.CSSPackageResource; > >> import org.apache.wicket.markup.html.WebPage; > >> import org.apache.wicket.markup.html.basic.Label; > >> +import org.apache.wicket.markup.html.link.BookmarkablePageLink; > >> import org.apache.wicket.markup.html.link.PageLink; > >> import org.apache.wicket.markup.html.list.ListItem; > >> import org.apache.wicket.markup.html.list.ListView; > >> @@ -19,7 +20,7 @@ import java.util.List; > >> public class BasePage extends WebPage { > >> > >> @PaxWicketBean(name = "tabs") > >> - private List<ConsoleTab> tabs; > >> + private transient List<ConsoleTab> tabs; > >> > >> public BasePage() { > >> add(CSSPackageResource.getHeaderContribution(BasePage.class, > > "style.css")); > >> @@ -30,14 +31,14 @@ public class BasePage extends WebPage { > >> @Override > >> protected void populateItem(ListItem<ConsoleTab> item) { > >> final ConsoleTab tab = item.getModelObject(); > >> - item.add(new PageLink("moduleLink", tab.getModuleHomePage()).add(new > > Label("moduleLabel", tab.getLabel()))); > >> + item.add(new BookmarkablePageLink("moduleLink", > > tab.getModuleHomePage()).add(new Label("moduleLabel", tab.getLabel()))); > >> > >> List<String> subItems = new LinkedList<String>(tab.getItems().keySet()); > >> item.add(new ListView<String>("topLinks", subItems) { > >> @Override > >> protected void populateItem(ListItem<String> item) { > >> String subItem = item.getModelObject(); > >> - item.add(new PageLink("topLink", tab.getItems().get(subItem)).add(new > > Label("linkLabel", subItem))); > >> + item.add(new BookmarkablePageLink("topLink", > > tab.getItems().get(subItem)).add(new Label("linkLabel", subItem))); > >> } > >> }); > >> } > >> > >> > >
