Spring Roo
  1. Spring Roo
  2. ROO-2931

GWT compilation errors when proxies or requests are in non-default package

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Complete
    • Affects Version/s: 1.2.0.RC1
    • Fix Version/s: 1.2.0.RELEASE
    • Component/s: GWT
    • Labels:
      None
    • Environment:
      Windows 7, Roo 1.2.0.RC1 (also M1), GWT 2.4, Eclipse 3.5

      Description

      I'm having some problems getting GWT working properly - I am using the latest 1.2.0.RC1, downloaded this morning.

      I am trying to create a simple GWT version of the pizza shop sample, executing the following commands:

      // Spring Roo 1.2.0.RC1 [rev dcaa483] log opened at 2011-11-24 09:50:14
      project --topLevelPackage com.springsource.roo.pizzashopRC1
      persistence setup --provider HIBERNATE --database HYPERSONIC_PERSISTENT
      entity jpa --class ~.domain.Topping --testAutomatically
      field string --fieldName name --notNull --sizeMin 2
      entity jpa --class ~.domain.Base --testAutomatically
      field string --fieldName name --notNull --sizeMin 2
      entity jpa --class ~.domain.Pizza --testAutomatically
      field string --fieldName name --notNull --sizeMin 2
      field number --fieldName price --type java.lang.Float
      field set --fieldName toppings --type ~.domain.Topping
      field reference --fieldName base --type ~.domain.Base
      entity jpa --class ~.domain.PizzaOrder --testAutomatically
      field string --fieldName name --notNull --sizeMin 2
      field string --fieldName address --sizeMax 30
      field number --fieldName total --type java.lang.Float
      field date --fieldName deliveryDate --type java.util.Date
      field set --fieldName pizzas --type ~.domain.Pizza
      // script pizzaEntities.roo
      web gwt setup
      web gwt all --proxyPackage ~.gwt.proxy --requestPackage ~.gwt.request
      perform eclipse

      So far, so good. But when I import the project into Eclipse, I get the following build error:

      The project 'pizzashoprc1' does not have any GWT SDKs on its build path

      I can fix this by manually adding the GWT SDKs into the build path (I'm using GWT 2.4). However, when I try to start the app from Eclipse, using the Run As > Web Application, I get the error:

      Could not find any host pages in project pizzashoprc1.

      I can launch the app from the command line using mvn gwt:run, but then I get the following error when I go to the URL in a browser:

      onModuleLoad() threw an exception
      
      Exception while loading module com.springsource.roo.pizzashoprc1.client.scaffold.Scaffold. See Development Mode for details.
      java.lang.reflect.InvocationTargetException 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 com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396)
       at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
       at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:525)
       at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
       at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.RuntimeException: Deferred binding failed for 'com.springsource.roo.pizzashoprc1.client.scaffold.ioc.DesktopInjector' (did you forget to inherit a required module?)
       at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:53)
       at com.google.gwt.core.client.GWT.create(GWT.java:97)
       at com.springsource.roo.pizzashoprc1.client.scaffold.ioc.DesktopInjectorWrapper.getInjector(DesktopInjectorWrapper.java:8)
       at com.springsource.roo.pizzashoprc1.client.scaffold.Scaffold.onModuleLoad(Scaffold.java:16)
       ... 9 more 
      Caused by: com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
       at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:595)
       at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:455)
       at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49)
       ... 12 more

      I've also attached a screenshot of the error in the GWT Dev Mode console.

        Activity

        Hide
        Andrew Swan added a comment - - edited

        I've replicated the "mvn gwt:run" error with the latest revision of Roo. The problem can also be replicated by simply running "mvn compile gwt:compile".

        Show
        Andrew Swan added a comment - - edited I've replicated the " mvn gwt:run " error with the latest revision of Roo. The problem can also be replicated by simply running " mvn compile gwt:compile ".
        Hide
        Andrew Swan added a comment - - edited

        Updated the title to reflect the exact failure scenario.

        Reduced the severity to "minor" as there are workarounds; either:

        • change the script to scaffold the GWT proxies and requests using the default packages (as per the built-in expenses.roo sample script):
          ...
          web gwt all --proxyPackage ~.client.proxy --requestPackage ~.client.request
        • or edit the created ApplicationScaffold.gwt.xml file, changing the dotted source paths to be slash-separated:
          <!--
          <source path="gwt.request"/>
          <source path="gwt.proxy"/>
          -->
          <source path="gwt/request"/>
          <source path="gwt/proxy"/>

        The reported problems with importing the project into Eclipse seem unrelated to Roo; please log them separately via the Eclipse issue tracker.

        Show
        Andrew Swan added a comment - - edited Updated the title to reflect the exact failure scenario. Reduced the severity to "minor" as there are workarounds; either: change the script to scaffold the GWT proxies and requests using the default packages (as per the built-in expenses.roo sample script): ... web gwt all --proxyPackage ~.client.proxy --requestPackage ~.client.request or edit the created ApplicationScaffold.gwt.xml file, changing the dotted source paths to be slash-separated: <!-- <source path= "gwt.request" /> <source path= "gwt.proxy" /> --> <source path= "gwt/request" /> <source path= "gwt/proxy" /> The reported problems with importing the project into Eclipse seem unrelated to Roo; please log them separately via the Eclipse issue tracker .
        Hide
        Andrew Swan added a comment -

        Git commit 23a9d6bf1550fb88141f2020621b55922910f05f applies the second of the above fixes, based on advice given in the GWT path handling FAQ.

        Andrew (White), if you could please test this fix on Windows, I'd be much obliged. I ask this because it's not clear from the FAQ whether the paths should use slashes or the platform-specific File.separator (on my test machine these are the same, but not on Windows of course).

        Show
        Andrew Swan added a comment - Git commit 23a9d6bf1550fb88141f2020621b55922910f05f applies the second of the above fixes, based on advice given in the GWT path handling FAQ . Andrew (White), if you could please test this fix on Windows, I'd be much obliged. I ask this because it's not clear from the FAQ whether the paths should use slashes or the platform-specific File.separator (on my test machine these are the same, but not on Windows of course).
        Hide
        Andrew White added a comment -

        I've tested again using the most recent snapshot. I've still got issues with getting it to run properly in Eclipse, but it does run successfully from the command line, using mvn gwt:run.

        However, once up and running I noticed that the generated GWT screens do not appear to have catered for the entity associations. So, for example, you can create a Pizza with a name and price, but not set the Base or add Toppings.

        Show
        Andrew White added a comment - I've tested again using the most recent snapshot. I've still got issues with getting it to run properly in Eclipse, but it does run successfully from the command line, using mvn gwt:run. However, once up and running I noticed that the generated GWT screens do not appear to have catered for the entity associations. So, for example, you can create a Pizza with a name and price, but not set the Base or add Toppings.
        Hide
        Andrew Swan added a comment -

        Yes, the "web gwt all" command would have been emitting these errors, amongst its other output:

        ...
        The path to type java.util.Set which is used in type com.springsource.roo.pizzashoprc1.domain.Pizza by the field 'getToppings' needs to be added to the module's gwt.xml file in order to be used in a Proxy.
        The path to type com.springsource.roo.pizzashoprc1.myproxy.proxy.BaseProxy which is used in type com.springsource.roo.pizzashoprc1.domain.Pizza by the field 'getBase' needs to be added to the module's gwt.xml file in order to be used in a Proxy.
        ...
        The path to type java.util.Set which is used in type com.springsource.roo.pizzashoprc1.domain.PizzaOrder by the field 'getPizzas' needs to be added to the module's gwt.xml file in order to be used in a Proxy.
        ...

        I have fixed this in Git commit 280149c8bb61598039632e4cc742dfaa2eb58b24, which allows associations to be properly persisted on OS X at least; please retest on Windows as well and let me know.

        Show
        Andrew Swan added a comment - Yes, the " web gwt all " command would have been emitting these errors, amongst its other output: ... The path to type java.util.Set which is used in type com.springsource.roo.pizzashoprc1.domain.Pizza by the field 'getToppings' needs to be added to the module's gwt.xml file in order to be used in a Proxy. The path to type com.springsource.roo.pizzashoprc1.myproxy.proxy.BaseProxy which is used in type com.springsource.roo.pizzashoprc1.domain.Pizza by the field 'getBase' needs to be added to the module's gwt.xml file in order to be used in a Proxy. ... The path to type java.util.Set which is used in type com.springsource.roo.pizzashoprc1.domain.PizzaOrder by the field 'getPizzas' needs to be added to the module's gwt.xml file in order to be used in a Proxy. ... I have fixed this in Git commit 280149c8bb61598039632e4cc742dfaa2eb58b24 , which allows associations to be properly persisted on OS X at least; please retest on Windows as well and let me know.
        Hide
        Andrew White added a comment -

        I've re-tested on Windows, and all it is all working well now. Thanks for the quick turnaround.

        Show
        Andrew White added a comment - I've re-tested on Windows, and all it is all working well now. Thanks for the quick turnaround.
        Hide
        Andrew Swan added a comment -

        Fixed by the two commits mentioned above. Tested by running the above-scripted application and checking that all entities and their associations can be persisted.

        Show
        Andrew Swan added a comment - Fixed by the two commits mentioned above. Tested by running the above-scripted application and checking that all entities and their associations can be persisted.

          People

          • Assignee:
            Andrew Swan
            Reporter:
            Andrew White
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: