java.lang.ClassCastException: [Ljava.lang.Enum; cannot be cast to [Lcom.read.maventest.interface.IMessage;

Spring JIRA | Andy Clement | 2 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

    This was raised against AspectJ but I'm thinking (from the stack trace) it may be Spring AOP. The AJ bug is : https://bugs.eclipse.org/bugs/show_bug.cgi?id=474266 and the text from that is: The method I used AspectJ+SpringAOP to intercept is declared as below: {code}public <V extends IMessage> void getMessageValue(V... messages){code} And the arguments passed into this method are actually enums declared like below: {code}public enum CustomMessage implements IMessage { WELCOME("Hello"), GOODBYE("Bye"); ... }{code} The method call of getMessageValue() is like: {code}getMessageValue(CustomMessage.WELCOME, CustomMessage.GOODBYE);{code} And there will be an exception thrown: {code}java.lang.ClassCastException: [Ljava.lang.Enum; cannot be cast to [Lcom.read.maventest.interface.IMessage; at com.read.maventest.bean.TestEnumList$$FastClassBySpringCGLIB$$21d778f3.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85) at com.read.maventest.bean.TimingAspect.timeStats(TimingAspect.java:25) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497){code}

    Spring JIRA | 2 years ago | Andy Clement
    java.lang.ClassCastException: [Ljava.lang.Enum; cannot be cast to [Lcom.read.maventest.interface.IMessage;
  2. 0

    This was raised against AspectJ but I'm thinking (from the stack trace) it may be Spring AOP. The AJ bug is : https://bugs.eclipse.org/bugs/show_bug.cgi?id=474266 and the text from that is: The method I used AspectJ+SpringAOP to intercept is declared as below: {code}public <V extends IMessage> void getMessageValue(V... messages){code} And the arguments passed into this method are actually enums declared like below: {code}public enum CustomMessage implements IMessage { WELCOME("Hello"), GOODBYE("Bye"); ... }{code} The method call of getMessageValue() is like: {code}getMessageValue(CustomMessage.WELCOME, CustomMessage.GOODBYE);{code} And there will be an exception thrown: {code}java.lang.ClassCastException: [Ljava.lang.Enum; cannot be cast to [Lcom.read.maventest.interface.IMessage; at com.read.maventest.bean.TestEnumList$$FastClassBySpringCGLIB$$21d778f3.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85) at com.read.maventest.bean.TimingAspect.timeStats(TimingAspect.java:25) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497){code}

    Spring JIRA | 2 years ago | Andy Clement
    java.lang.ClassCastException: [Ljava.lang.Enum; cannot be cast to [Lcom.read.maventest.interface.IMessage;
  3. 0

    ClassCastException in JMS ConnectionFactory lookup in JNDI

    Stack Overflow | 5 years ago | Bash
    java.lang.ClassCastException: org.jboss.jms.client.JBossConnectionFactory cannot be cast to javax.jms.QueueConnectionFactory 09:22:20,731 ERROR [STDERR] at com.cat.clv.util.InQueueReinjectMessage.sendMessage(InQueueReinjectMessage.java:63) 09:22:20,731 ERROR [STDERR] at com.cat.clv.util.RejectedMessageReinject.reProcessedMessage(RejectedMessageReinject.java:65) 09:22:20,731 ERROR [STDERR] at com.cat.clv.service.ReinjectMessagesServiceImpl.reinjectRejectedMessages(ReinjectMessagesServiceImpl.java:106) 09:22:20,731 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 09:22:20,731 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    db:: 4.18::abqbills exec15/exec.exe stdout not re-directed when -c switch is used a7

    hivmr.com | 1 year ago
    java.lang.ClassCastException: org.apache.myfaces.renderkit.html.ext.HtmlButtonRenderer0:50:40,852 INFO [STDOUT] at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:876)0:50:40,852 INFO [STDOUT] at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:925)0:50:40,852 INFO [STDOUT] at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:406)0:50:40,852 INFO [STDOUT] at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:328)0:50:40,852 INFO [STDOUT] at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3669)0:50:40,852 INFO [STDOUT] at org.apache.catalina.core.StandardContext.start(StandardContext.java:4104)0:50:40,852 INFO [STDOUT] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)0:50:40,852 INFO [STDOUT] at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)0:50:40,852 INFO [STDOUT] at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)0:50:40,852 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)0:50:40,852 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)0:50:40,852 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)0:50:40,852 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:585)0:50:40,852 INFO [STDOUT] at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)0:50:40,852 INFO [STDOUT] at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:150)0:50:40,852 INFO [STDOUT] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)0:50:40,852 INFO [STDOUT] at org.apache.catalina.core.StandardContext.init(StandardContext.java:5005)0:50:40,852 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)0:50:40,852 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)0:50:40,852 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)0:50:40,852 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:585)0:50:40,852 INFO [STDOUT] at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)0:50:40,852 INFO [STDOUT] at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:150)0:50:40,852 INFO [STDOUT] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)0:50:40,852 INFO [STDOUT] at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeployInternal(TomcatDeployer.java:280)0:50:40,852 INFO [STDOUT] at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeploy(TomcatDeployer.java:88)0:50:40,852 INFO [STDOUT] at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:357)0:50:40,852 INFO [STDOUT] at org.jboss.web.WebModule.startModule(WebModule.java:68)0:50:40,852 INFO [STDOUT] at org.jboss.web.WebModule.startService(WebModule.java:46)0:50:40,852 INFO [STDOUT] at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:274)0:50:40,852 INFO [STDOUT] at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:230)0:50:40,852 INFO [STDOUT] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
  6. 0

    db:: 3.64::Routing query output to STDOUT 3a

    hivmr.com | 1 year ago
    java.lang.ClassCastException: org.apache.myfaces.renderkit.html.ext.HtmlButtonRenderer0:50:40,852 INFO [STDOUT] at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:876)0:50:40,852 INFO [STDOUT] at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:925)0:50:40,852 INFO [STDOUT] at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:406)0:50:40,852 INFO [STDOUT] at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:328)0:50:40,852 INFO [STDOUT] at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3669)0:50:40,852 INFO [STDOUT] at org.apache.catalina.core.StandardContext.start(StandardContext.java:4104)0:50:40,852 INFO [STDOUT] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)0:50:40,852 INFO [STDOUT] at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)0:50:40,852 INFO [STDOUT] at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)0:50:40,852 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)0:50:40,852 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)0:50:40,852 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)0:50:40,852 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:585)0:50:40,852 INFO [STDOUT] at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)0:50:40,852 INFO [STDOUT] at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:150)0:50:40,852 INFO [STDOUT] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)0:50:40,852 INFO [STDOUT] at org.apache.catalina.core.StandardContext.init(StandardContext.java:5005)0:50:40,852 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)0:50:40,852 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)0:50:40,852 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)0:50:40,852 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:585)0:50:40,852 INFO [STDOUT] at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)0:50:40,852 INFO [STDOUT] at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:150)0:50:40,852 INFO [STDOUT] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)0:50:40,852 INFO [STDOUT] at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeployInternal(TomcatDeployer.java:280)0:50:40,852 INFO [STDOUT] at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeploy(TomcatDeployer.java:88)0:50:40,852 INFO [STDOUT] at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:357)0:50:40,852 INFO [STDOUT] at org.jboss.web.WebModule.startModule(WebModule.java:68)0:50:40,852 INFO [STDOUT] at org.jboss.web.WebModule.startService(WebModule.java:46)0:50:40,852 INFO [STDOUT] at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:274)0:50:40,852 INFO [STDOUT] at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:230)0:50:40,852 INFO [STDOUT] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)

    Root Cause Analysis

    1. java.lang.ClassCastException

      [Ljava.lang.Enum; cannot be cast to [Lcom.read.maventest.interface.IMessage;

      at com.read.maventest.bean.TestEnumList$$FastClassBySpringCGLIB$$21d778f3.invoke()
    2. com.read.maventest
      TestEnumList$$FastClassBySpringCGLIB$$21d778f3.invoke
      1. com.read.maventest.bean.TestEnumList$$FastClassBySpringCGLIB$$21d778f3.invoke(<generated>)
      1 frame
    3. Spring Core
      MethodProxy.invoke
      1. org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
      1 frame
    4. Spring AOP
      MethodInvocationProceedingJoinPoint.proceed
      1. org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717)
      2. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
      3. org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52)
      4. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      5. org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85)
      5 frames
    5. com.read.maventest
      TimingAspect.timeStats
      1. com.read.maventest.bean.TimingAspect.timeStats(TimingAspect.java:25)
      1 frame
    6. Java RT
      DelegatingMethodAccessorImpl.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      3 frames