2 Replies Latest reply on Oct 9, 2008 6:16 AM by prog1act

    easy example not so easy!

      on the grails+flex plugin site: http://grails.org/Flex+Plugin

      it says that integrating flex and grails is SO easy, but i can't get the simple example to work!
      (i'm using MAC OS X)
      here is EXACTLY what i've tried:
      1-in my workspace, from the terminal window i type: "grails create-app helloWorld"
      2-i then enter the 'helloWorld' folder on the terminal and type: "grails create-service hello"
      3- i then open helloService.groovy in eclipse and copy the code from the above URL for the helloService, so that the file looks like this:
      class HelloService {
      static expose = ['flex-remoting']
      def hello() { return "Hello World!" }
      4-I then switch to Flex Builder, open a new project, and in source view, i create a file and copy in the code from the URL, so it looks like this:
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">
      <mx:RemoteObject id="ro" destination="helloService"/>
      <mx:Button label="Hello" click="ro.hello()"/> <mx:TextInput text="{ro.hello.lastResult}"/>
      5-i then switch back to the terminal window, and type: "grails run-app hello" in the helloWorld root. It starts up OK, telling me to browse to " http://localhost:8080/helloWorld".

      6-i then run the Flex app from FB3, but when i click on the button, i get the following error:
      [RPC Fault faultString="[MessagingError message='Destination 'helloService' either does not exist or the destination has no channels defined (and the application does not define any default channels.)']" faultCode="InvokeFailed" faultDetail="Couldn't establish a connection to 'helloService'"]
      at mx.rpc::AbstractInvoker/ http://www.adobe.com/2006/flex/mx/internal::invoke()[E:\dev\3.0.x\frameworks\projects\rpc\ src\mx\rpc\AbstractInvoker.as:257
      at mx.rpc.remoting.mxml::Operation/ http://www.adobe.com/2006/flex/mx/internal::invoke()[E:\dev\3.0.x\frameworks\projects\rpc\ src\mx\rpc\remoting\mxml\Operation.as:197
      at mx.rpc.remoting::Operation/send()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\remotin g\Operation.as:113]
      at Function/ http://adobe.com/AS3/2006/builtin::apply()
      at mx.rpc.remoting.mxml::Operation/send()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\re moting\mxml\Operation.as:170]
      at Function/ http://adobe.com/AS3/2006/builtin::apply()
      at mx.rpc::AbstractService/ http://www.adobe.com/2006/actionscript/flash/proxy::callProperty()[E:\dev\3.0.x\frameworks \projects\rpc\src\mx\rpc\AbstractService.as:285
      at ReportViewer/___ReportViewer_Button1_click()[/Users/PeterAndrus/Documents/Flex Builder 3/ReportViewer/src/ReportViewer.mxml:4]

      anyone know what i might be doing wrong? i am new to this whole paradigm, but i thought i understood enough to get this done, but i'm feeling pretty helpless! =) any aid offered is appreciated. thanks!

      ps-i have successfully run other grails services ( i ran one where i printed to the STDOUT. The result printed to the terminal window where i'm running grails from.)
        • 1. easy example not so easy!
          peteandrus Level 1
          one thing i forgot to mention is that i did run the 'grails install-plugin flex' in my 'hello' project. can anyone help? thanks!
          • 2. Re: easy example not so easy!
            I am new to this but I ran into a very similar problem (probably same), and saw on another posting that you need to specify the following as compiler options (I did it in Eclipse for Properties>>Flex Compiler>>Additional Compiler Arguments, and added the following structure:

            -services "C:\...\services-config.xml" -context-root "C:\...\myapprootdir"

            So, fill in your path to services-config.xml and also to your app root dir. I'm still attempting to see the remote data in my flex app, but this configuration seemed to remove the destination issue.