java.io.NotSerializableException - org.omnifaces.taghandler.Converter

安稳与你 提交于 2019-12-02 02:15:52

问题


I have an application using Primefaces 3.5 with Omnifaces 1.5 on Jboss 6, using myfaces 2.1.5

on trying to use the o:converter I am getting the follow error.

org.omnifaces.taghandler.Converter

viewId=/xhtml/propelModules/initiatePropel.xhtml
location=C:\jboss-6.1.0.Final\server\default\deploy\PropelEAR.ear\PropelWeb.war\xhtml\propelModules\initiatePropel.xhtml
phaseId=RENDER_RESPONSE(6)

Caused by:
java.io.NotSerializableException - org.omnifaces.taghandler.Converter
at java.io.ObjectOutputStream.writeObject0(Unknown Source)

The code concerned is ...

<p:selectManyCheckbox value="#{initiatePropelManagedBean.currentWon.selectedEmployeeList}" 
  layout="pageDirection">
<o:converter converterId="omnifaces.ListIndexConverter" 
      list="#{initiatePropelManagedBean.currentWon.employeeList}" />
     <f:selectItems value="#{initiatePropelManagedBean.currentWon.employeeList}"
       var="emp" itemLabel="#{emp}" itemValue="#{emp}" />
     <p:ajax process="@this" update="employeeCount"></p:ajax>
</p:selectManyCheckbox>

回答1:


I can reproduce your problem. This is a bug in MyFaces 2.1.5. I can't find the associated bug report and the fix version, but I can at least tell that this construct works just fine for me with the current latest MyFaces 2.1.12. So, upgrading MyFaces should do it for you as well.


Unrelated to the concrete problem, the conversion strategy is here somewhat strange. Just using the omnifaces.SelectItemsConverter or omnifaces.SelectItemsIndexConverter (if you don't have a good equals() on the Employee entity) should be sufficient.

<p:selectManyCheckbox ... converter="omnifaces.SelectItemsIndexConverter">
    <f:selectItems value="#{initiatePropelManagedBean.currentWon.employeeList}" />
</p:selectManyCheckbox>

The SelectItems(Index)Converter doesn't strictly require a List<SelectItem> as model, it only requires a <f:selectItem(s)> in the view. The List(Index)Converter is intented for components which do not use <f:selectItem(s)>, such as <p:autoComplete>, <p:picklist>, etc.

This would be the alternate solution if you can't upgrade MyFaces for some reason.



来源:https://stackoverflow.com/questions/18713264/java-io-notserializableexception-org-omnifaces-taghandler-converter

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