javax.faces.FacesException: #{Index.actionMethodError}: java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.util.List

Java.net JIRA | jsf.01 | 3 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    h4. Description Convertors of a List in a Map do not work the same between two different Tomcat versions (versions tested are 6.0.29 and 6.0.36): the original value List<String> becomes a String[]. This throws ClassCastException in client code (validator methods, valueChange listeners, action methods...) where a type List is expected and not an array. h4. Steps to reproduce I am going to send source files and war file of the following test case to issues@javaserverfaces.java.net In each Tomcat version, do this: 1) Click on the button "send" 2) Click on the button "error (only in Tomcat 6.0.36)" h4. Log lines written after the tests h5. Tomcat 6.0.29 h6. After a click on the button "send" {noformat} validatorMethod: value='[1, 2]' type='java.util.ArrayList' actionMethod: map='{1=[1, 2]}' type='java.util.HashMap' actionMethod: map[1]='[1, 2]' type='java.util.ArrayList' {noformat} h6. After a click on the button "error (only in Tomcat 6.0.36)" {noformat} validatorMethod: value='[1, 2]' type='java.util.ArrayList' {noformat} h5. Tomcat 6.0.36 h6. After a click on the button "send" {noformat} validatorMethod: value='[Ljava.lang.String;@144e858' type='java.lang.String[]' arrayToString='[1, 2]' actionMethod: map='{1=[Ljava.lang.String;@144e858}' type='java.util.HashMap' actionMethod: map[1]='[Ljava.lang.String;@144e858' type='java.lang.String[]' arrayToString='[1, 2]' {noformat} h6. After a click on the button "error (only in Tomcat 6.0.36)" validatorMethod: value='[Ljava.lang.String;@a1c582' type='java.lang.String[]' arrayToString='[1, 2]' {noformat} com.sun.faces.lifecycle.InvokeApplicationPhase execute WARN: #{Index.actionMethodError}: java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.util.List javax.faces.FacesException: #{Index.actionMethodError}: java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.util.List at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118) at javax.faces.component.UICommand.broadcast(UICommand.java:315) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282) at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:619) Caused by: javax.faces.el.EvaluationException: java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.util.List at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:101) at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102) ... 19 more Caused by: java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.util.List at newpackage.Index.actionMethodError(Index.java:60) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.el.parser.AstValue.invoke(AstValue.java:191) at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105) at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87) ... 20 more {noformat} h4. Possible related issues "javax.el.MapELResolver getType returns class of kept object instead of Object.class" https://issues.apache.org/bugzilla/show_bug.cgi?id=51177 This bug was resolved in Tomcat 6.0.33 (see http://tomcat.apache.org/tomcat-6.0-doc/changelog.html) "JspValueExpression.getType() returns Object.class instead of correct Type" https://issues.apache.org/bugzilla/show_bug.cgi?id=44637 This bug is linked by the previous bug page.

    Java.net JIRA | 3 years ago | jsf.01
    javax.faces.FacesException: #{Index.actionMethodError}: java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.util.List
  2. 0

    h4. Description Convertors of a List in a Map do not work the same between two different Tomcat versions (versions tested are 6.0.29 and 6.0.36): the original value List<String> becomes a String[]. This throws ClassCastException in client code (validator methods, valueChange listeners, action methods...) where a type List is expected and not an array. h4. Steps to reproduce I am going to send source files and war file of the following test case to issues@javaserverfaces.java.net In each Tomcat version, do this: 1) Click on the button "send" 2) Click on the button "error (only in Tomcat 6.0.36)" h4. Log lines written after the tests h5. Tomcat 6.0.29 h6. After a click on the button "send" {noformat} validatorMethod: value='[1, 2]' type='java.util.ArrayList' actionMethod: map='{1=[1, 2]}' type='java.util.HashMap' actionMethod: map[1]='[1, 2]' type='java.util.ArrayList' {noformat} h6. After a click on the button "error (only in Tomcat 6.0.36)" {noformat} validatorMethod: value='[1, 2]' type='java.util.ArrayList' {noformat} h5. Tomcat 6.0.36 h6. After a click on the button "send" {noformat} validatorMethod: value='[Ljava.lang.String;@144e858' type='java.lang.String[]' arrayToString='[1, 2]' actionMethod: map='{1=[Ljava.lang.String;@144e858}' type='java.util.HashMap' actionMethod: map[1]='[Ljava.lang.String;@144e858' type='java.lang.String[]' arrayToString='[1, 2]' {noformat} h6. After a click on the button "error (only in Tomcat 6.0.36)" validatorMethod: value='[Ljava.lang.String;@a1c582' type='java.lang.String[]' arrayToString='[1, 2]' {noformat} com.sun.faces.lifecycle.InvokeApplicationPhase execute WARN: #{Index.actionMethodError}: java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.util.List javax.faces.FacesException: #{Index.actionMethodError}: java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.util.List at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118) at javax.faces.component.UICommand.broadcast(UICommand.java:315) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282) at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:619) Caused by: javax.faces.el.EvaluationException: java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.util.List at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:101) at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102) ... 19 more Caused by: java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.util.List at newpackage.Index.actionMethodError(Index.java:60) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.el.parser.AstValue.invoke(AstValue.java:191) at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105) at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87) ... 20 more {noformat} h4. Possible related issues "javax.el.MapELResolver getType returns class of kept object instead of Object.class" https://issues.apache.org/bugzilla/show_bug.cgi?id=51177 This bug was resolved in Tomcat 6.0.33 (see http://tomcat.apache.org/tomcat-6.0-doc/changelog.html) "JspValueExpression.getType() returns Object.class instead of correct Type" https://issues.apache.org/bugzilla/show_bug.cgi?id=44637 This bug is linked by the previous bug page.

    Java.net JIRA | 3 years ago | jsf.01
    javax.faces.FacesException: #{Index.actionMethodError}: java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.util.List
  3. 0

    [#JAVASERVERFACES-3104] ClassCastException in client code because of convertors of a List in a Map that do not behave the same on different Tomcat version

    java.net | 7 months ago
    javax.faces.FacesException: #{Index.actionMethodError}: java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.util.List
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ClassCastException

      [Ljava.lang.String; cannot be cast to java.util.List

      at newpackage.Index.actionMethodError()
    2. newpackage
      Index.actionMethodError
      1. newpackage.Index.actionMethodError(Index.java:60)
      1 frame
    3. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    4. Pax Jsp
      MethodExpressionImpl.invoke
      1. org.apache.el.parser.AstValue.invoke(AstValue.java:191)
      2. org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
      2 frames
    5. JSF
      TagMethodExpression.invoke
      1. com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
      1 frame
    6. JavaEE 7
      MethodBindingMethodExpressionAdapter.invoke
      1. javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
      1 frame
    7. JSF
      ActionListenerImpl.processAction
      1. com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
      1 frame
    8. JavaEE 7
      UIViewRoot.processApplication
      1. javax.faces.component.UICommand.broadcast(UICommand.java:315)
      2. javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
      3. javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
      3 frames
    9. JSF
      LifecycleImpl.execute
      1. com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
      2. com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      3. com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
      3 frames
    10. JavaEE 7
      FacesServlet.service
      1. javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
      1 frame
    11. Glassfish Core
      CoyoteAdapter.service
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      3. org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      4. org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      5. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      6. org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
      7. org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      8. org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
      8 frames
    12. Grizzly HTTP
      JIoEndpoint$Worker.run
      1. org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
      2. org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
      3. org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
      3 frames
    13. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:619)
      1 frame