Announcement Announcement Module
Collapse
No announcement yet.
Session bean and util:map : NotSerializableException Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Session bean and util:map : NotSerializableException

    Hi all,
    I have a session bean where map is inserted using util:map namespace:
    <beans:bean id="mySuperBean"
    class="com.SuperBeanImpl"
    scope="session">
    <aop:scoped-proxy proxy-target-class="false"/>
    ...
    <beansroperty name="superMap">
    <util:map>
    </util:map>
    </beansroperty>

    The bean failed to serialize on tomcat stop:
    Caused by: java.io.NotSerializableException: org.springframework.beans.factory.config.MapFactor yBean
    at java.io.ObjectOutputStream.writeObject0(ObjectOutp utStream.java:1164)
    at java.io.ObjectOutputStream.defaultWriteFields(Obje ctOutputStream.java:1518)
    at java.io.ObjectOutputStream.writeSerialData(ObjectO utputStream.java:1483)
    at java.io.ObjectOutputStream.writeOrdinaryObject(Obj ectOutputStream.java:1400)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutp utStream.java:1158)
    at java.io.ObjectOutputStream.defaultWriteFields(Obje ctOutputStream.java:1518)
    at java.io.ObjectOutputStream.writeSerialData(ObjectO utputStream.java:1483)
    at java.io.ObjectOutputStream.writeOrdinaryObject(Obj ectOutputStream.java:1400)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutp utStream.java:1158)

    Is it possible to make util:map serializable? How to apply aop:scoped-proxy to it?

  • #2
    Solved the problem by defining util:map beans separately

    <beans:bean id="mySuperBean"
    class="com.SuperBeanImpl"
    scope="session">
    <aop:scoped-proxy proxy-target-class="false"/>
    ...
    <beansroperty name="superMap" ref="myMap1"/>

    <util:map id="myMap1">
    </util:map>

    <util:map id="myMap2">
    </util:map>

    Comment

    Working...
    X