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

Spring JIRA | Adam Pullen | 5 years ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  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

    Help:basic RMI question

    Google Groups | 2 decades ago | Paolo De Lutiis
    java.lang.ClassCastException: serverPackage.ServerClass_Stub at clientPackage.myApplet.init(myApplet.java:line#) at sun.applet.AppletPanel.run(AppletPanel.java:273) at java.lang.Thread.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Shared hosting Bungeecord problems.

    GitHub | 3 years ago | Arksenu
    java.lang.ClassCastException: bka cannot be cast to fs All my servers are set to onlinemode: false Here is my config.yml groups: arksenu: - admin disabled_commands: - find player_limit: -1 stats: 347d1d62-6fb6-4869-bd43-7d0745de8e3c permissions: default: - bungeecord.command.server - bungeecord.command.list admin: - bungeecord.command.ip - bungeecord.command.alert - bungeecord.command.end - bungeecord.command.reload listeners: - max_players: 18 fallback_server: hub host: 0.0.0.0:35289 bind_local_address: true ping_passthrough: false tab_list: GLOBAL_PING default_server: hub forced_hosts: pvp.md-5.net: hub tab_size: 60 force_default_server: true motd: ’Network’ query_enabled: false query_port: 25565 timeout: 30000 connection_throttle: 4000 servers: hub: address: 108.170.8.146:35289 restricted: false motd: test UvGames: address: 66.85.165.170:26200 restricted: false motd: test UvPrison: address: 66.85.128.90:25928 restricted: false motd: test ip_forward: false online_mode: true And here is my console message -> UpstreamBridge has disconnected disconnected with: Exception Connecting:RuntimeException : Server is online mode! @ net.md_5.bungee.ServerConnector:188
  6. 0

    Shared hosting Bungeecord problems.

    GitHub | 3 years ago | Arksenu
    java.lang.ClassCastException: bka cannot be cast to fs All my servers are set to onlinemode: false Here is my config.yml groups: arksenu: - admin disabled_commands: - find player_limit: -1 stats: 347d1d62-6fb6-4869-bd43-7d0745de8e3c permissions: default: - bungeecord.command.server - bungeecord.command.list admin: - bungeecord.command.ip - bungeecord.command.alert - bungeecord.command.end - bungeecord.command.reload listeners: - max_players: 18 fallback_server: hub host: 0.0.0.0:35289 bind_local_address: true ping_passthrough: false tab_list: GLOBAL_PING default_server: hub forced_hosts: pvp.md-5.net: hub tab_size: 60 force_default_server: true motd: ’Network’ query_enabled: false query_port: 25565 timeout: 30000 connection_throttle: 4000 servers: hub: address: 108.170.8.146:35289 restricted: false motd: test UvGames: address: 66.85.165.170:26200 restricted: false motd: test UvPrison: address: 66.85.128.90:25928 restricted: false motd: test ip_forward: false online_mode: true And here is my console message -> UpstreamBridge has disconnected disconnected with: Exception Connecting:RuntimeException : Server is online mode! @ net.md_5.bungee.ServerConnector:188

    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