Uploaded image for project: 'Forge'
  1. Forge
  2. FORGE-2027

java.util.ArrayList cannot be cast to org.jboss.forge.addon.resource.Resource when scaffolding REST

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.11.0.Final
    • 2.10.1.Final
    • Scaffold
    • None

      When I scaffold a REST endpoint with several content types, I get an exception but the endpoint is created. When I execute the following script :

      project-new --named test --topLevelPackage org.agoncal.training.javaee6adv --type war --finalName test
      jpa-new-entity --named Author ;
      jpa-new-field --named firstName --length 50 --columnName first_name ;
      jpa-new-field --named lastName --length 50 --columnName last_name ;
      jpa-new-field --named bio --length 5000 ;
      jpa-new-field --named dateOfBirth --type java.util.Date --temporalType DATE --columnName date_of_birth ;
      jpa-new-field --named age --type java.lang.Integer --transient ;
      rest-generate-endpoints-from-entities --targets org.agoncal.training.javaee6adv.model.Author --contentType application/xml application/json
      

      I get the following output :

      Exception when parsing/running: rest-generate-endpoints-from-entities --targets org.agoncal.training.javaee6adv.model.Author --contentType application/xml application/json , java.util.ArrayList cannot be cast to org.jboss.forge.addon.resource.Resource
      

      With the following stack trace

      23:14:58,342 SEVERE [org.jboss.forge.addon.ui.impl.controller.AbstractCommandController] (AeshProcess: 8) Error while notifying listeners: java.lang.ClassCastException: java.util.ArrayList cannot be cast to org.jboss.forge.addon.resource.FileResource
      	at org.jboss.forge.addon.projects.Projects.getSelectedProject(Projects.java:37)
      	at org.jboss.forge.addon.projects.ui.ProjectBuildStatusListener.postCommandExecuted(ProjectBuildStatusListener.java:41)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_45]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_45]
      	at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_45]
      	at org.jboss.forge.furnace.proxy.ClassLoaderInterceptor$1.call(ClassLoaderInterceptor.java:87) [furnace-proxy-2.10.1.Final.jar:2.10.1.Final]
      	at org.jboss.forge.furnace.util.ClassLoaders.executeIn(ClassLoaders.java:42) [furnace-api-2.10.1.Final.jar:2.10.1.Final]
      	at org.jboss.forge.furnace.proxy.ClassLoaderInterceptor.invoke(ClassLoaderInterceptor.java:103) [furnace-proxy-2.10.1.Final.jar:2.10.1.Final]
      	at org.jboss.forge.addon.projects.ui.ProjectBuildStatusListener_$$_javassist_59d74715-a419-4cb7-bd02-126cfccbe569.postCommandExecuted(ProjectBuildStatusListener_$$_javassist_59d74715-a419-4cb7-bd02-126cfccbe569.java)
      	at org.jboss.forge.addon.ui.impl.controller.AbstractCommandController.firePostCommandExecuted(AbstractCommandController.java:144) [ui-impl-2.10.1.Final.jar:2.10.1.Final]
      	at org.jboss.forge.addon.ui.impl.controller.WizardCommandControllerImpl.execute(WizardCommandControllerImpl.java:155) [ui-impl-2.10.1.Final.jar:2.10.1.Final]
      	at org.jboss.forge.addon.ui.impl.controller.NoUIWizardControllerDecorator.execute(NoUIWizardControllerDecorator.java:152) [ui-impl-2.10.1.Final.jar:2.10.1.Final]
      	at org.jboss.forge.addon.shell.aesh.CommandAdapter.execute(CommandAdapter.java:74) [shell-impl-2.10.1.Final.jar:2.10.1.Final]
      	at org.jboss.aesh.console.AeshConsoleImpl$AeshConsoleCallbackImpl.execute(AeshConsoleImpl.java:325) [aesh-0.56.1.jar:0.56.1]
      	at org.jboss.aesh.console.AeshProcess.run(AeshProcess.java:40) [aesh-0.56.1.jar:0.56.1]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_45]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45]
      	at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]
      

              rhn-support-ggastald George Gastaldi
              agoncal Antonio Goncalves (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: