Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-3090

RequestMapping with array of paths causes ClassCastException in ControllerOperationsImpl.getExistingController() when trying to run 'web mvc all'

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 1.2.0.RELEASE
    • Fix Version/s: 1.2.2.RELEASE
    • Component/s: WEB MVC
    • Labels:
      None

      Description

      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)

        Attachments

          Activity

            People

            Assignee:
            stewarta Alan Stewart
            Reporter:
            altopal Alan Hamilton
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: