Forum Stats

  • 3,826,724 Users
  • 2,260,699 Discussions
  • 7,897,064 Comments

Discussions

java.io.NotSerializableException in my bean

848013
848013 Member Posts: 309 Bronze Badge

Hi

I am on JDEV 12.2.1.4. I have a custom bean (wcsutil) defined at pageflowscope. whenever i open my ADF page, i am getting the below error. Page functionality is working fine though. What is causing this error and how can i resolve this?

<May 20, 2022 7:02:53,797 AM PDT> <Error> <oracle.adfinternal.controller.state.SessionBasedScopeMap> <ADFC-62004> <ADFc: Scope object serialization failed (object not serializable), scope='pageFlowScope[/WEB-INF/APUserTask_TaskFlow.xml#APUserTask_TaskFlow]', objectKey='vfibean', objectType='bean.wcsutil'.> 

<May 20, 2022 7:02:53,798 AM PDT> <Error> <oracle.adfinternal.controller.state.SessionBasedScopeMap> <BEA-000000> <

java.io.NotSerializableException: bean.wcsutil

at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)

at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)

at oracle.adfinternal.controller.util.Utils.verifySerializableCheck(Utils.java:395)

at oracle.adfinternal.controller.util.Utils.verifySerializable(Utils.java:383)

at oracle.adfinternal.controller.state.SessionBasedScopeMap.writeScopeMap(SessionBasedScopeMap.java:171)

at oracle.adfinternal.controller.state.PageFlowScope.writeObject(PageFlowScope.java:165)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1155)

at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)

at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)

at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)

at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)

at java.util.concurrent.ConcurrentHashMap.writeObject(ConcurrentHashMap.java:1413)

at sun.reflect.GeneratedMethodAccessor377.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1155)

at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)

at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)

at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)

at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)

at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)

at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)

at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)

at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)

at weblogic.servlet.internal.session.ReplicatedSessionChange.writeMapKeysAndValuesToStream(ReplicatedSessionChange.java:234)

at weblogic.servlet.internal.session.ReplicatedSessionChange.writeExternal(ReplicatedSessionChange.java:202)

at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1459)

at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1430)

at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)

at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)

at weblogic.cluster.replication.WrappedSerializable.writeExternal(WrappedSerializable.java:23)

at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1459)

at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1430)

at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)

at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)

at weblogic.rjvm.MsgAbbrevOutputStream.writeObject(MsgAbbrevOutputStream.java:674)

at weblogic.rjvm.MsgAbbrevOutputStream.writeObjectWL(MsgAbbrevOutputStream.java:666)

at weblogic.rmi.internal.ObjectIO.writeObject(ObjectIO.java:38)

at weblogic.rjvm.BasicOutboundRequest.marshalArgs(BasicOutboundRequest.java:96)

at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:297)

at weblogic.cluster.replication.RemoteReplicationServicesInternalImpl_12214_WLStub.update(Unknown Source)

at sun.reflect.GeneratedMethodAccessor2196.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at weblogic.cluster.replication.SecureReplicationInvocationHandler$ReplicationServicesInvocationAction.run(SecureReplicationInvocationHandler.java:222)

at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:344)

at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:137)

at weblogic.cluster.replication.SecureReplicationInvocationHandler.invoke(SecureReplicationInvocationHandler.java:192)

at com.sun.proxy.$Proxy693.update(Unknown Source)

at weblogic.cluster.replication.ReplicationServicesImplBase.sendUpdateRequestToSecondary(ReplicationServicesImplBase.java:1728)

at weblogic.cluster.replication.ReplicationServicesImplBase.updateSecondaryInternal(ReplicationServicesImplBase.java:1617)

at weblogic.cluster.replication.ReplicationServicesImplBase.updateSecondary(ReplicationServicesImplBase.java:1583)

at weblogic.cluster.replication.ReplicationServicesImplBase.updateSecondary(ReplicationServicesImplBase.java:1578)

at weblogic.servlet.internal.session.ReplicatedSessionData._syncSession(ReplicatedSessionData.java:745)

at weblogic.servlet.internal.session.ReplicatedSessionData.syncSession(ReplicatedSessionData.java:709)

at weblogic.servlet.internal.session.SessionContext.sync(SessionContext.java:161)

at weblogic.servlet.internal.ServletRequestImpl$SessionHelper.syncSession(ServletRequestImpl.java:3502)

at weblogic.servlet.internal.ServletRequestImpl$SessionHelper.syncSessions(ServletRequestImpl.java:3480)

at weblogic.servlet.internal.ServletRequestImpl$SessionHelper.syncSession(ServletRequestImpl.java:3468)

at weblogic.servlet.internal.ServletResponseImpl$1.run(ServletResponseImpl.java:1818)

at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:344)

at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197)

at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)

at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)

at weblogic.servlet.internal.ServletResponseImpl.syncSession(ServletResponseImpl.java:1814)

at weblogic.servlet.internal.ServletResponseImpl.send(ServletResponseImpl.java:1749)

at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1720)

at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1670)

at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:272)

at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:352)

at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:337)

at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:57)

at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)

at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:655)

at weblogic.work.ExecuteThread.execute(ExecuteThread.java:420)

at weblogic.work.ExecuteThread.run(ExecuteThread.java:360)

Thanks

Lakshmi

Answers

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,458 Red Diamond

    Your bean should be serializable but it is not.

    Does your bean implement the Serializable interface?

    If not implement it. When you get errors implementing the interface you have to fix them.

    One other question is why this bean needs to be serializable. Do you use HA mode? Or do you work with multiple managed servers?


    Timo

  • 848013
    848013 Member Posts: 309 Bronze Badge

    Hi Timo

    our environment is clustered with soa nodes. my bean doesnt have serializable implemented. it is defined as pageFlowScope

    Thanks

    Lakshmi

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,458 Red Diamond

    If you want to get rid of the error, you have to implement the Serializable interface for all beans defined higher than request scope.

    Or you set your soa servers to use sticky sessions. Then a session will not change servers. Once on one node, it will remain on this node until the sessions ends. No serialization is needed in this case.


    Timo

  • 848013
    848013 Member Posts: 309 Bronze Badge

    Hi Timo

    i have only one bean. I am very new to this. Can you share a sample please to implement serialization in my bean?

    Thanks

    Lakshmi

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,458 Red Diamond
    edited May 27, 2022 10:17AM

    The Serialization interface is a marker interface. You only have to add 'implements Serializable' to your class, then recompile the class.

    If you don't get an error telling you that one to more of the class variables is not serializable, you are done. If you get an error you fix it.


    Timo

  • Rafat
    Rafat Member Posts: 57 Blue Ribbon

    Hi Lakshmi,

    Try this for cluster based environment class.

    1:-class must be implements with serializable class

       YourClassName implements Serializable
    
    
    

    2:-attribute will be transient .

    Ex:- private transient attr1;

    3:- inside Application Resource palate--> adf-config.xml file-->controller the property 'High availability for session scope' must be checked.


    Rafat

  • Gabriele Ghiani
    Gabriele Ghiani Member Posts: 37 Blue Ribbon

    Hello here it is:

    import java.io.Serializable;

    public class MyPageFlowScopeBean implements Serializable {

       public MyPageFlowScopeBean() {

           super();

       }

    }