Hi
I just tried GWT and played around with the KitchenSink.
I started the GWT shell with the script. Loaded the app. Made
modifications to the source code (java files) and when clicked reload
I saw the changes instantly. So I guess behind the scenes GWT Shell
pickups the modifications and compiles the bytecode to javascript and
resends to the browser.
JavaRebel comes in handy when one needs to restart a container
(Weblogic,Tomcat, Eclipse ...) or reload an app to a container to see
new results, javarebel reloads the changed class files and the new
code is executed.
Have I misunderstood anything? Are there actually Java classes that
need to be reloaded at one point?
Toomas
ZeroTurnaround.com
> I don't fully understand how the gw shell works behind the scenes. I know
> for sure that gwt compiler is based on source code, not bytecode. I'm also
My bad.
> nature of optimizations (src is analyzed as a monolithic app). Maybe some
> gwt team member can explain how the src is linked to the hosted browser
> (like does it involve compiling all the way to js? )?
This would be great. I'll see what I can read out of the source during
the next days.
> the code). I can already change some method body while debugging in eclipse,
> but some modifications are not possible with jvm hotswapping.
In the shell script there was no reference to running apps in debug
mode but my changes (added a new class and a method and a methodcall)
worked after hitting refresh in the browser so I don't know at the
moment how and when hotswap kicked in (if thats to blame to
propagating my changes).
Toomas
I started the GWT shell with the script. Loaded the app. Made
modifications to the source code (java files) and when clicked reload
I saw the changes instantly. So I guess behind the scenes GWT Shell
pickups the modifications and compiles the bytecode to javascript and
resends to the browser.
JavaRebel comes in handy when one needs to restart a container
(Weblogic,Tomcat, Eclipse ...) or reload an app to a container to see
new results, javarebel reloads the changed class files and the new
code is executed.
I don't fully understand how the gw shell works behind the scenes. I know for sure that gwt compiler is based on source code, not bytecode. I'm also guessing that gwt compiler does not do incremental builds, because of the nature of optimizations (src is analyzed as a monolithic app). Maybe some gwt team member can explain how the src is linked to the hosted browser (like does it involve compiling all the way to js? )?
On Jan 9, 2008 3:44 AM, Toomas Römer <too...@gmail.com> wrote:I started the GWT shell with the script. Loaded the app. Made
modifications to the source code (java files) and when clicked reload
I saw the changes instantly. So I guess behind the scenes GWT Shell
pickups the modifications and compiles the bytecode to javascript and
resends to the browser.
The actual Java code is just running in your regular VM, so it requires your IDE to be able to swap out the classes with the new versions. Eclipse can do this, but sometimes fails depending on the nature of the changes.
On top of that, classes with JSNI get re-written by the CompilingClassLoader to change the native methods into Java code that makes the calls into the JSVM.JavaRebel comes in handy when one needs to restart a container
(Weblogic,Tomcat, Eclipse ...) or reload an app to a container to see
new results, javarebel reloads the changed class files and the new
code is executed.
In my home app, I run an embedded jetty for my server (using -noserver for hosted mode debugging), and Eclipse automatically hot-swaps the modified classes (which fails if you make major changes)
, so I don't have to reload the server there. The only problem I have run into is if I change the initialization code it doesn't get rerun, so I have to manually restart my server anyway.
--However, it takes less than a second (and doesn't impact the GWT hosted mode shell) so I don't really see much point. I think after 1.5 we do need to look at ways to make the embedded server work this way, and some of the changes from Out-of-Process hosted mode will force rethinking the way that works anyway.
John A. Tamplin
Software Engineer, Google
I still don't understand one thing: when you use the -noserver option you run the services from an outer servlet container/app server/etc. But in the gwt docs, It says you still have to copy the <module>.gwt.js and other .js files into the server's app dir. Are these .js files necessary only to let defer the resource serving to the servlet container ?
Can you explain what happens step-by-step? Like in this use case:
- user clicks on a button on a gwt module running within hosted mode
(... what happes here? is there NO javascript involved (with the exception of JSNI) in these steps?)
- breakpoint in eclipse is activated
On Jan 9, 2008 12:08 PM, Miguel Ping <migue...@gmail.com> wrote:I still don't understand one thing: when you use the -noserver option you run the services from an outer servlet container/app server/etc. But in the gwt docs, It says you still have to copy the <module>.gwt.js and other .js files into the server's app dir. Are these .js files necessary only to let defer the resource serving to the servlet container ?
When you click Compile/Browse, the executed browser will fetch the same URL the hosted shell is pointed to. So, you have to arrange that the JS files get served by your external server, as well as the host html page and any other resources. In my case, I simply point my jetty instance to <src path>/www/<module name> so it is serving the same content that the tomcat instance would be using.
BTW, it sounds like the documentation is a bit out of date -- what is the URL of the page you are referring to?
Thanks for the explanations. Sounds like I need to setup the noserver
option for myself as I am restarting hosted mode quite a bit and its
fairly slow on my box. Would you mind posting the ant file you use to
build with (when deploying to jetty)?
I played around with GWT and JavaRebel today and got them working
together. I had to modify the classloading of GWT a bit.
As I have no experience with GWT I don't know exactly the bottlenecks
in the development cycle. Could you give the integration a quick spin
and see if it does help anything? My little snippets we're speedy
enough without javarebel except for I had to click the reload in the
GWT browser wrapper :).
I've compiled the GWT trunk with some modified code and uploaded the
build results to http://www.zeroturnaround.com/downloads/gwtTrunkBuild.tar
It has the necessary gwt-dev-platform.jars and gwt-user.jar . I just
backupped the 1.4 jar's and overwrote the gwt-dev-linux.jar and gwt-
user.jar to get my examples to run with trunk. Probably the same works
for you too.
I've updated the development snapshot of javarebel and it is available
from http://www.zeroturnaround.com/download/
To enable JavaRebel you have to add "-noverify -javaagent:/path/to/
javarebel.jar" to VM arguments. In eclipse run page it is the second
tab named "Arguments" and second textarea from the top.
As I had to change the GWT classloader to an URLClassloader just make
sure that the yourGWTProject/bin is used for the classfiles in
Eclipse. Don't forget to set Eclipse to build files automatically.
> OK thanks, I'll give it a try.
Any luck?
Toomas
John, would you mind commenting on whether or not the approach taken
for the patch is viable?
John, would you mind commenting on whether or not the approach taken
for the patch is viable?
It was not meant as a proposed patch but as a test if one does get a
shorter turnaround when using JavaRebel with GWT. The integration can
be done in different ways but it is up to users' interest in it. From
the emails I see that the issue is not that important at this moment.
We are launching http://code.google.com/p/zt-oss/ this week which
includes a JavaRebel SDK that is meant for providing a simpler of way
of integrating rebel with different frameworks.
We will keep an eye on
http://code.google.com/p/google-web-toolkit-incubator/issues/detail?id=44
(or if it gets refiled under the main GWT project) and will come back
to it at one point.
Toomas