1

When I'm trying to click on the submit button, initially method is calling and executing but when I'm trying to click the same submit button for the second time I'm facing the below issue in response:

Below is the code:

<h:commandButton class="nxt_btn clone_nxt_btn" value="Submit" action="#{cloneDAO.launchWorkflow()}" id="submit">
</h:commandButton>

Exception:

Caused by: java.lang.ClassCastException: java.util.HashMap cannot be cast to [[Ljava.lang.Object;
    at javax.faces.component.UIComponentBase.restoreSystemEventListeners(UIComponentBase.java:1864)
    at javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:1565)
    at com.sun.faces.application.view.FaceletPartialStateManagementStrategy$2.visit(FaceletPartialStateManagementStrategy.java:380)
    at com.sun.faces.component.visit.FullVisitContext.invokeVisitCallback(FullVisitContext.java:151)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1652)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1663)
    at javax.faces.component.UIForm.visitTree(UIForm.java:371)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1663)
    at com.sun.faces.application.view.FaceletPartialStateManagementStrategy.restoreView(FaceletPartialStateManagementStrategy.java:367)
    at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:138)
    at com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:123)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:577)
    at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:142)
    at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:301)
    at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:301)
    at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:192)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    ... 52 more
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Madhu
  • 11
  • 1
  • Is the object you initially passed to jsf (GET) the same type with the object you passed to jsf from launchWorkflow() (POST??) – oxyt Sep 13 '19 at 08:28
  • 2
    Please do not use [java] tag as long as the problem is not demonstrable using a plain vanilla Java application class with a `main()` method. – BalusC Sep 13 '19 at 08:33
  • 1
    You'll need to add a breakpoint on ClassCastException and debug a little bit in order to find out which exact UIComponent is biten here. This component somewhat illegally has its' state stored as a HashMap instead of an Object array (`Object[]`). As we don't see the relevant code we can't really help further. – Selaron Sep 13 '19 at 08:52
  • launchWorkFlow() method return type is void and I have written only single log statement. Eventhough I'm facing this issue. When ever I'm running for the first time after restarting the services, it is working fine. But second time method is not calling and I'm not getting any exception in logs as well. But while debugging I'm facing the below issue in browser network response. class java.lang.ClassCastException<![CDATA[java.util.HashMap cannot be cast to [[Ljava.lang.Object;]]> – Madhu Sep 13 '19 at 09:31
  • I have replaced the UI code as below: – Madhu Sep 13 '19 at 09:39

0 Answers0