Quantcast

Grails and GWT Plugin (resource not available error)

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Grails and GWT Plugin (resource not available error)

Brian Kotek
Hi folks, first time poster and complete Grails noob here. I've been doing Java and Flex work for years but with Adobe's decision to sideline it I'm trying to investigate other options for creating RIAs. Since I've used (and loved) Groovy in the past I thought I would try Grails with the GWT plugin, but I'm having trouble.

I've answer a lot of technical questions on other mailing lists so I know it's imposing on your time. I'll try to be as descriptive as I can. 

So far I have:
  • Downloaded the latest Grails (2.01) and GWT (2.4) libraries. GWT_HOME has been set.
  • In Intellij IDEA 11, I first created a test GWT-only project using the IDEA defaults. This ran without issue (it's a page with simple button that makes a server request and shows some result text). I did this just to make sure my GWT setup was working. 
  • I then set up a Grails project set up in Intellij IDEA 11, and this ran without any problems (got Grails default app home page).  
  • Next, I installed the Grails GWT plugin, ran create-gwt-module, then create-gwt-page (and had it set up a controller as well). 
  • I then added a simple Button to the RootPanel in the onModuleLoad method in the Java class it created for the GWT module. 
  • If I run the app now, the home screen shows two controllers: the MainController I set up, and the GwtController that is part of the GWT plugin.
  • If I click on the GwtController, I get an error in the console saying "Content-Type was '(null)'. Expected 'text/x-gwt-rpc'". I assume that's expected since the request wasn't an RPC call, but I think it shows that the the plugin is working.
  • However, if I click on the MainController, I don't see the button I added on that page, and looking at the JavaScript console I have the error:  The requested resource (/grailstest3/gwt/org.example.MyApp/org.example.MyApp.nocache.js) is not available.
  • Last, if I run the Grails command "compile-gwt-modules" and run the app, the error is slightly different: when requesting /grailstest3/static/gwt/org.example.MyApp/F9F2456FACABA10057328763999B2F31.cache.html it shows "The requested resource () is not available.".

I feel like I'm really close and just missing some configuration item but for the life of me I can't figure out what it might be. If anyone has any ideas please offer them. If I can get this working I'm going to do a screen recording with Camtasia that explains how to set it all up since I think this would be of great interest to a lot of the Flex developers who are looking for other RIA options.

Thanks for your time,

Brian


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Grails and GWT Plugin (resource not available error)

Brian Kotek
On a related note, if anyone happens to have (or know where I could download) an existing IDEA project using Grails and the GWT plugin, that might help. Even if it is very simple, it could be useful just to see the configuration and compare it to mine. Thanks.

On Thu, Feb 23, 2012 at 11:21 AM, Brian Kotek <[hidden email]> wrote:
Hi folks, first time poster and complete Grails noob here. I've been doing Java and Flex work for years but with Adobe's decision to sideline it I'm trying to investigate other options for creating RIAs. Since I've used (and loved) Groovy in the past I thought I would try Grails with the GWT plugin, but I'm having trouble.

I've answer a lot of technical questions on other mailing lists so I know it's imposing on your time. I'll try to be as descriptive as I can. 

So far I have:
  • Downloaded the latest Grails (2.01) and GWT (2.4) libraries. GWT_HOME has been set.
  • In Intellij IDEA 11, I first created a test GWT-only project using the IDEA defaults. This ran without issue (it's a page with simple button that makes a server request and shows some result text). I did this just to make sure my GWT setup was working. 
  • I then set up a Grails project set up in Intellij IDEA 11, and this ran without any problems (got Grails default app home page).  
  • Next, I installed the Grails GWT plugin, ran create-gwt-module, then create-gwt-page (and had it set up a controller as well). 
  • I then added a simple Button to the RootPanel in the onModuleLoad method in the Java class it created for the GWT module. 
  • If I run the app now, the home screen shows two controllers: the MainController I set up, and the GwtController that is part of the GWT plugin.
  • If I click on the GwtController, I get an error in the console saying "Content-Type was '(null)'. Expected 'text/x-gwt-rpc'". I assume that's expected since the request wasn't an RPC call, but I think it shows that the the plugin is working.
  • However, if I click on the MainController, I don't see the button I added on that page, and looking at the JavaScript console I have the error:  The requested resource (/grailstest3/gwt/org.example.MyApp/org.example.MyApp.nocache.js) is not available.
  • Last, if I run the Grails command "compile-gwt-modules" and run the app, the error is slightly different: when requesting /grailstest3/static/gwt/org.example.MyApp/F9F2456FACABA10057328763999B2F31.cache.html it shows "The requested resource () is not available.".

I feel like I'm really close and just missing some configuration item but for the life of me I can't figure out what it might be. If anyone has any ideas please offer them. If I can get this working I'm going to do a screen recording with Camtasia that explains how to set it all up since I think this would be of great interest to a lot of the Flex developers who are looking for other RIA options.

Thanks for your time,

Brian



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Grails and GWT Plugin (resource not available error)

Ian Roberts
In reply to this post by Brian Kotek
On 23/02/2012 16:21, Brian Kotek wrote:
> I feel like I'm really close and just missing some configuration item
> but for the life of me I can't figure out what it might be. If anyone
> has any ideas please offer them. If I can get this working I'm going to
> do a screen recording with Camtasia that explains how to set it all up
> since I think this would be of great interest to a lot of the Flex
> developers who are looking for other RIA options.

I've never been able to get the GWT plugin to play nicely with the
resources plugin in Grails 2.  Removing the dependency on the resources
plugin from your BuildConfig should make it work, but if anyone has had
success in making the GWT and resources plugins work together I'd be
interested to hear it.

Ian

--
Ian Roberts               | Department of Computer Science
[hidden email]  | University of Sheffield, UK

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Grails and GWT Plugin (resource not available error)

Brian Kotek
It works! Thanks, Ian. Now I don't feel that bad, since there's no way in hell I would have ever figured that out myself.

I'm wondering if it is butting heads with GWT since I believe GWT does its own optimization on the resources it uses.

BTW, is there any "danger" with commenting out the resources plugin like this? Is it purely a nice extra for Grails, or is some crucial functionality lost? 

Brian

On Thu, Feb 23, 2012 at 11:34 AM, Ian Roberts <[hidden email]> wrote:
On 23/02/2012 16:21, Brian Kotek wrote:
> I feel like I'm really close and just missing some configuration item
> but for the life of me I can't figure out what it might be. If anyone
> has any ideas please offer them. If I can get this working I'm going to
> do a screen recording with Camtasia that explains how to set it all up
> since I think this would be of great interest to a lot of the Flex
> developers who are looking for other RIA options.

I've never been able to get the GWT plugin to play nicely with the
resources plugin in Grails 2.  Removing the dependency on the resources
plugin from your BuildConfig should make it work, but if anyone has had
success in making the GWT and resources plugins work together I'd be
interested to hear it.

Ian

--
Ian Roberts               | Department of Computer Science
[hidden email]  | University of Sheffield, UK

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Grails and GWT Plugin (resource not available error)

Ian Roberts
On 23/02/2012 16:49, Brian Kotek wrote:
> It works! Thanks, Ian. Now I don't feel that bad, since there's no way
> in hell I would have ever figured that out myself.
>
> I'm wondering if it is butting heads with GWT since I believe GWT does
> its own optimization on the resources it uses.
>
> BTW, is there any "danger" with commenting out the resources plugin like
> this? Is it purely a nice extra for Grails, or is some crucial
> functionality lost?

AFAIK it's not crucial to anything in the Grails core but there may be
some other plugins that depend on it, you'll have to see.  There may be
some way to configure the resources plugin to completely ignore
GWT-generated javascripts but I haven't had the impetus to work it out
for myself as the apps I have all operate fine without the resources plugin.

Ian

--
Ian Roberts               | Department of Computer Science
[hidden email]  | University of Sheffield, UK

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Grails and GWT Plugin (resource not available error)

Brian Kotek
Thanks. While I've got you here, can I ask two other quick questions? 

First, is there any trick to debugging / setting breakpoints in the GWT Java classes? For example, I've put a breakpoint in the onModuleLoad() method of my test MyApp.java class, but running the Grails app in debug configuration never seems to hit this breakpoint.

And second, it seems that every time I change the GWT module Java class, I have to manually run the GWT plugin's compile-gwt-modules in order for the changes to get picked up. Is that normal?

Regards,

Brian



On Thu, Feb 23, 2012 at 12:07 PM, Ian Roberts <[hidden email]> wrote:
On 23/02/2012 16:49, Brian Kotek wrote:
> It works! Thanks, Ian. Now I don't feel that bad, since there's no way
> in hell I would have ever figured that out myself.
>
> I'm wondering if it is butting heads with GWT since I believe GWT does
> its own optimization on the resources it uses.
>
> BTW, is there any "danger" with commenting out the resources plugin like
> this? Is it purely a nice extra for Grails, or is some crucial
> functionality lost?

AFAIK it's not crucial to anything in the Grails core but there may be
some other plugins that depend on it, you'll have to see.  There may be
some way to configure the resources plugin to completely ignore
GWT-generated javascripts but I haven't had the impetus to work it out
for myself as the apps I have all operate fine without the resources plugin.

Ian

--
Ian Roberts               | Department of Computer Science
[hidden email]  | University of Sheffield, UK

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Grails and GWT Plugin (resource not available error)

Brian Kotek
NM I think I answered my own questions:

You do have to manually run compile-gwt-modules after you make changes. And I was able to hit the breakpoint by running the Grails app, then creating a separate GWT launch configuration and running that as well. I then hit the breakpoint.

Thanks,

Brian


On Thu, Feb 23, 2012 at 1:52 PM, Brian Kotek <[hidden email]> wrote:
Thanks. While I've got you here, can I ask two other quick questions? 

First, is there any trick to debugging / setting breakpoints in the GWT Java classes? For example, I've put a breakpoint in the onModuleLoad() method of my test MyApp.java class, but running the Grails app in debug configuration never seems to hit this breakpoint.

And second, it seems that every time I change the GWT module Java class, I have to manually run the GWT plugin's compile-gwt-modules in order for the changes to get picked up. Is that normal?

Regards,

Brian



On Thu, Feb 23, 2012 at 12:07 PM, Ian Roberts <[hidden email]> wrote:
On 23/02/2012 16:49, Brian Kotek wrote:
> It works! Thanks, Ian. Now I don't feel that bad, since there's no way
> in hell I would have ever figured that out myself.
>
> I'm wondering if it is butting heads with GWT since I believe GWT does
> its own optimization on the resources it uses.
>
> BTW, is there any "danger" with commenting out the resources plugin like
> this? Is it purely a nice extra for Grails, or is some crucial
> functionality lost?

AFAIK it's not crucial to anything in the Grails core but there may be
some other plugins that depend on it, you'll have to see.  There may be
some way to configure the resources plugin to completely ignore
GWT-generated javascripts but I haven't had the impetus to work it out
for myself as the apps I have all operate fine without the resources plugin.

Ian

--
Ian Roberts               | Department of Computer Science
[hidden email]  | University of Sheffield, UK

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Grails and GWT Plugin (resource not available error)

Ian Roberts
In reply to this post by Brian Kotek
On 23/02/2012 18:52, Brian Kotek wrote:

> Thanks. While I've got you here, can I ask two other quick questions?
>
> First, is there any trick to debugging / setting breakpoints in the GWT
> Java classes? For example, I've put a breakpoint in the onModuleLoad()
> method of my test MyApp.java class, but running the Grails app in debug
> configuration never seems to hit this breakpoint.
>
> And second, it seems that every time I change the GWT module Java class,
> I have to manually run the GWT plugin's compile-gwt-modules in order for
> the changes to get picked up. Is that normal?

It's normal to have to compile-gwt-modules to get a browser that is
working off the compiled JavaScript to see the changes, but if you're
using development mode (with the browser plugin) then it should pick up
the changes directly from the .java files with no need to recompile.

Ian

--
Ian Roberts               | Department of Computer Science
[hidden email]  | University of Sheffield, UK

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Loading...