NotSerializableException with Primefaces/Omnifaces validator on Jboss EAP 6.3 in Mode Cluster

493 Views Asked by At

I'm trying to use Omnifaces's validator in the following lines of code inside composite component inplementation:

<p:inputText id="#{cc.attrs.id}" size="12" maxlength="10" value="#{cc.attrs.holder.idHolderPk}"
    label="#{cc.attrs.label}" styleClass="content-right"
    disabled="#{not empty cc.attrs.disabled?cc.attrs.disabled:false}">
    <f:validator disabled="#{!cc.attrs.required}" validatorId="#{cc.attrs.validatorName}"/>
    <o:validator disabled="#{empty cc.attrs.beanValidation ? true : false}" validatorId="javax.faces.Bean" validationGroups="#{cc.attrs.beanValidation}"/>
    <p:ajax event="blur" listener="#{holderHelperBean.findHolder()}"
        process="@this" update="outpnlHolder"
        oncomplete="#{not empty cc.attrs.remoteListener ? cc.attrs.remoteListener : ''}"/>
    <pe:keyFilter mask="pint"/>
</p:inputText>

But I get the following error:

ERROR [org.infinispan.transaction.TransactionCoordinator] (ajp-118)     
ISPN000097: Error while processing a prepare in a single-phase transaction: org.infinispan.CacheException: java.lang.RuntimeException: Failure to marshal argument(s)
    at org.infinispan.util.Util.rewrapAsCacheException(Util.java:542)[0m
    at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.invokeRemoteCommand(CommandAwareRpcDispatcher.java:186)[0m
    at org.infinispan.remoting.transport.jgroups.JGroupsTransport.invokeRemotely(JGroupsTransport.java:515)[0m
    at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:173)
    at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:194)
    at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:251)
    at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:238)
    at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:233)
Caused by: java.lang.RuntimeException: Failure to marshal argument(s)
Caused by: org.infinispan.marshall.NotSerializableException: org.omnifaces.taghandler.Validator

I am using Jboss 6.3 EAP in mode cluster with session replication, Omnifaces 1.8.1, Primefaces 4.0.13, Mojarra 2.1.28-jbossorg-5.

I am using o:validator to bean validation because I need dynamic disabled and rendered validation

When application is in standalone mode working fine without error message.

1

There are 1 best solutions below

0
On BEST ANSWER

Putting <o:validator> directly inside <cc:implementation> had due to a logic bug the undesired side effect that a new instance of the validator is attached during render response of a postback (because it was expected that the <o:validator> was nested inside <my:composite> with the for attribute). JSF noticed this dynamic change and wanted to save it in the JSF view state so it could be restored on next postback, but it wasn't serializable and hence this exception.

The fix was simply to not re-attach it at all when already directly inside a composite component. It will be in OmniFaces 2.1.