java.lang.ClassCastException: org.springframework.data.mapping.context.MappingContextEvent cannot be cast to org.springframework.data.neo4j.event.AfterSaveEvent at com.xenoterracide.rpf.ui.Config$$Lambda$9/191715985.onApplicationEvent(Unknown Source) ~[na:na]

Spring JIRA | Caleb Cushing | 10 months ago
  1. 0

    {code} java.lang.ClassCastException: org.springframework.data.mapping.context.MappingContextEvent cannot be cast to org.springframework.data.neo4j.event.AfterSaveEvent at com.xenoterracide.rpf.ui.Config$$Lambda$9/191715985.onApplicationEvent(Unknown Source) ~[na:na] at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:163) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:136) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:119) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.context.support.AbstractApplicationContext.registerListeners(AbstractApplicationContext.java:809) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:535) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:764) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:357) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:305) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1124) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1113) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] at com.xenoterracide.rpf.TestApplication.main(TestApplication.java:13) [test-classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_45] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_45] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_45] at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_45] {code} {code} @Bean public static ApplicationListener<AfterSaveEvent> characterSaveListener( final MBassador<CharacterEventMessage> bus ) { return event -> { Object entity = event.getEntity(); if ( entity instanceof Character ) { bus.post( CharacterEventMessage.saved( (Character) entity ) ); } }; } {code} happy to attempt to provide more info if necessary. It's possible this is just a documentation error.

    Spring JIRA | 10 months ago | Caleb Cushing
    java.lang.ClassCastException: org.springframework.data.mapping.context.MappingContextEvent cannot be cast to org.springframework.data.neo4j.event.AfterSaveEvent at com.xenoterracide.rpf.ui.Config$$Lambda$9/191715985.onApplicationEvent(Unknown Source) ~[na:na]
  2. 0

    {code} java.lang.ClassCastException: org.springframework.data.mapping.context.MappingContextEvent cannot be cast to org.springframework.data.neo4j.event.AfterSaveEvent at com.xenoterracide.rpf.ui.Config$$Lambda$9/191715985.onApplicationEvent(Unknown Source) ~[na:na] at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:163) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:136) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:119) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.context.support.AbstractApplicationContext.registerListeners(AbstractApplicationContext.java:809) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:535) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:764) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:357) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:305) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1124) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1113) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] at com.xenoterracide.rpf.TestApplication.main(TestApplication.java:13) [test-classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_45] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_45] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_45] at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_45] {code} {code} @Bean public static ApplicationListener<AfterSaveEvent> characterSaveListener( final MBassador<CharacterEventMessage> bus ) { return event -> { Object entity = event.getEntity(); if ( entity instanceof Character ) { bus.post( CharacterEventMessage.saved( (Character) entity ) ); } }; } {code} happy to attempt to provide more info if necessary. It's possible this is just a documentation error.

    Spring JIRA | 10 months ago | Caleb Cushing
    java.lang.ClassCastException: org.springframework.data.mapping.context.MappingContextEvent cannot be cast to org.springframework.data.neo4j.event.AfterSaveEvent at com.xenoterracide.rpf.ui.Config$$Lambda$9/191715985.onApplicationEvent(Unknown Source) ~[na:na]
  3. 0

    New in 3.2.3.RELEASE there is a bug in how Spring determines bean names from annotations. The annotation that is causing the issue looks like: {code:java} @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) @Component public @interface ConfigurationAnalyzer { ConfigurationType[] value(); } {code} Based on the stack trace generated by the bug, it's pretty straight forward where [things are going wrong|https://github.com/SpringSource/spring-framework/blob/v3.2.3.RELEASE/spring-context/src/main/java/org/springframework/context/annotation/AnnotationBeanNameGenerator.java#L91]. {noformat} java.lang.ClassCastException: [L<REDACTED>.ConfigurationType; cannot be cast to java.lang.String at org.springframework.context.annotation.AnnotationBeanNameGenerator.determineBeanNameFromAnnotation(AnnotationBeanNameGenerator.java:91) at org.springframework.context.annotation.AnnotationBeanNameGenerator.generateBeanName(AnnotationBeanNameGenerator.java:69) at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:246) at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:123) at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:191) at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:165) at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:140) at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:282) at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:223) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:630) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461) <REDACTED> {noformat}

    Spring JIRA | 4 years ago | nebhale
    java.lang.ClassCastException: [L<REDACTED>.ConfigurationType; cannot be cast to java.lang.String
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    New in 3.2.3.RELEASE there is a bug in how Spring determines bean names from annotations. The annotation that is causing the issue looks like: {code:java} @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) @Component public @interface ConfigurationAnalyzer { ConfigurationType[] value(); } {code} Based on the stack trace generated by the bug, it's pretty straight forward where [things are going wrong|https://github.com/SpringSource/spring-framework/blob/v3.2.3.RELEASE/spring-context/src/main/java/org/springframework/context/annotation/AnnotationBeanNameGenerator.java#L91]. {noformat} java.lang.ClassCastException: [L<REDACTED>.ConfigurationType; cannot be cast to java.lang.String at org.springframework.context.annotation.AnnotationBeanNameGenerator.determineBeanNameFromAnnotation(AnnotationBeanNameGenerator.java:91) at org.springframework.context.annotation.AnnotationBeanNameGenerator.generateBeanName(AnnotationBeanNameGenerator.java:69) at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:246) at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:123) at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:191) at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:165) at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:140) at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:282) at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:223) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:630) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461) <REDACTED> {noformat}

    Spring JIRA | 4 years ago | nebhale
    java.lang.ClassCastException: [L<REDACTED>.ConfigurationType; cannot be cast to java.lang.String
  6. 0

    A classloader proplem related to spring-boot-devtools

    Stack Overflow | 1 year ago | zhuguowei
    java.lang.ClassCastException: com.foo.goods.model.GoodsPrice cannot be cast to com.foo.goods.model.GoodsPrice at com.foo.goods.service.GoodsService$$Lambda$11/310447431.accept(Unknown Source) ~[na:na]

    1 unregistered visitors
    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

      org.springframework.data.mapping.context.MappingContextEvent cannot be cast to org.springframework.data.neo4j.event.AfterSaveEvent at com.xenoterracide.rpf.ui.Config$$Lambda$9/191715985.onApplicationEvent(Unknown Source) ~[na:na]

      at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener()
    2. Spring Context
      AbstractApplicationContext.refresh
      1. org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:163)[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
      2. org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:136)[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
      3. org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:119)[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
      4. org.springframework.context.support.AbstractApplicationContext.registerListeners(AbstractApplicationContext.java:809)[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
      5. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:535)[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
      5 frames
    3. Spring Boot
      SpringApplication.run
      1. org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)[spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
      2. org.springframework.boot.SpringApplication.refresh(SpringApplication.java:764)[spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
      3. org.springframework.boot.SpringApplication.doRun(SpringApplication.java:357)[spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
      4. org.springframework.boot.SpringApplication.run(SpringApplication.java:305)[spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
      5. org.springframework.boot.SpringApplication.run(SpringApplication.java:1124)[spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
      6. org.springframework.boot.SpringApplication.run(SpringApplication.java:1113)[spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE]
      6 frames
    4. com.xenoterracide.rpf
      TestApplication.main
      1. com.xenoterracide.rpf.TestApplication.main(TestApplication.java:13)[test-classes/:na]
      1 frame
    5. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[na:1.8.0_45]
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[na:1.8.0_45]
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[na:1.8.0_45]
      4. java.lang.reflect.Method.invoke(Method.java:497)[na:1.8.0_45]
      4 frames