2

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>
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Sujoy
  • 8,041
  • 3
  • 30
  • 36
  • Are you using client side state saving? – rdcrng Sep 10 '13 at 07:58
  • Yes. Is that a concern? – Sujoy Sep 10 '13 at 08:07
  • No, was just wondering how you discovered it, because the only other way would have been to wait for the session to be serialized. I'm not sure, but this might actually be an oversight in Omnifaces. I'm sure BalusC will take a look at it soon enough :) – rdcrng Sep 10 '13 at 08:09

1 Answers1

3

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.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Thanks. The SelectItems(Index)Converter did work great as well. Couldn't try with myfaces 2.1.12 since download is blocked at work :( – Sujoy Sep 10 '13 at 13:56
  • Same issue here with MyFaces 2.3.4. I checked the release notes for newer versions and there is no mention for a fix regarding this problem. Any idea how to fix this @BalusC? – Christian Beikov Sep 08 '20 at 10:12