1. Create a custom component
@FacesComponent(createTag = true, tagName = "inputHidden", namespace = "http://mytaglib/tags", value = "myInputHidden")
public class MyInputHidden extends HtmlInputHidden implements Serializable {
private static final long serialVersionUID = 5173135479509877319L;
@Override
public Object getSubmittedValue() {
if (super.getSubmittedValue() == null && !isValid() && MyCommonTag.considerEmptyStringNull(FacesContext.getCurrentInstance())) {
return "";
} else {
return super.getSubmittedValue();
}
}
}
2. Use it on xhtml
<my:inputHidden value="#{MyController.backFlg}"/>
MyController is @Viewscoped.
3. Environment
Payara server 163
JDK Version: 1.8.0_112
Hazelcast enabled
10 Application servers.
4. Problem
I noticed that in server.log, these two exceptions appeared many times:
- javax.faces.FacesException: Unexpected error restoring state for component with id products:j_idt1352. Cause: java.lang.ClassCastException: com.sun.faces.facelets.el.TagMethodExpression cannot be cast to [Ljava.lang.Object;."
- javax.faces.FacesException: Unexpected error restoring state for component with id j_idt30. Cause: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0."
5. Question
Is there any relation between the above code and these 2 exceptions?
If not, is there any cause for these exceptions?
It's a great help if you can show me how to reproduce these exceptions since they seem to appear randomly.