java.lang.ClassCastException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • A manually created Controller with a RequestMapping with multiple paths causes a ClassCastException when trying to run 'web mvc all'. An example RequestMapping would be: @RequestMapping(value = {"/", "/foo"}) I have tested this in 1.2.0, and looking at the source for ControllerOperationsImpl it looks like it is still a problem with the latest version of Roo. In the roo shell, the error looks like this (with version 1.2.0 of Roo): roo> web mvc all --package ~.web Your controller was created outside of the project's top level package and is therefore not included in the preconfigured component scanning. Please adjust your component scanning manually in webmvc-config.xml org.springframework.roo.classpath.details.annotations.ArrayAttributeValue cannot be cast to org.springframework.roo.classpath.details.annotations.StringAttributeValue java.lang.ClassCastException: org.springframework.roo.classpath.details.annotations.ArrayAttributeValue cannot be cast to org.springframework.roo.classpath.details.annotations.StringAttributeValue at org.springframework.roo.addon.web.mvc.controller.ControllerOperationsImpl.getExistingController(ControllerOperationsImpl.java:158) at org.springframework.roo.addon.web.mvc.controller.ControllerOperationsImpl.createAutomaticController(ControllerOperationsImpl.java:114) at org.springframework.roo.addon.web.mvc.controller.ControllerOperationsImpl.generateAll(ControllerOperationsImpl.java:102) at org.springframework.roo.addon.web.mvc.controller.ControllerCommands.webMvcAll(ControllerCommands.java:65) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.roo.support.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:191) at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy$1.callback(ProcessManagerHostedExecutionStrategy.java:49) at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:183) at org.springframework.roo.process.manager.internal.DefaultProcessManager.execute(DefaultProcessManager.java:146) at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.execute(ProcessManagerHostedExecutionStrategy.java:47) at org.springframework.roo.shell.AbstractShell.executeCommand(AbstractShell.java:205) at org.springframework.roo.shell.jline.JLineShell.promptLoop(JLineShell.java:404) at org.springframework.roo.shell.jline.JLineShell.run(JLineShell.java:158) at java.lang.Thread.run(Thread.java:662)
    via by Alan Hamilton,
  • A manually created Controller with a RequestMapping with multiple paths causes a ClassCastException when trying to run 'web mvc all'. An example RequestMapping would be: @RequestMapping(value = {"/", "/foo"}) I have tested this in 1.2.0, and looking at the source for ControllerOperationsImpl it looks like it is still a problem with the latest version of Roo. In the roo shell, the error looks like this (with version 1.2.0 of Roo): roo> web mvc all --package ~.web Your controller was created outside of the project's top level package and is therefore not included in the preconfigured component scanning. Please adjust your component scanning manually in webmvc-config.xml org.springframework.roo.classpath.details.annotations.ArrayAttributeValue cannot be cast to org.springframework.roo.classpath.details.annotations.StringAttributeValue java.lang.ClassCastException: org.springframework.roo.classpath.details.annotations.ArrayAttributeValue cannot be cast to org.springframework.roo.classpath.details.annotations.StringAttributeValue at org.springframework.roo.addon.web.mvc.controller.ControllerOperationsImpl.getExistingController(ControllerOperationsImpl.java:158) at org.springframework.roo.addon.web.mvc.controller.ControllerOperationsImpl.createAutomaticController(ControllerOperationsImpl.java:114) at org.springframework.roo.addon.web.mvc.controller.ControllerOperationsImpl.generateAll(ControllerOperationsImpl.java:102) at org.springframework.roo.addon.web.mvc.controller.ControllerCommands.webMvcAll(ControllerCommands.java:65) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.roo.support.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:191) at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy$1.callback(ProcessManagerHostedExecutionStrategy.java:49) at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:183) at org.springframework.roo.process.manager.internal.DefaultProcessManager.execute(DefaultProcessManager.java:146) at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.execute(ProcessManagerHostedExecutionStrategy.java:47) at org.springframework.roo.shell.AbstractShell.executeCommand(AbstractShell.java:205) at org.springframework.roo.shell.jline.JLineShell.promptLoop(JLineShell.java:404) at org.springframework.roo.shell.jline.JLineShell.run(JLineShell.java:158) at java.lang.Thread.run(Thread.java:662)
    via by Alan Hamilton,
    • java.lang.ClassCastException: org.springframework.roo.classpath.details.annotations.ArrayAttributeValue cannot be cast to org.springframework.roo.classpath.details.annotations.StringAttributeValue at org.springframework.roo.addon.web.mvc.controller.ControllerOperationsImpl.getExistingController(ControllerOperationsImpl.java:158) at org.springframework.roo.addon.web.mvc.controller.ControllerOperationsImpl.createAutomaticController(ControllerOperationsImpl.java:114) at org.springframework.roo.addon.web.mvc.controller.ControllerOperationsImpl.generateAll(ControllerOperationsImpl.java:102) at org.springframework.roo.addon.web.mvc.controller.ControllerCommands.webMvcAll(ControllerCommands.java:65) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.roo.support.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:191) at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy$1.callback(ProcessManagerHostedExecutionStrategy.java:49) at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:183) at org.springframework.roo.process.manager.internal.DefaultProcessManager.execute(DefaultProcessManager.java:146) at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.execute(ProcessManagerHostedExecutionStrategy.java:47) at org.springframework.roo.shell.AbstractShell.executeCommand(AbstractShell.java:205) at org.springframework.roo.shell.jline.JLineShell.promptLoop(JLineShell.java:404) at org.springframework.roo.shell.jline.JLineShell.run(JLineShell.java:158) at java.lang.Thread.run(Thread.java:662)
    No Bugmate found.