com.sun.faces.renderkit.html_basic.MenuRenderer createCollection: Unable to create new Collection instance for type java.util.Arrays$ArrayList

佐手、 提交于 2019-11-30 13:37:58
BalusC

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