Forum Stats

  • 3,815,377 Users
  • 2,259,010 Discussions
  • 7,893,063 Comments

Discussions

Bean Serialization

User_89YF7
User_89YF7 Member Posts: 46 Green Ribbon

Hi Team,

I'm using jdev 12.2.1.3.0. I have a bean in sessionscope which implements Map. how to make Serializable for that bean as it is throwing the below error.

<oracle.adf.controller> <ManagedBeanFactory> <warnIfNotSerializable> <ADFc: Managed bean ItemPropertiesMap, implemented by com.view.backing.ItemPropertiesMap, defined in /WEB-INF/adfc-config.xml, does not implement Serializable and will be placed in session scope, which might be serialized.> 

In adfc config it showing like below: Managed bean class with sessionscope should be serializable


I have removed Map and added Serializable but getting the below error:

javax.el.PropertyNotFoundException: The class 'com.view.backing.ItemPropertiesMap' does not have the property 'Add Claims%%Link%%DisplayProperty'.

at javax.el.BeanELResolver.getBeanProperty(BeanELResolver.java:686)

at javax.el.BeanELResolver.getValue(BeanELResolver.java:350)

at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)

at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)

at com.sun.el.parser.AstValue.getValue(AstValue.java:139)

at com.sun.el.parser.AstValue.getValue(AstValue.java:203)

at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:226)

at org.apache.myfaces.trinidad.component.UIXFacesBeanImpl.getBoundProperty(UIXFacesBeanImpl.java:203)

at org.apache.myfaces.trinidad.bean.FacesBeanImpl.getProperty(FacesBeanImpl.java:69)

at oracle.adf.view.rich.render.RichRenderer.getDefaultableProperty(RichRenderer.java:217)

at oracle.adf.view.rich.render.RichRenderer.getDefaultableBooleanProperty(RichRenderer.java:233)

at oracle.adf.view.rich.render.RichRenderer.getVisible(RichRenderer.java:2269)

at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1615)

at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:538)

at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:1231)

at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)

at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:660)

at oracle.adfinternal.view.faces.renderkit.rich.PanelListRenderer.access$100(PanelListRenderer.java:31)

at oracle.adfinternal.view.faces.renderkit.rich.PanelListRenderer$EncoderCallback.processComponent(PanelListRenderer.java:444)

at oracle.adfinternal.view.faces.renderkit.rich.PanelListRenderer$EncoderCallback.processComponent(PanelListRenderer.java:357)

at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:198)

at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:330)

at org.apache.myfaces.trinidad.component.UIXComponent.encodeFlattenedChildren(UIXComponent.java:295)

at oracle.adfinternal.view.faces.renderkit.rich.PanelListRenderer.encodeAll(PanelListRenderer.java:184)

at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1651)

at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:538)

at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:1231)

at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)

at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:660)

at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:677)

at oracle.adf.view.rich.render.RichRenderer.encodeAllChildrenInContext(RichRenderer.java:3310)

at oracle.adfinternal.view.faces.renderkit.rich.PanelHeaderRenderer.renderChildrenAfterHelpAndInfo(PanelHeaderRenderer.java:747)

at oracle.adfinternal.view.faces.renderkit.rich.PanelHeaderRenderer._renderContentCell(PanelHeaderRenderer.java:1350)

at oracle.adfinternal.view.faces.renderkit.rich.PanelHeaderRenderer.renderContentRow(PanelHeaderRenderer.java:656)

at oracle.adfinternal.view.faces.renderkit.rich.ShowDetailHeaderRenderer.renderContentRow(ShowDetailHeaderRenderer.java:297)

at oracle.adfinternal.view.faces.renderkit.rich.PanelHeaderRenderer.encodeAll(PanelHeaderRenderer.java:325)

at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1651)

at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:538)

at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:1231)



Let me know if there is any other way to serialize a bean

Answers

  • dvohra21
    dvohra21 Member Posts: 14,486 Gold Crown

    javax.el.PropertyNotFoundException: The class 'com.view.backing.ItemPropertiesMap' does not have the property 'Add Claims%%Link%%DisplayProperty'.

    A common issue, in the EL use the property, not the getter.

    As example, the getter method in bean may be AddClaims but to transform a getter name into an EL expression, the "get" (or "is", or "Add") prefix is removed, and the first char is lowercased.

    In your case, I guess your getter name is AddClaims, which gives claims. So you have to use ${class.claims}.

  • User_89YF7
    User_89YF7 Member Posts: 46 Green Ribbon

    @dvohra21

    Thanks for the reply. Actually Add claims is the text of link component. The functionality in my application is all the page UI components are lookup configuration based . So based on user role the component properties (visible , editable,required) will be applied. Please check the below visible condition.

    My question is how to fix the below which i'm getting in the below jdev log. Any other way to make this bean serializable

    In adfc config it showing like below: Managed bean class with sessionscope should be serializable



    <oracle.adf.controller> <ManagedBeanFactory> <warnIfNotSerializable> <ADFc: Managed bean ItemPropertiesMap, implemented by com.view.backing.ItemPropertiesMap, defined in /WEB-INF/adfc-config.xml, does not implement Serializable and will be placed in session scope, which might be serialized.> 

  • dvohra21
    dvohra21 Member Posts: 14,486 Gold Crown

    Beans that use session, application, or conversation scope must be serializable, but beans that use request scope do not have to be serializable. The managed bean should implement Serializable.

  • User_89YF7
    User_89YF7 Member Posts: 46 Green Ribbon

    Yes, I know I have added serializable. If I replaced Map with serializable my application UI components are not rendering because before my bean class which extends Map.

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

    User, you have to add Serializable to your class. Your class has to implement both interfaces Map and Serializable!


    Timo

  • dvohra21
    dvohra21 Member Posts: 14,486 Gold Crown
    edited May 6, 2022 5:58PM

    The bean class may implement the Map, and Serializable interfaces as follows:

    
    class BeanClass implements Map, Serializable {
    }
    
  • User_89YF7
    User_89YF7 Member Posts: 46 Green Ribbon

    @Timo Hahn

    Thanks Timo for your response. Any suggestions how to implement a bean class both interfaces Map and Serializable! please guide me.

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

    It's like dvohra21 said, you just have to implement two interfaces map and serializable like

    public class YOUR_CLASS_NAME implements Map, Serializable {...}
    

    As long as each property of your class is serializable, the class itself is serializable. Nothing needs to be done. Only if your class has properties that are not serializable you can overwrite the interface methods for the serializable interface.

    Timo

  • User_89YF7
    User_89YF7 Member Posts: 46 Green Ribbon

    Hi Timo,

    I have added like below. Now getting the below to Make my class Abstract


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

    USer, this is simple java. The error message tells you that your class needs to implement some methods to implement the given interfaces.

    If you click on the first 'Implement methods...' JDev will add the missing methods. Once this is done you have to implement them. Sorry, we can't help you here as we don't see the full working class.


    Timo