You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Stefan Lorenz <St...@persis.de> on 2014/09/09 08:53:24 UTC

JavaSerializer - Error serializing object class

Hi,

with Glassfish4 we get a lot of Exceptions when a page gets serialized.

org.apache.wicket.serialize.java.JavaSerializer - Error serializing object class
..
org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream$ObjectCheckException: The object type is not Serializable!
A problem occurred while checking object with type: com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate
Field hierarchy is:
..
..
private final org.jboss.weld.ejb.api.SessionObjectReference org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.reference [class=org.glassfish.weld.ejb.SessionObjectReferenceImpl]
                                                                private java.lang.Object org.glassfish.weld.ejb.SessionObjectReferenceImpl.ejbRef [class=com.sun.proxy.$Proxy202]
                                                                  protected java.lang.reflect.InvocationHandler java.lang.reflect.Proxy.h [class=com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate] <----- field that is causing the problem


Any idea where this is coming from or what's causing this?

Regards,
Stefan


Re: JavaSerializer - Error serializing object class

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

This is a well known issue with CDI+EJB. It has been discussed few times
here and other forums.
CDI injects non-Serializable objects for EJB beans.
A workaround is to use a delegate CDI bean to lookup the EJBs. I.e. instead
of @Inject-ing EJBs in Wicket components inject a scoped CDI bean that
injects the EJBs in itself.
So the usage in Wicket would be:

public class MyComponent extends ... {
  @Inject MyCDIBean cdiBean;
  ...

  cdiBean.getEjb().doSomething();
  ...
}

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Tue, Sep 9, 2014 at 9:53 AM, Stefan Lorenz <St...@persis.de>
wrote:

> Hi,
>
> with Glassfish4 we get a lot of Exceptions when a page gets serialized.
>
> org.apache.wicket.serialize.java.JavaSerializer - Error serializing object
> class
> ..
> org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream$ObjectCheckException:
> The object type is not Serializable!
> A problem occurred while checking object with type:
> com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate
> Field hierarchy is:
> ..
> ..
> private final org.jboss.weld.ejb.api.SessionObjectReference
> org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.reference
> [class=org.glassfish.weld.ejb.SessionObjectReferenceImpl]
>                                                                 private
> java.lang.Object org.glassfish.weld.ejb.SessionObjectReferenceImpl.ejbRef
> [class=com.sun.proxy.$Proxy202]
>
> protected java.lang.reflect.InvocationHandler java.lang.reflect.Proxy.h
> [class=com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate]
> <----- field that is causing the problem
>
>
> Any idea where this is coming from or what's causing this?
>
> Regards,
> Stefan
>
>

Re: JavaSerializer - Error serializing object class

Posted by Maxim Solodovnik <so...@gmail.com>.
you can only have Serializable classes stored in the page
you can have DTO or ID stored if it is impossible

On 9 September 2014 13:53, Stefan Lorenz <St...@persis.de> wrote:

> Hi,
>
> with Glassfish4 we get a lot of Exceptions when a page gets serialized.
>
> org.apache.wicket.serialize.java.JavaSerializer - Error serializing object
> class
> ..
> org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream$ObjectCheckException:
> The object type is not Serializable!
> A problem occurred while checking object with type:
> com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate
> Field hierarchy is:
> ..
> ..
> private final org.jboss.weld.ejb.api.SessionObjectReference
> org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.reference
> [class=org.glassfish.weld.ejb.SessionObjectReferenceImpl]
>                                                                 private
> java.lang.Object org.glassfish.weld.ejb.SessionObjectReferenceImpl.ejbRef
> [class=com.sun.proxy.$Proxy202]
>
> protected java.lang.reflect.InvocationHandler java.lang.reflect.Proxy.h
> [class=com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate]
> <----- field that is causing the problem
>
>
> Any idea where this is coming from or what's causing this?
>
> Regards,
> Stefan
>
>


-- 
WBR
Maxim aka solomax