You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by nino martinez wael <ni...@gmail.com> on 2012/03/21 07:55:32 UTC

Serialize exceptions

Hi I get a serialize exception in a panel of mine its correct that one of
the contained fields cannot be serialized, however this field are injected
and should not be touched by the checker, the field are marked with the
@inject  annotation. I'm using guice for injection.. Any thing obvious
wrong with this?

Re: Serialize exceptions

Posted by nino martinez wael <ni...@gmail.com>.
It returnes only external named classes... Which in turn are used by
another wicket panel down the road, I guess that could be the cause....
Will check tomorrow.. Thanks for hint.
On Mar 22, 2012 5:27 PM, "Dan Retzlaff" <dr...@gmail.com> wrote:

> Does WallBoardMainDataProvider return a non-static inner class that retains
> a reference to the non-proxied implementation?
>
> FWIW, we avoid @Inject'ed IDataProviders since they tend to retain state
> (filter/query params etc), and instead give them their service proxies with
> Injector.get().inject(this) in their constructors.
>
> On Thu, Mar 22, 2012 at 7:56 AM, nino martinez wael <
> nino.martinez.wael@gmail.com> wrote:
>
> > Hi heres a part of the stacktrace, im wondering why it bypasses the
> proxy,
> > I thought it would never venture beyond that:
> >
> > 2012-03-22 15:51:55,739 ERROR
> > [org.apache.wicket.serialize.java.JavaSerializer]  - Error serializing
> > object class com.netdesign.wallboard.page.ViewerPage [object=[Page class
> =
> > com.netdesign.wallboard.page.ViewerPage, id = 6, render count = 1]]
> >
> >
> org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException:
> > Unable to serialize class: com.google.inject.internal.InjectorImpl$4
> > Field hierarchy is:
> >  6 [class=com.netdesign.wallboard.page.ViewerPage, path=6]
> >    private java.lang.Object org.apache.wicket.MarkupContainer.children
> > [class=com.netdesign.wallboard.panel.WallboardShowPanel,
> > path=6:wallboardShow]
> >      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.netdesign.wallboard.panel.WallboardShowPanel$1,
> > path=6:wallboardShow:columnList]
> >          private java.lang.Object
> > org.apache.wicket.MarkupContainer.children [class=[Ljava.lang.Object;]
> >            private final java.lang.annotation.Annotation
> > org.apache.wicket.guice.GuiceProxyTargetLocator.bindingAnnotation[2]
> > [class=org.apache.wicket.markup.html.list.ListItem,
> > path=6:wallboardShow:columnList:2]
> >              private java.lang.Object
> > org.apache.wicket.MarkupContainer.children
> > [class=com.netdesign.wallboard.panel.DisplayItemShowPanel,
> > path=6:wallboardShow:columnList:2:column]
> >                private java.lang.Object
> > org.apache.wicket.MarkupContainer.children [class=[Ljava.lang.Object;]
> >                  java.lang.Object org.apache.wicket.Component.data[1]
> > [class=com.netdesign.wallboard.panel.DisplayItemShowPanel$1,
> > path=6:wallboardShow:columnList:2:column:list]
> >                    private java.lang.Object
> > org.apache.wicket.MarkupContainer.children [class=[Ljava.lang.Object;]
> >                      private java.lang.Object
> > org.apache.wicket.MarkupContainer.children[0]
> > [class=org.apache.wicket.markup.html.list.ListItem,
> > path=6:wallboardShow:columnList:2:column:list:0]
> >                        private java.lang.Object
> > org.apache.wicket.MarkupContainer.children
> > [class=com.netdesign.remedy.panel.DisplayItemRemedyShowPanel,
> > path=6:wallboardShow:columnList:2:column:list:0:displayItemShowPanel]
> >                          private java.lang.Object
> > org.apache.wicket.MarkupContainer.children
> > [class=com.netdesign.remedy.panel.DisplayItemRemedyShowPanel$1,
> >
> >
> path=6:wallboardShow:columnList:2:column:list:0:displayItemShowPanel:remedyItems]
> >                            java.lang.Object
> > org.apache.wicket.Component.data
> > [class=com.netdesign.remedy.provider.RemedyWallboardViewerProvider$2]
> >                              final
> > com.netdesign.remedy.provider.RemedyWallboardViewerProvider
> > com.netdesign.remedy.provider.RemedyWallboardViewerProvider$2.this$0
> > [class=com.netdesign.remedy.provider.RemedyWallboardViewerProvider]
> >                                private
> > com.netdesign.wallboard.core.interfaces.WallBoardMainDataProvider
> >
> >
> com.netdesign.remedy.provider.RemedyWallboardViewerProvider.wallBoardMainDataProvider
> > [class=com.netdesign.wallboard.core.WallboardMainDataProviderImpl]
> >                                  private
> > com.netdesign.wallboard.core.dao.CoreDaoService
> > com.netdesign.wallboard.core.WallboardMainDataProviderImpl.coreDaoService
> >
> >
> [class=com.netdesign.wallboard.core.dao.CoreDaoServiceImp$$EnhancerByGuice$$29968411]
> >                                    protected com.google.inject.Provider
> > com.netdesign.wallboard.core.dao.CoreDaoServiceImp.em
> > [class=com.google.inject.internal.InjectorImpl$4] <----- field that is
> not
> > serializable
> > at
> >
> >
> org.apache.wicket.util.io.SerializableChecker.internalCheck(SerializableChecker.java:386)
> >
> > Part of matching code:
> >
> >
> > public class DisplayItemRemedyShowPanel extends Panel {
> >
> > @Inject
> > private WallBoardMainDataProvider wallBoardMainDataProvider;
> >
> > private Logger logger = LoggerFactory
> > .getLogger(DisplayItemRemedyShowPanel.class);
> >
> > public DisplayItemRemedyShowPanel(String id, final String queue,
> > final IModel<List<RemedyItem>> RemedyItemsModel, final RemedyDisplayItem
> > remedyDisplayItem) {
> >
> >
> > AND when debugging wallBoardMainDataProvider is wrapped by a proxy.. Of
> > course the internals of the target of the proxy are not.
> >
> > 2012/3/21 Martin Grigorov <mg...@apache.org>
> >
> > > Wicket-Guice will inject serializable Proxy.
> > > It seems Guice's plain Injector injects the binding. Check why.
> > >
> > > On Wed, Mar 21, 2012 at 9:55 AM, Wilhelmsen Tor Iver <
> TorIverW@arrive.no
> > >
> > > wrote:
> > > >> Hi I get a serialize exception in a panel of mine its correct that
> one
> > > of the contained fields cannot be serialized, however this field are
> > > injected and should not be touched by the checker, the field are marked
> > > with the @inject  annotation. I'm using guice for injection.. Any thing
> > > obvious wrong with this?
> > > >
> > > > Java serialization does not care for that annotation, only whether it
> > is
> > > declared transient or sports the Serializable marker interface. Frankly
> > it
> > > baffles me that they didn't just default to letting everything be
> > > serializable and let the programmer deal with stuff that's not supposed
> > to
> > > be, since it otherwise just causes endless exceptions and adding an
> > > otherwise pointless interface inheritance...
> > > >
> > > > - Tor Iver
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > >
> > >
> > >
> > >
> > > --
> > > Martin Grigorov
> > > jWeekend
> > > Training, Consulting, Development
> > > http://jWeekend.com
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> >
> > --
> > Best regards / Med venlig hilsen
> > Nino Martinez
> >
>

Re: Serialize exceptions

Posted by Dan Retzlaff <dr...@gmail.com>.
Does WallBoardMainDataProvider return a non-static inner class that retains
a reference to the non-proxied implementation?

FWIW, we avoid @Inject'ed IDataProviders since they tend to retain state
(filter/query params etc), and instead give them their service proxies with
Injector.get().inject(this) in their constructors.

On Thu, Mar 22, 2012 at 7:56 AM, nino martinez wael <
nino.martinez.wael@gmail.com> wrote:

> Hi heres a part of the stacktrace, im wondering why it bypasses the proxy,
> I thought it would never venture beyond that:
>
> 2012-03-22 15:51:55,739 ERROR
> [org.apache.wicket.serialize.java.JavaSerializer]  - Error serializing
> object class com.netdesign.wallboard.page.ViewerPage [object=[Page class =
> com.netdesign.wallboard.page.ViewerPage, id = 6, render count = 1]]
>
> org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException:
> Unable to serialize class: com.google.inject.internal.InjectorImpl$4
> Field hierarchy is:
>  6 [class=com.netdesign.wallboard.page.ViewerPage, path=6]
>    private java.lang.Object org.apache.wicket.MarkupContainer.children
> [class=com.netdesign.wallboard.panel.WallboardShowPanel,
> path=6:wallboardShow]
>      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.netdesign.wallboard.panel.WallboardShowPanel$1,
> path=6:wallboardShow:columnList]
>          private java.lang.Object
> org.apache.wicket.MarkupContainer.children [class=[Ljava.lang.Object;]
>            private final java.lang.annotation.Annotation
> org.apache.wicket.guice.GuiceProxyTargetLocator.bindingAnnotation[2]
> [class=org.apache.wicket.markup.html.list.ListItem,
> path=6:wallboardShow:columnList:2]
>              private java.lang.Object
> org.apache.wicket.MarkupContainer.children
> [class=com.netdesign.wallboard.panel.DisplayItemShowPanel,
> path=6:wallboardShow:columnList:2:column]
>                private java.lang.Object
> org.apache.wicket.MarkupContainer.children [class=[Ljava.lang.Object;]
>                  java.lang.Object org.apache.wicket.Component.data[1]
> [class=com.netdesign.wallboard.panel.DisplayItemShowPanel$1,
> path=6:wallboardShow:columnList:2:column:list]
>                    private java.lang.Object
> org.apache.wicket.MarkupContainer.children [class=[Ljava.lang.Object;]
>                      private java.lang.Object
> org.apache.wicket.MarkupContainer.children[0]
> [class=org.apache.wicket.markup.html.list.ListItem,
> path=6:wallboardShow:columnList:2:column:list:0]
>                        private java.lang.Object
> org.apache.wicket.MarkupContainer.children
> [class=com.netdesign.remedy.panel.DisplayItemRemedyShowPanel,
> path=6:wallboardShow:columnList:2:column:list:0:displayItemShowPanel]
>                          private java.lang.Object
> org.apache.wicket.MarkupContainer.children
> [class=com.netdesign.remedy.panel.DisplayItemRemedyShowPanel$1,
>
> path=6:wallboardShow:columnList:2:column:list:0:displayItemShowPanel:remedyItems]
>                            java.lang.Object
> org.apache.wicket.Component.data
> [class=com.netdesign.remedy.provider.RemedyWallboardViewerProvider$2]
>                              final
> com.netdesign.remedy.provider.RemedyWallboardViewerProvider
> com.netdesign.remedy.provider.RemedyWallboardViewerProvider$2.this$0
> [class=com.netdesign.remedy.provider.RemedyWallboardViewerProvider]
>                                private
> com.netdesign.wallboard.core.interfaces.WallBoardMainDataProvider
>
> com.netdesign.remedy.provider.RemedyWallboardViewerProvider.wallBoardMainDataProvider
> [class=com.netdesign.wallboard.core.WallboardMainDataProviderImpl]
>                                  private
> com.netdesign.wallboard.core.dao.CoreDaoService
> com.netdesign.wallboard.core.WallboardMainDataProviderImpl.coreDaoService
>
> [class=com.netdesign.wallboard.core.dao.CoreDaoServiceImp$$EnhancerByGuice$$29968411]
>                                    protected com.google.inject.Provider
> com.netdesign.wallboard.core.dao.CoreDaoServiceImp.em
> [class=com.google.inject.internal.InjectorImpl$4] <----- field that is not
> serializable
> at
>
> org.apache.wicket.util.io.SerializableChecker.internalCheck(SerializableChecker.java:386)
>
> Part of matching code:
>
>
> public class DisplayItemRemedyShowPanel extends Panel {
>
> @Inject
> private WallBoardMainDataProvider wallBoardMainDataProvider;
>
> private Logger logger = LoggerFactory
> .getLogger(DisplayItemRemedyShowPanel.class);
>
> public DisplayItemRemedyShowPanel(String id, final String queue,
> final IModel<List<RemedyItem>> RemedyItemsModel, final RemedyDisplayItem
> remedyDisplayItem) {
>
>
> AND when debugging wallBoardMainDataProvider is wrapped by a proxy.. Of
> course the internals of the target of the proxy are not.
>
> 2012/3/21 Martin Grigorov <mg...@apache.org>
>
> > Wicket-Guice will inject serializable Proxy.
> > It seems Guice's plain Injector injects the binding. Check why.
> >
> > On Wed, Mar 21, 2012 at 9:55 AM, Wilhelmsen Tor Iver <TorIverW@arrive.no
> >
> > wrote:
> > >> Hi I get a serialize exception in a panel of mine its correct that one
> > of the contained fields cannot be serialized, however this field are
> > injected and should not be touched by the checker, the field are marked
> > with the @inject  annotation. I'm using guice for injection.. Any thing
> > obvious wrong with this?
> > >
> > > Java serialization does not care for that annotation, only whether it
> is
> > declared transient or sports the Serializable marker interface. Frankly
> it
> > baffles me that they didn't just default to letting everything be
> > serializable and let the programmer deal with stuff that's not supposed
> to
> > be, since it otherwise just causes endless exceptions and adding an
> > otherwise pointless interface inheritance...
> > >
> > > - Tor Iver
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> >
> >
> >
> > --
> > Martin Grigorov
> > jWeekend
> > Training, Consulting, Development
> > http://jWeekend.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
> Best regards / Med venlig hilsen
> Nino Martinez
>

Re: Serialize exceptions

Posted by nino martinez wael <ni...@gmail.com>.
Hi heres a part of the stacktrace, im wondering why it bypasses the proxy,
I thought it would never venture beyond that:

2012-03-22 15:51:55,739 ERROR
[org.apache.wicket.serialize.java.JavaSerializer]  - Error serializing
object class com.netdesign.wallboard.page.ViewerPage [object=[Page class =
com.netdesign.wallboard.page.ViewerPage, id = 6, render count = 1]]
org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException:
Unable to serialize class: com.google.inject.internal.InjectorImpl$4
Field hierarchy is:
  6 [class=com.netdesign.wallboard.page.ViewerPage, path=6]
    private java.lang.Object org.apache.wicket.MarkupContainer.children
[class=com.netdesign.wallboard.panel.WallboardShowPanel,
path=6:wallboardShow]
      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.netdesign.wallboard.panel.WallboardShowPanel$1,
path=6:wallboardShow:columnList]
          private java.lang.Object
org.apache.wicket.MarkupContainer.children [class=[Ljava.lang.Object;]
            private final java.lang.annotation.Annotation
org.apache.wicket.guice.GuiceProxyTargetLocator.bindingAnnotation[2]
[class=org.apache.wicket.markup.html.list.ListItem,
path=6:wallboardShow:columnList:2]
              private java.lang.Object
org.apache.wicket.MarkupContainer.children
[class=com.netdesign.wallboard.panel.DisplayItemShowPanel,
path=6:wallboardShow:columnList:2:column]
                private java.lang.Object
org.apache.wicket.MarkupContainer.children [class=[Ljava.lang.Object;]
                  java.lang.Object org.apache.wicket.Component.data[1]
[class=com.netdesign.wallboard.panel.DisplayItemShowPanel$1,
path=6:wallboardShow:columnList:2:column:list]
                    private java.lang.Object
org.apache.wicket.MarkupContainer.children [class=[Ljava.lang.Object;]
                      private java.lang.Object
org.apache.wicket.MarkupContainer.children[0]
[class=org.apache.wicket.markup.html.list.ListItem,
path=6:wallboardShow:columnList:2:column:list:0]
                        private java.lang.Object
org.apache.wicket.MarkupContainer.children
[class=com.netdesign.remedy.panel.DisplayItemRemedyShowPanel,
path=6:wallboardShow:columnList:2:column:list:0:displayItemShowPanel]
                          private java.lang.Object
org.apache.wicket.MarkupContainer.children
[class=com.netdesign.remedy.panel.DisplayItemRemedyShowPanel$1,
path=6:wallboardShow:columnList:2:column:list:0:displayItemShowPanel:remedyItems]
                            java.lang.Object
org.apache.wicket.Component.data
[class=com.netdesign.remedy.provider.RemedyWallboardViewerProvider$2]
                              final
com.netdesign.remedy.provider.RemedyWallboardViewerProvider
com.netdesign.remedy.provider.RemedyWallboardViewerProvider$2.this$0
[class=com.netdesign.remedy.provider.RemedyWallboardViewerProvider]
                                private
com.netdesign.wallboard.core.interfaces.WallBoardMainDataProvider
com.netdesign.remedy.provider.RemedyWallboardViewerProvider.wallBoardMainDataProvider
[class=com.netdesign.wallboard.core.WallboardMainDataProviderImpl]
                                  private
com.netdesign.wallboard.core.dao.CoreDaoService
com.netdesign.wallboard.core.WallboardMainDataProviderImpl.coreDaoService
[class=com.netdesign.wallboard.core.dao.CoreDaoServiceImp$$EnhancerByGuice$$29968411]
                                    protected com.google.inject.Provider
com.netdesign.wallboard.core.dao.CoreDaoServiceImp.em
[class=com.google.inject.internal.InjectorImpl$4] <----- field that is not
serializable
at
org.apache.wicket.util.io.SerializableChecker.internalCheck(SerializableChecker.java:386)

Part of matching code:


public class DisplayItemRemedyShowPanel extends Panel {

@Inject
private WallBoardMainDataProvider wallBoardMainDataProvider;

private Logger logger = LoggerFactory
.getLogger(DisplayItemRemedyShowPanel.class);

public DisplayItemRemedyShowPanel(String id, final String queue,
final IModel<List<RemedyItem>> RemedyItemsModel, final RemedyDisplayItem
remedyDisplayItem) {


AND when debugging wallBoardMainDataProvider is wrapped by a proxy.. Of
course the internals of the target of the proxy are not.

2012/3/21 Martin Grigorov <mg...@apache.org>

> Wicket-Guice will inject serializable Proxy.
> It seems Guice's plain Injector injects the binding. Check why.
>
> On Wed, Mar 21, 2012 at 9:55 AM, Wilhelmsen Tor Iver <To...@arrive.no>
> wrote:
> >> Hi I get a serialize exception in a panel of mine its correct that one
> of the contained fields cannot be serialized, however this field are
> injected and should not be touched by the checker, the field are marked
> with the @inject  annotation. I'm using guice for injection.. Any thing
> obvious wrong with this?
> >
> > Java serialization does not care for that annotation, only whether it is
> declared transient or sports the Serializable marker interface. Frankly it
> baffles me that they didn't just default to letting everything be
> serializable and let the programmer deal with stuff that's not supposed to
> be, since it otherwise just causes endless exceptions and adding an
> otherwise pointless interface inheritance...
> >
> > - Tor Iver
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Best regards / Med venlig hilsen
Nino Martinez

Re: Serialize exceptions

Posted by Martin Grigorov <mg...@apache.org>.
Wicket-Guice will inject serializable Proxy.
It seems Guice's plain Injector injects the binding. Check why.

On Wed, Mar 21, 2012 at 9:55 AM, Wilhelmsen Tor Iver <To...@arrive.no> wrote:
>> Hi I get a serialize exception in a panel of mine its correct that one of the contained fields cannot be serialized, however this field are injected and should not be touched by the checker, the field are marked with the @inject  annotation. I'm using guice for injection.. Any thing obvious wrong with this?
>
> Java serialization does not care for that annotation, only whether it is declared transient or sports the Serializable marker interface. Frankly it baffles me that they didn't just default to letting everything be serializable and let the programmer deal with stuff that's not supposed to be, since it otherwise just causes endless exceptions and adding an otherwise pointless interface inheritance...
>
> - Tor Iver
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Serialize exceptions

Posted by Wilhelmsen Tor Iver <To...@arrive.no>.
> Hi I get a serialize exception in a panel of mine its correct that one of the contained fields cannot be serialized, however this field are injected and should not be touched by the checker, the field are marked with the @inject  annotation. I'm using guice for injection.. Any thing obvious wrong with this?

Java serialization does not care for that annotation, only whether it is declared transient or sports the Serializable marker interface. Frankly it baffles me that they didn't just default to letting everything be serializable and let the programmer deal with stuff that's not supposed to be, since it otherwise just causes endless exceptions and adding an otherwise pointless interface inheritance...

- Tor Iver

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org