Debugging in production mode

695 views
Skip to first unread message

Laura Bickle

unread,
Sep 22, 2011, 2:51:10 PM9/22/11
to google-we...@googlegroups.com
My app works in development mode, but does not work in production mode. 

How do I debug in production mode?  I'm using the gwt plugin for eclipse.

I tried googling "debugging in production mode gwt," but I'm still lost.  How do I:
- set the -style compiler attribute in the eclipse plugin?
- create alert messages or read my print statements or something similar?
- verify that I'm not using any of these?  I don't think I am, but I also think my code should work and it doesn't. 
 - http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsCompatibility.html
- Is there a better way to find my problem?

I appreciate your help,
Laura

Isaac Truett

unread,
Sep 22, 2011, 2:55:44 PM9/22/11
to google-we...@googlegroups.com
Laura,

I would recommend gwt-log first and foremost for debugging production code. For setting -style in GPE, see the User's Guide. Also, check your browser's console. There may simply be a JavaScript error or a file that isn't being served properly by your production server.

- Isaac


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Thomas Broyer

unread,
Sep 23, 2011, 3:49:08 AM9/23/11
to google-we...@googlegroups.com


On Thursday, September 22, 2011 8:51:10 PM UTC+2, Laura Bickle wrote:
My app works in development mode, but does not work in production mode. 

How do I debug in production mode?  I'm using the gwt plugin for eclipse.

I tried googling "debugging in production mode gwt," but I'm still lost.  How do I:
- set the -style compiler attribute in the eclipse plugin?

See Isaac's answer, linking to the GPE documentation.
 
- create alert messages or read my print statements or something similar?

java.util.logging, possibly with RemoteLogging. See http://code.google.com/webtoolkit/doc/latest/DevGuideLogging.html
(the implementation is derived from gwt-log, and by the same author, as he's a Developer Advocate for GAE and GWT)

- verify that I'm not using any of these?  I don't think I am, but I also think my code should work and it doesn't. 
 - http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsCompatibility.html

One key difference that's not listed there: do not rely on the exact type of the exceptions being thrown from emulated classes.
GWT privileges speed over "correctness" in cases when such correctness would hamper the application's performance. It's way better to check your arguments before calling a method, than to rely on a specific exception being thrown if/when the arguments are incorrect.
That being said, there are not that many differences in practice, but still.

- Is there a better way to find my problem?

You can use the symbolMaps files (I think you'll have to pass in the -extra argument to the compiler, with a path to a folder where to output the "extra" files) to map from obfuscated JS code to your Java code; and possibly the other way around to set a few breakpoints in the JS code (in Firebug for instance, or any other browser developer tool).
When you setup java.util.logging or gwt-log with remote logging, they can use those symbolMaps files to log deobfuscated stack traces. I think you have to enable emulated stack traces in your GWT app for this to work:
  <set-property name="compiler.emulatedStack" value="true"/>
  <set-configuration-property name="compiler.emulatedStack.recordFileNames" value="true" />
  <set-configuration-property name="compiler.emulatedStack.recordLineNumbers" value="true" />

You'd better make a distinct gwt.xml file to set those properties (along with the log level), so they don't impact your production app (use the same rename-to as your "production" gwt.xml, so you don't have to change your HTML host page).

Thomas Broyer

unread,
Sep 23, 2011, 4:03:11 AM9/23/11
to google-we...@googlegroups.com
Hey, looks like they're adding the perfect tool for this kind of use cases: http://code.google.com/p/google-web-toolkit/wiki/SourceMaps (code is in review at: http://gwt-code-reviews.appspot.com/1558803/ )

Laura Bickle

unread,
Sep 29, 2011, 1:06:41 AM9/29/11
to google-we...@googlegroups.com
gwt-log helped me find my errors.  (Thanks Isaac)  I had a bunch of NullPointerExceptions that weren't getting caught.  (Thanks Thomas)  When I changed my code to check first instead of catching an exception, it worked!

On Fri, Sep 23, 2011 at 1:03 AM, Thomas Broyer <t.br...@gmail.com> wrote:
Hey, looks like they're adding the perfect tool for this kind of use cases: http://code.google.com/p/google-web-toolkit/wiki/SourceMaps (code is in review at: http://gwt-code-reviews.appspot.com/1558803/ )

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.

Grace Yeung

unread,
Jun 3, 2014, 4:20:46 PM6/3/14
to google-we...@googlegroups.com
I am working on the same issue. Things work in development mode, but not production mode. (And this is only for one module, I have another module working fine on both modes.)
I want to try gwt-log too, but I can get it working. Any more documentation about using gwt-log?
 
Thanks,
Grace
To unsubscribe from this group, send email to google-web-toolkit+unsub...@googlegroups.com.

Thomas Broyer

unread,
Jun 4, 2014, 5:52:20 AM6/4/14
to google-we...@googlegroups.com


On Tuesday, June 3, 2014 10:20:46 PM UTC+2, Grace Yeung wrote:
I am working on the same issue. Things work in development mode, but not production mode. (And this is only for one module, I have another module working fine on both modes.)

Have you tried super-dev-mode? If it works in superdevmode but fails in prod mode, then that would most likely mean there's a bug in the GWT compiler's optimizations.

Grace Yeung

unread,
Jun 5, 2014, 4:04:16 PM6/5/14
to google-we...@googlegroups.com
Thanks Thomas. I am trying to use super-dev-mode after reading your post. But so far without success. Do you have a quick way to set up the super-dev-mode?
I am using eclipse and gwt 2.6.0. Any help is appreciated.

Grace

Vassilis Virvilis

unread,
Jun 5, 2014, 6:47:43 PM6/5/14
to google-we...@googlegroups.com


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.

To post to this group, send email to google-we...@googlegroups.com.



--
Vassilis Virvilis

Grace Yeung

unread,
Jun 6, 2014, 10:47:44 AM6/6/14
to google-we...@googlegroups.com
I tried SuperDevMode and I can access URL: http://localhost:9876/
 
But I am geting this:
Can't find any GWT Modules on this page.
 
I already updated my .gwt.xml
with the following

<add-linker name="xsiframe" />

<set-configuration-property name="devModeRedirectEnabled" value="true"/>

<!-- enable source maps -->

<set-property name="compiler.useSourceMaps" value="true" />

and recompiled my application. Any idea? Thanks.
Grace

On Thursday, June 5, 2014 6:47:43 PM UTC-4, Vassilis Virvilis wrote:
On Thu, Jun 5, 2014 at 11:04 PM, Grace Yeung <gracey...@gmail.com> wrote:
Thanks Thomas. I am trying to use super-dev-mode after reading your post. But so far without success. Do you have a quick way to set up the super-dev-mode?
I am using eclipse and gwt 2.6.0. Any help is appreciated.

Grace

On Wednesday, June 4, 2014 5:52:20 AM UTC-4, Thomas Broyer wrote:


On Tuesday, June 3, 2014 10:20:46 PM UTC+2, Grace Yeung wrote:
I am working on the same issue. Things work in development mode, but not production mode. (And this is only for one module, I have another module working fine on both modes.)

Have you tried super-dev-mode? If it works in superdevmode but fails in prod mode, then that would most likely mean there's a bug in the GWT compiler's optimizations.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsub...@googlegroups.com.

To post to this group, send email to google-we...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.



--
Vassilis Virvilis

Thomas Broyer

unread,
Jun 6, 2014, 12:05:45 PM6/6/14
to google-we...@googlegroups.com


On Friday, June 6, 2014 4:47:44 PM UTC+2, Grace Yeung wrote:
I tried SuperDevMode and I can access URL: http://localhost:9876/
 
But I am geting this:
Can't find any GWT Modules on this page.

Are you clicking the "Dev Mode On" button on that page?

Carefully read what's written: put those links in your bookmarks, and click them when you're on your application in prod mode.
You actually almost never need to open localhost:9876 (there are build logs there too though, easier to read/search than in your console)
 
 
I already updated my .gwt.xml
with the following

<add-linker name="xsiframe" />

<set-configuration-property name="devModeRedirectEnabled" value="true"/>

This is no longer needed starting with GWT 2.6.0.
 

<!-- enable source maps -->

<set-property name="compiler.useSourceMaps" value="true" />


This is not strictly needed either. SuperDevMode will set it; so only set it to true if you intend to those source maps (e.g. deploy them with your app in production, like we did on http://www.gwtproject.org for instance)
 

and recompiled my application.

And deployed that version of the application in a web server and opened in in your browser? That's where you click the "Dev Mode On" bookmark.
You only need to do it once to get the devmode "hook" into the .nocache.js. 

Grace Yeung

unread,
Jun 6, 2014, 1:29:45 PM6/6/14
to google-we...@googlegroups.com
I did put those links in my bookmarks (called favorites in IE), and click them when you're on your application in prod mode. The main reason why I am trying to use Super Dev Mode is for debugging my code. I have two modules: one is working fine with both dev and production mode.
 
I want to debug the one that is not working in production mode, but working fine in dev mode. So my prod mode is actually not working, it returns a blank page. When I click the links when I am on my application in prod mode. It is still the same. :(
 
Grace

Grace Yeung

unread,
Jun 6, 2014, 4:04:34 PM6/6/14
to google-we...@googlegroups.com
I read what's written again. Do I actually need to have "bookmarklets" for my browser? In fact, I think the browser (IE) I am using at work doesn't support it. For security reason, we are not even able to download sofftware at work, including GWT...
 
Anyway, can I still use super dev mode if I am not able to click and drag the bookmakrlets to my bookmarks or favorites?
 
Thanks,
Grace
 
On Friday, June 6, 2014 12:05:45 PM UTC-4, Thomas Broyer wrote:

Grace Yeung

unread,
Jun 6, 2014, 4:20:14 PM6/6/14
to google-we...@googlegroups.com
 

I actually put those links in my bookmarks already ...
 
On Friday, June 6, 2014 12:05:45 PM UTC-4, Thomas Broyer wrote:

Grace Yeung

unread,
Jun 12, 2014, 10:49:41 AM6/12/14
to google-we...@googlegroups.com
I am still geting this:
Can't find any GWT Modules on this page.
 
I am trying the latest version 2.6.1, but I still have to do the following setting:

<add-linker name="xsiframe" />

<set-configuration-property name="devModeRedirectEnabled" value="true"/>

Please give me some ideas. Thanks.
On Friday, June 6, 2014 12:05:45 PM UTC-4, Thomas Broyer wrote:
Reply all
Reply to author
Forward
0 new messages