This will happen when the UISelectMany
component's value
being provided is created using Arrays#asList()
method instead of new ArrayList()
.
If a model value
is already prepopulated, JSF will try to use exactly the same type to put submitted values in and set the new model value. However, the java.util.Arrays$ArrayList
type as returned by Arrays#asList()
is internal to java.util.Arrays
class and not individually instantiable as in new Arrays$ArrayList()
. Hence this exception.
To fix this, make sure that the value is created using new ArrayList()
.
Alternatively, explicitly specify the collection type via collectionType
attribute as instructed in this closely related answer: org.hibernate.LazyInitializationException at com.sun.faces.renderkit.html_basic.MenuRenderer.convertSelectManyValuesForModel.
<h:selectManyCheckbox ... collectionType="java.util.ArrayList">