java.lang.ClassCastException: Sample cannot be cast to Sample

Spring JIRA | Dave Syer | 3 months ago
  1. 0

    A groovy bean defined through `<lang:groovy/>` is supposed to be refreshable (and there are tests that prove it I know). But actually executing a method on one of those beans after a refresh appears to be an error: {noformat} 2016-09-15 11:46:50.517 ERROR 22523 --- [nio-8080-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet]  : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.ClassCastException: Sample cannot be cast to Sample] with root cause java.lang.ClassCastException: Sample cannot be cast to Sample at Sample$$FastClassBySpringCGLIB$$932c61ca.invoke(<generated>) ~[na:na] at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720) ~[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133) ~[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121) ~[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655) ~[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE] at Sample$$EnhancerBySpringCGLIB$$e2736740.home(<generated>) ~[na:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_60] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_60] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_60] at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_60] at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) ~[spring-web-4.3.2.RELEASE.jar:4.3.2.RELEASE] ... {noformat} Here's a sample: https://github.com/spring-projects/spring-framework-issues/pull/140 (just run the app, curl the home page, then edit the script and try again). It's a Spring Cloud user again that noticed this: https://github.com/spring-cloud/spring-cloud-netflix/issues/223

    Spring JIRA | 3 months ago | Dave Syer
    java.lang.ClassCastException: Sample cannot be cast to Sample
  2. 0

    Memcached Java客户端2.6.1发布 - 编程语言 - ITeye资讯

    iteye.com | 1 year ago
    java.lang.ClassCastException: cannot be cast to
  3. 0

    cannot be cast to javax.servlet.Filter

    Oracle Community | 6 years ago | YE
    java.lang.ClassCastException: cannot be cast to javax.servlet.Filter
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    ClassCastException at org.eclipse.zest.core.viewers.internal.GraphModelEntityFactory.doBuildGraph(GraphModelEntityFactory.java:87)

    Eclipse Bugzilla | 7 years ago | phil_fj12
    java.lang.ClassCastException: [...] cannot be cast to org.eclipse.zest.core.viewers.IGraphEntityContentProvider
  6. 0

    deploy EAR to weblogic 10.3.4

    Oracle Community | 6 years ago | YE
    java.lang.ClassCastException: cannot be cast to javax.servlet.Filter

    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

      Sample cannot be cast to Sample

      at Sample$$FastClassBySpringCGLIB$$932c61ca.invoke()
    2. Unknown
      Sample$$FastClassBySpringCGLIB$$932c61ca.invoke
      1. Sample$$FastClassBySpringCGLIB$$932c61ca.invoke(<generated>)[na:na]
      1 frame
    3. Spring Core
      MethodProxy.invoke
      1. org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)[spring-core-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      1 frame
    4. Spring AOP
      CglibAopProxy$DynamicAdvisedInterceptor.intercept
      1. org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      2. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      3. org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      4. org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      5. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      6. org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      6 frames
    5. Unknown
      Sample$$EnhancerBySpringCGLIB$$e2736740.home
      1. Sample$$EnhancerBySpringCGLIB$$e2736740.home(<generated>)[na:na]
      1 frame
    6. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[na:1.8.0_60]
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[na:1.8.0_60]
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[na:1.8.0_60]
      4. java.lang.reflect.Method.invoke(Method.java:497)[na:1.8.0_60]
      4 frames
    7. Spring
      InvocableHandlerMethod.doInvoke
      1. org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)[spring-web-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      1 frame