Alexcocia
Alexcocia

Reputation: 128

IllegalArgumentException: Cannot convert [] of type class java.util.HashSet to class xxx

I am finding myself in a JSF error but no clue why it could be. I show you the view part:

<rich:extendedDataTable id="objects" value="#{newObjectsBean.objectsList}"
            selection="#{newObjectsBean.objectToDelete}"
            rendered="#{newObjectsBean.anyResult}"
            selectionMode="single" var="item" rows="10" >
<a4j:ajax execute="@form" event="selectionchange"
  listener="#{newObjectsBean.selectionListener}" render="deletionButton"/>
<rich:column width="125px" sortBy="#{item.sId}"
     sortOrder="#{fragSortingBean.sortsOrders['sId']}">
    <f:facet name="header">
    <h:panelGrid columns="2" cellpadding="0" cellspacing="2"
             style="text-align: left; height: 30px">
        <a4j:commandLink execute="@this" value="id" render="objects"
                     action="#{fragSortingBean.sort}">
            <f:param name="sortProperty" value="sId"/>
        </a4j:commandLink>
        <h:graphicImage value="../../resources/images/arrow_sort_down.png"
                    rendered="#{fragSortingBean.sortsOrders['sId']=='descending'}"/>
        <h:graphicImage value="../../resources/images/arrow_sort_up.png"
                    rendered="#{fragSortingBean.sortsOrders['sId']=='ascending'}"/>
    </h:panelGrid>
</f:facet>
<h:outputText id="ssaId" value="#{item.sId}"/>
</rich:column>

Then the items are a list of objects (MyObjectBean) with just three attributes (and their corresponding getter / setter)

The problem trace is the following:

java.lang.IllegalArgumentException: Cannot convert [] of type class java.util.HashSet to class xxx.yyy.zzz.entities.MyObjectBean
        at com.sun.el.lang.ELSupport.coerceToType(ELSupport.java:397)
        at com.sun.el.parser.AstValue.setValue(AstValue.java:194)
        at com.sun.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:286)
        at org.jboss.weld.el.WeldValueExpression.setValue(WeldValueExpression.java:88)
        at com.sun.faces.facelets.el.TagValueExpression.setValue(TagValueExpression.java:124)
        at org.richfaces.renderkit.SortingFilteringRowsRenderer.updateAttribute(SortingFilteringRowsRenderer.java:142)
        at org.richfaces.renderkit.SelectionRenderer.doDecode(SelectionRenderer.java:175)
        at org.richfaces.renderkit.ExtendedDataTableRenderer.doDecode(ExtendedDataTableRenderer.java:805)
        at org.richfaces.renderkit.RendererBase.decode(RendererBase.java:80)
        at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:790)
        at org.richfaces.component.UIDataAdaptor.processDecodes(UIDataAdaptor.java:816)
        at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1042)
        at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1042)
        at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1042)
        at javax.faces.component.UIForm.processDecodes(UIForm.java:216)
        at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1042)
        at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1042)
        at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:941)
        at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)

Any clue? Thanks in advance

Upvotes: 1

Views: 1435

Answers (1)

Makhiel
Makhiel

Reputation: 3884

@selection of EDT has to evaluate to a Collection, it looks like yours is pointing to a single object.

Upvotes: 1

Related Questions