Search code examples
jsfejbweblogicweblogic12c

java.io.NotSerializableException: weblogic.ejb.container.internal.StatelessLocalObject when STATE_SAVING_METHOD is set to client


When I set STATE_SAVING_METHOD to client on Weblogic 12c (12.1.1.0) using @EJB in ManagedBean, I got the following exception:

<Error> <javax.enterprise.resource.webcontainer.jsf.application> <BEA-000000> <Error Rendering View[/test.xhtml]
java.io.NotSerializableException: weblogic.ejb.container.internal.StatelessLocalObject
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
...

At ManagedBean:

@ManagedBean()
@ViewScoped
public class TestMB implements Serializable {

private static final long serialVersionUID = 4760453378399618429L;

@EJB
private TestFacade testFacade;

UPDATE:

In the XHTML, using <h:form/>, the error will appears.


Solution

  • I didn't found a solution to use @ViewScoped with EJB. It seems that @ViewScoped do not support EJB with STATE_SAVING_METHOD setted to client.

    To resolve this I have both options:

    1. Do not use @ViewScoped, choosing @RequestScoped or @SessionScoped instead
    2. Use STATE_SAVING_METHOD with server paramether