Wildfly 10 in cluster tries to serialize JSP with org.infinispan.commons.marshall.NotSerializableException

♀尐吖头ヾ 提交于 2019-12-13 03:24:23

问题


I'm trying to use my application with following code in JPS

<c:forEach var="area" items="#{MissingSearchBean.workingAreas}">
     <h:commandButton value="#{area.workingAreaName}(#{area.count})"
                         action="#{MissingSearchBean.selectWorkingArea(area.workingAreaName)}"
                         styleClass="commandButton" />
</c:forEach>

inside wilfly 10. Everything works fine, but when I open view, containing code above I see following error in logs:

Caused by: org.infinispan.commons.marshall.NotSerializableException: javax.servlet.jsp.jstl.core.IteratedExpression
Caused by: an exception which occurred:
    in field iteratedExpression
    in field delegate
    in field savedState
    in field m
    in object java.util.HashMap@85e645ff
    in object org.wildfly.clustering.marshalling.jboss.SimpleMarshalledValue@85e645ff

I think that wildfly tries to persist view into infinispan to be able to recover view in case if I'll reload page or hit this page on another node.

I've tried to change scope of bean to request and even to none, but wildfly still tries to serialize view. I'm absolutely sure that the problem is in c:forEach because when I comment it (ot its' content) out — I don't get any exceptions.

Also obviously IteratedExpression contains Iterator inside, which is not Serializable true.

I'm looking for any solution/workaround for this be able to work in cluster without throwing exceptions.


回答1:


The problem is c:forEach creates IteratedValueExpression, which is not Serializable because contains the Iterator inside. Simple workaround for this is to change return type of MissingSearchBean.workingAreas to array.

In case when value is represented by array, LoopTagSupport creates IndexedValueExpression instead of IteratedValueExpression and this is explicitly Serializable.



来源:https://stackoverflow.com/questions/52629487/wildfly-10-in-cluster-tries-to-serialize-jsp-with-org-infinispan-commons-marshal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!