java.lang.ClassCastException: org.springframework.roo.model.EnumDetails cannot be cast to java.lang.Integer

Spring JIRA | Adam Pullen | 5 years ago
  1. 0

    I have a common jar file with classes like * User, * Group, * Permission, that is shared between 5 projects and the data is passed between all applications via web services. I have defined in these classes a inner class called Metadata that describes the classes i.e. * Field names, * Field sizes * Web Service end points This helps the other applications perform validation before passing the User object. I then want to use this metadata to describe the object to Hibernate and Spring, so I tried setting the @Size annotation for the fields. Hibernate is happy to use the Static fields, so is Spring. The applications compile and run. However Roo is not happy to generate the DataOnDemand classes for entities configured this way. Below are examples of what i am doing, and what roo is out-putting I have attached a ZIP file with a very very small Spring/Roo project Should kick off the error simply by extracting, then opening a roo console within the project roo {code:title=User.java} package au.com.finalconcept.annotation.usingconst.domain; import javax.validation.constraints.Size; import org.springframework.roo.addon.javabean.RooJavaBean; import org.springframework.roo.addon.jpa.activerecord.RooJpaActiveRecord; import org.springframework.roo.addon.tostring.RooToString; @RooJavaBean @RooToString @RooJpaActiveRecord public class User { public static final int MIN_SIZE = 3; @Size(min = MIN_SIZE, max = 60) private String username; } {code} {code:title=Roo.exe|borderStyle=solid} [Spring Roo Process Manager Background Polling Thread] org.springframework.roo.model.EnumDetails cannot be cast to java.lang.Integer java.lang.ClassCastException: org.springframework.roo.model.EnumDetails cannot be cast to java.lang.Integer at org.springframework.roo.addon.dod.DataOnDemandMetadata.getFieldInitializer(DataOnDemandMetadata.java:1013) at org.springframework.roo.addon.dod.DataOnDemandMetadata.<init>(DataOnDemandMetadata.java:149) at org.springframework.roo.addon.dod.DataOnDemandMetadataProviderImpl.getMetadata(DataOnDemandMetadataProviderImpl.java:181) at org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.get(AbstractItdMetadataProvider.java:324) at org.springframework.roo.metadata.DefaultMetadataService.getInternal(DefaultMetadataService.java:150) at org.springframework.roo.metadata.DefaultMetadataService.evictAndGet(DefaultMetadataService.java:285) at org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.notify(AbstractItdMetadataProvider.java:158) at org.springframework.roo.metadata.DefaultMetadataService.notify(DefaultMetadataService.java:240) at org.springframework.roo.metadata.internal.DefaultMetadataDependencyRegistry.notifyDownstream(DefaultMetadataDependencyRegistry.java:191) at org.springframework.roo.classpath.DefaultPhysicalTypeMetadataProvider.onFileEvent(DefaultPhysicalTypeMetadataProvider.java:97) at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.publish(PollingFileMonitorService.java:350) at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.scanAll(PollingFileMonitorService.java:323) at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:181) at org.springframework.roo.process.manager.internal.DefaultProcessManager.backgroundPoll(DefaultProcessManager.java:128) at org.springframework.roo.process.manager.internal.DefaultProcessManager.timerBasedPoll(DefaultProcessManager.java:243) at org.springframework.roo.process.manager.internal.DefaultProcessManager$2.run(DefaultProcessManager.java:71) at java.lang.Thread.run(Unknown Source) {code} P.s. Is there a switch to enable logging in Roo? Took around 3 hours to find what the cause was.

    Spring JIRA | 5 years ago | Adam Pullen
    java.lang.ClassCastException: org.springframework.roo.model.EnumDetails cannot be cast to java.lang.Integer
  2. 0

    I have a common jar file with classes like * User, * Group, * Permission, that is shared between 5 projects and the data is passed between all applications via web services. I have defined in these classes a inner class called Metadata that describes the classes i.e. * Field names, * Field sizes * Web Service end points This helps the other applications perform validation before passing the User object. I then want to use this metadata to describe the object to Hibernate and Spring, so I tried setting the @Size annotation for the fields. Hibernate is happy to use the Static fields, so is Spring. The applications compile and run. However Roo is not happy to generate the DataOnDemand classes for entities configured this way. Below are examples of what i am doing, and what roo is out-putting I have attached a ZIP file with a very very small Spring/Roo project Should kick off the error simply by extracting, then opening a roo console within the project roo {code:title=User.java} package au.com.finalconcept.annotation.usingconst.domain; import javax.validation.constraints.Size; import org.springframework.roo.addon.javabean.RooJavaBean; import org.springframework.roo.addon.jpa.activerecord.RooJpaActiveRecord; import org.springframework.roo.addon.tostring.RooToString; @RooJavaBean @RooToString @RooJpaActiveRecord public class User { public static final int MIN_SIZE = 3; @Size(min = MIN_SIZE, max = 60) private String username; } {code} {code:title=Roo.exe|borderStyle=solid} [Spring Roo Process Manager Background Polling Thread] org.springframework.roo.model.EnumDetails cannot be cast to java.lang.Integer java.lang.ClassCastException: org.springframework.roo.model.EnumDetails cannot be cast to java.lang.Integer at org.springframework.roo.addon.dod.DataOnDemandMetadata.getFieldInitializer(DataOnDemandMetadata.java:1013) at org.springframework.roo.addon.dod.DataOnDemandMetadata.<init>(DataOnDemandMetadata.java:149) at org.springframework.roo.addon.dod.DataOnDemandMetadataProviderImpl.getMetadata(DataOnDemandMetadataProviderImpl.java:181) at org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.get(AbstractItdMetadataProvider.java:324) at org.springframework.roo.metadata.DefaultMetadataService.getInternal(DefaultMetadataService.java:150) at org.springframework.roo.metadata.DefaultMetadataService.evictAndGet(DefaultMetadataService.java:285) at org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.notify(AbstractItdMetadataProvider.java:158) at org.springframework.roo.metadata.DefaultMetadataService.notify(DefaultMetadataService.java:240) at org.springframework.roo.metadata.internal.DefaultMetadataDependencyRegistry.notifyDownstream(DefaultMetadataDependencyRegistry.java:191) at org.springframework.roo.classpath.DefaultPhysicalTypeMetadataProvider.onFileEvent(DefaultPhysicalTypeMetadataProvider.java:97) at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.publish(PollingFileMonitorService.java:350) at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.scanAll(PollingFileMonitorService.java:323) at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:181) at org.springframework.roo.process.manager.internal.DefaultProcessManager.backgroundPoll(DefaultProcessManager.java:128) at org.springframework.roo.process.manager.internal.DefaultProcessManager.timerBasedPoll(DefaultProcessManager.java:243) at org.springframework.roo.process.manager.internal.DefaultProcessManager$2.run(DefaultProcessManager.java:71) at java.lang.Thread.run(Unknown Source) {code} P.s. Is there a switch to enable logging in Roo? Took around 3 hours to find what the cause was.

    Spring JIRA | 5 years ago | Adam Pullen
    java.lang.ClassCastException: org.springframework.roo.model.EnumDetails cannot be cast to java.lang.Integer
  3. 0

    java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Byte

    GitHub | 3 years ago | PhilAndrew
    java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Byte
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Execution Error, return code 2 while executing query in hive for twitter sentiment analysis

    Stack Overflow | 3 weeks ago | Ayushi Jain
    org.apache.hadoop.hive.ql.metadata.HiveException: org.apache.hadoop.hive.ql.metadata.HiveException: org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
  6. 0

    Crash on client for entity drzhark.mocreatures.entity.aquatic.MoCEntityCod

    GitHub | 1 month ago | dotModded
    java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Boolean

    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.roo.model.EnumDetails cannot be cast to java.lang.Integer

      at org.springframework.roo.addon.dod.DataOnDemandMetadata.getFieldInitializer()
    2. Spring Roo - Annotations (ASLv2 Licensed)
      DataOnDemandMetadataProviderImpl.getMetadata
      1. org.springframework.roo.addon.dod.DataOnDemandMetadata.getFieldInitializer(DataOnDemandMetadata.java:1013)
      2. org.springframework.roo.addon.dod.DataOnDemandMetadata.<init>(DataOnDemandMetadata.java:149)
      3. org.springframework.roo.addon.dod.DataOnDemandMetadataProviderImpl.getMetadata(DataOnDemandMetadataProviderImpl.java:181)
      3 frames
    3. org.springframework.roo
      DefaultProcessManager$2.run
      1. org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.get(AbstractItdMetadataProvider.java:324)
      2. org.springframework.roo.metadata.DefaultMetadataService.getInternal(DefaultMetadataService.java:150)
      3. org.springframework.roo.metadata.DefaultMetadataService.evictAndGet(DefaultMetadataService.java:285)
      4. org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.notify(AbstractItdMetadataProvider.java:158)
      5. org.springframework.roo.metadata.DefaultMetadataService.notify(DefaultMetadataService.java:240)
      6. org.springframework.roo.metadata.internal.DefaultMetadataDependencyRegistry.notifyDownstream(DefaultMetadataDependencyRegistry.java:191)
      7. org.springframework.roo.classpath.DefaultPhysicalTypeMetadataProvider.onFileEvent(DefaultPhysicalTypeMetadataProvider.java:97)
      8. org.springframework.roo.file.monitor.polling.PollingFileMonitorService.publish(PollingFileMonitorService.java:350)
      9. org.springframework.roo.file.monitor.polling.PollingFileMonitorService.scanAll(PollingFileMonitorService.java:323)
      10. org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:181)
      11. org.springframework.roo.process.manager.internal.DefaultProcessManager.backgroundPoll(DefaultProcessManager.java:128)
      12. org.springframework.roo.process.manager.internal.DefaultProcessManager.timerBasedPoll(DefaultProcessManager.java:243)
      13. org.springframework.roo.process.manager.internal.DefaultProcessManager$2.run(DefaultProcessManager.java:71)
      13 frames
    4. Java RT
      Thread.run
      1. java.lang.Thread.run(Unknown Source)
      1 frame