集群中的 Wildfly 10 尝试使用 org.infinispan.commons.marshall.NotSerializableException 序列化 JSP [英] Wildfly 10 in cluster tries to serialize JSP with org.infinispan.commons.marshall.NotSerializableException

查看:24
本文介绍了集群中的 Wildfly 10 尝试使用 org.infinispan.commons.marshall.NotSerializableException 序列化 JSP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 JPS 中的以下代码使用我的应用程序

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. 一切正常,但是当我打开包含上面代码的视图时,我在日志中看到以下错误:

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

我认为,wildfly 会尝试将视图保留到 infinispan 中,以便在我重新加载页面或在另一个节点上点击此页面时能够恢复视图.

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.

我已经尝试将 bean 的范围更改为 request 甚至是 none,但是 wildfly 仍然尝试序列化视图.我绝对确定问题出在 c:forEach 中,因为当我将它(及其内容)注释掉时 - 我没有得到任何例外.

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.

也很明显IteratedExpression里面包含Iterator,这不是Serializable真的.

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.

推荐答案

问题是c:forEach创建了IteratedValueExpression,它不是Serializable> 因为里面包含了Iterator.对此的简单解决方法是将 MissingSearchBean.workingAreas 的返回类型更改为数组.

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.

如果 value 由数组表示,LoopTagSupport 创建 IndexedValueExpression 而不是 IteratedValueExpression,这是明确的可序列化.

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

这篇关于集群中的 Wildfly 10 尝试使用 org.infinispan.commons.marshall.NotSerializableException 序列化 JSP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆