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

Spring JIRA | Andy Clement | 1 year ago
  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 | 1 year 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 | 1 year ago | Andy Clement
    java.lang.ClassCastException: [Ljava.lang.Enum; cannot be cast to [Lcom.read.maventest.interface.IMessage;
  3. 0

    fj.data.Java#EnumSet_List throws ClassCastException

    GitHub | 3 years ago | cedriessen
    java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.Enum;
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    I am passing an array of enums, which is a GLRM input parameter, to different nodes and get the following error: onExCompletion for water.FJPacket@c7a5487 java.lang.ClassCastException: [Ljava.lang.Enum; cannot be cast to [Lhex.glrm.GLRMModel$GLRMParameters$Loss; at hex.glrm.GLRMModel$GLRMParameters$Icer.read77(GLRMModel$GLRMParameters$Icer.java) at hex.glrm.GLRMModel$GLRMParameters$Icer.read(GLRMModel$GLRMParameters$Icer.java) at water.Iced.read(Iced.java:55) at water.Iced.read(Iced.java:33) at water.AutoBuffer.get(AutoBuffer.java:799) at hex.ModelBuilder$Icer.read75(ModelBuilder$Icer.java) at hex.glrm.GLRM$Icer.read74(GLRM$Icer.java) at hex.glrm.GLRM$Icer.read(GLRM$Icer.java) at water.Iced.read(Iced.java:55) at water.Iced.read(Iced.java:33) at water.AutoBuffer.get(AutoBuffer.java:799) at water.Job$3$Icer.read56(Job$3$Icer.java) at water.Job$3$Icer.read(Job$3$Icer.java) at water.H2O$H2OCountedCompleter.read(H2O.java:1047) at water.H2O$H2OCountedCompleter.read(H2O.java:967) at water.AutoBuffer.get(AutoBuffer.java:799) at water.RPC.remote_exec(RPC.java:489) at water.FJPacket.compute2(FJPacket.java:28) at water.H2O$H2OCountedCompleter.compute(H2O.java:1005) at jsr166y.CountedCompleter.exec(CountedCompleter.java:429) at jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:263) at jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:974) at jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1477) at jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104)

    JIRA | 1 year ago | Anqi Fu
    java.lang.ClassCastException: [Ljava.lang.Enum; cannot be cast to [Lhex.glrm.GLRMModel$GLRMParameters$Loss;
  6. 0

    I am passing an array of enums, which is a GLRM input parameter, to different nodes and get the following error: onExCompletion for water.FJPacket@c7a5487 java.lang.ClassCastException: [Ljava.lang.Enum; cannot be cast to [Lhex.glrm.GLRMModel$GLRMParameters$Loss; at hex.glrm.GLRMModel$GLRMParameters$Icer.read77(GLRMModel$GLRMParameters$Icer.java) at hex.glrm.GLRMModel$GLRMParameters$Icer.read(GLRMModel$GLRMParameters$Icer.java) at water.Iced.read(Iced.java:55) at water.Iced.read(Iced.java:33) at water.AutoBuffer.get(AutoBuffer.java:799) at hex.ModelBuilder$Icer.read75(ModelBuilder$Icer.java) at hex.glrm.GLRM$Icer.read74(GLRM$Icer.java) at hex.glrm.GLRM$Icer.read(GLRM$Icer.java) at water.Iced.read(Iced.java:55) at water.Iced.read(Iced.java:33) at water.AutoBuffer.get(AutoBuffer.java:799) at water.Job$3$Icer.read56(Job$3$Icer.java) at water.Job$3$Icer.read(Job$3$Icer.java) at water.H2O$H2OCountedCompleter.read(H2O.java:1047) at water.H2O$H2OCountedCompleter.read(H2O.java:967) at water.AutoBuffer.get(AutoBuffer.java:799) at water.RPC.remote_exec(RPC.java:489) at water.FJPacket.compute2(FJPacket.java:28) at water.H2O$H2OCountedCompleter.compute(H2O.java:1005) at jsr166y.CountedCompleter.exec(CountedCompleter.java:429) at jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:263) at jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:974) at jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1477) at jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104)

    JIRA | 1 year ago | Anqi Fu
    java.lang.ClassCastException: [Ljava.lang.Enum; cannot be cast to [Lhex.glrm.GLRMModel$GLRMParameters$Loss;

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    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