GWT Super Dev does not work in IE 11 - gwt

After compiler my application in GWT Super Dev Mode,
Run: "http://localhost:9876/" in IE 11,
see the followings,
GWT Code Server
1.Drag these two bookmarklets to your browser's bookmark bar:
Dev Mode On Dev Mode Off
................
3.Click "Dev Mode On" to start development mode.
when click "Dev Mode On", is shows "Can't find any GWT Modules on this page."
Anyone knows how to debug GWT in IE 11?
Thanks!

Phase 1
Compile your project
Host it in some webserver
Test it by surfing to this URL
Now phase 2
Run as superdevmode
The SuperDevMode page opens
Surf to the website you created in phase 1
Click the DevMode on bookmarklet you placed in your bookmarks bar
The app should compile

You are missing point 2 (which you left out here):
Visit a web page that uses one of these modules: [your_module_name]
So probably you didn't define a startup url for your run configuration (which IDE are you using?). You can do this with the argument -startupUrl index.html. The index.html should be placed in your output war directory.
Depeding on the port you configured (default 8888) you have to visit this html-page (with the module.js injected of course) to start the compilation. An example url would be:
127.0.0.1:8888/index.html
To debug your application in IE 11 you have to set breakpoints with GWT.debugger() for the client code. For the server code you can use the breakpoints of your IDE. To use the clientside-breakpoints you have to open the Developer Tools of your browser (F12 in case of IE11). There go to debugger/sources or however the tab is called in the case of your browser and debug your application client code directly in the browser. Keep in mind to use source maps to map your Java source code to the generated JS file.

Related

Breakpoint Is Not Getting Hooked in Eclipse with GWT Application

I am trying to debug a very simple HTML GWT module in Eclipse, but the breakpoint in my EntryPoint class does not get hit! I have the following setup:
GWT version: 2.7
Eclipse version: Mars 4.5.2
Chrome version: 53
Running mode: Super Dev Mode (debug)
My module contains a simple HTML file with one EntryPoint (It's a proverbial HelloWorld). The application starts normally when I do Run As Super Dev Mode or Debug As Super Dev Mode, and I see server's and client's URL's and ports with no errors. I can navigate to the application's HTML URL to see the simple Label, and even recompile and see the changes if I modify the EntryPoint class which contains the Label.
I have set my argument's log level to DEBUG (see tons of loading various modules) and even check marked Debug As Configuration to stop at the main method. The thing is, when I run the application in Debug Super Dev Mode for the first time to start the core server, I can see the breakpoint stopping in DevMode class' main() method (not afterward though when I make changes to the EntryPoint and recompile by refreshing the browser). But when I set a breakpoint in my EntryPoint's onModuleLoad(), it gets ignored!
How can I get the server to put a hook on my EntryPoint?
In some cases there is no code available for a JavaScript statement.
Try to use:
GWT.debugger();
which will always stops if you are using a debugger.

how to setup a debugger for AEM or CQ?

how to setup a debugger for AEM or CQ? I'm using Eclipse IDE and Maven 3.2.5 for build and AEM version 6.0. I'm new to AEM and Java.
This Adobe article walks you through it: https://helpx.adobe.com/experience-manager/kb/CQ5HowToSetupRemoteDebuggingWithEclipse.html
Step 1: Add the Remote Debugging JVM Parameter
To use remote debugging, you must start CQ5 with this JVM parameter:
-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n
You can add the parameter by doing the following;
Start your server like this: crx-quickstart/bin/start -d --debug-port 8000. The -d parameter adds the jvm parameter to the CQ5 java process.
Add it to your crx-quickstart/bin/start script CQ_JVM_OPTS environment variable (so your server always starts in debug mode).
Include it as a parameter when starting CQ5 with java -jar directly. For example, java -Xmx512m
-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n -jar cq-author-4502.jar
Notes
If necessary, you can change the port defined under "...,address=8000,..." from 8000 to something that works better in
your environment.
Starting CQ 5.5, using the last solution, when Quickstart forks a new process it does not start the JVM with the debug options. You can
prevent forking by specifying the -nofork command line option.
Te start script is located under crx-quickstart/server for CQ versions < 5.5
Step 2: Start a remote debugging session
To start a remote debugging session from Eclipse, do the following:
Open Eclipse.
Choose Run > Debug Configurations.
Right-click Remote Java Applications and select New.
Select your CQ5 project under Project.
Type in the port from the "address" configuration of the jvm parameter defined above. In the example, it is port 8000 (and the host
name of the machine you are connecting to, most likely localhost)
To start a debugging session, double-click your new configuration in the Debug Configurations screen after saving it.
Applies to: CQ 5.x and Adobe Experience Manager 6.x
If you're on windows follow these steps.
Open AEM crx-quickstart, move onto bin, open start.bat(Right click and edit), find default JVM options, add the line
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=3000 next to headless=true in the start.bat file, save it. Open cmd in the bin folder. Type start.bat and hit enter which will open the instance with debugging port 3000.
Open Eclipse. Add breakpoints to the java file. Run > Debug Configurations > Remote Java Application, right click and select New Configuration, provide a name, select project(the one with .core), change port to 3000, apply and debug. Change the perspective to Debug, Window > Perspective > Open Perspective > Other > Debug.
Open AEM Page containing the component which uses the java class for which the breakpoints have added. If you’ve added breakpoints for the HelloWorldModel.java, open the page with helloworld component or refresh if already opened. And that’s it, eclipse will notify and the program will be paused at the breakpoint.
Possible Errors you might encounter with:
Failed to connect to remote VM. Connection refused. Connection
refused: connect
The debugger has already started when you hit apply and debug and trying to run the debugger again will get you this error.
Debugger not pausing at breakpoints and no notification in eclipse.
If the instance was already running and you hit start.bat in cmd, you’ll find this unusuality. Close the instance, and enter start.bat(in the bin folder). You’ll find the message below when the instance is ready. It might or might won’t open the browser by its own. So just open the browser and enter http://localhost:[portnumber]/.
SUCCESSFULLY LOADED validation.properties via the CLASSPATH from ‘/ (root)’ using class loader for DefaultSecurityConfiguration class!
RAWProcessor succesfully installed
17.10.2019 12:59:41.437 *INFO * [main] Startup completed
Step1: Start AEM service in debug mode with -debug parameter and a port number.
Step2: Setup debug configuration in IDE with the above port.
References:
How to start AEM in debug mode?
CQ5How To Setup Remote Debugging With Eclipse

Eclipse (Keplar) and Tomcat

I have an Eclipse workspace with a Web App (lets call it MyApp), and Tomcat server. When I run MyApp, Tomcat finds default.jsp and the opening page displays
http://localhost:8080/MyApp/Default.jsp?ActionPage=dashboard
- all fine and dandy.
This web page shows a menu. I choose a menu option from this page which should render
http://localhost:8080/MyApp/config.jsp,
and I get a HTTP Status 404 - /config.jsp ... ie it is looking for the page at
http://localhost:8080/config.jsp
and can't find it. Why is it looking there? It seems to have lost its context.
Netbeans doesn't exhibit this behaviour - it works fine. I just don't know where to look for a solution. Is it the Tomcat configuration or the Web App configuration?
All suggestions welcome!
When you choose your menu option, how is the URL called : simple form submit, ajax request?
In any case, you should have a URL looking like /MyApp/... in your code.
You can also check which URLs are effectively called by using a debug tool in your browser (ie Firebug for Firefox)
Another test to do if you use a Tomcat embedded in Eclipse is to start your Tomcat outside from your IDE, just to check the potential behaviour differences.

GWT app does not work properly when deployed to Tomcat server

I have a litte web app which works properly when deployed to the App Engine in Eclipse.
However, I get an error when I want to deploy my app to my Tomcat server.
I copied the content of my war folder directly to the default ROOT folder of Tomcat.
Then I run my app on an external server inside Eclipse.
Everything works fine to that point - the app is loaded straight from the browser's cache.
Here comes the problem:
The google chrome development console says "Uncaught ReferenceError: function is not defined" when I click on some features of my app that are realized through JSNI on GWT side.
I understand that the error comes from a JS caller inside external JS code. The caller invokes a GWT client-side method/function (that's why it is not defined in the ext. JS code).
Any suggestions on how to solve this problem?
Do you have any extra modules that require external js files? Some modules require the js files to be included in the war and included in your root .html file. It could be the case that you are using a library that doesn't have the base js functions.
You can add this to your .gwt.xml file to turn on the stack trace.
<set-property name="compiler.stackMode" value="emulated"/>
<set-configuration-property name="compiler.emulatedStack.recordLineNumbers" value="true"/>
<set-configuration-property name="compiler.emulatedStack.recordFileNames" value="true"/>
You could also try the setUncaughtException handler to see exceptions that are being thrown in production mode. With the emulated stack trace turned on you should be able to get a backtrace that has line numbers for your code. It is not as good as development mode but very useful for debugging.
GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler()) {
#Override
public void onUncaughtException(Throwable cause) {
logger.log(Level.SEVERE, "OOPS", cause);
}
}
Note Make sure your logger is configured to use something you can access. Like firebug or remote logging servlet.
I currently use tomcat 7 in production and development mode using eclipse. You can configure a tomcat instance of the server in eclipse and use the "Run as WebApplication on External Server". This will allow you to see the exception in development mode.
Also make sure you don't have the ?gwt.codesvr=127.0.0.1:9997 if you are in production mode. This will cause problems too unless you have the development code server running.

Vaadin - GWT error "module xxx may need to be recompiled

I'm ramping up on Vaadin and I'm getting this javascript alert whenever I try and run the demo apps.
GWT module 'com.vaadin.terminal.gwt.DefaultWidgetSet' may need to be recompiled
I've tried cleaning the project to no avail.
As I said, I'm ramping up so I'm sure there's some simple step I'm missing or a concept I haven't grasped.
I don't know anything about Vaadin, but there's a more general context in which this error occurs:
So long as you're testing in Eclipse, the dynamic coding of your app is still real Java coding being run in a JVM. This coding is made available through debugger that's accessible via a socket. You get a URL that looks like this:
http://127.0.0.1:8888/MyApp.html?gwt.codesvr=127.0.0.1:9997
with this codesvr thing being your eclipse-hosted debugger process for your Java code.
Before your app can run standalone, GWT has to translate your Java code to JavaScript; separate versions of the code are produced for each browser type (Firefox, WebKit, Opera, ...) and language that you want to support. Only once this is done can you access your app the usual way via
http://127.0.0.1:8888/MyApp.html
After weeks of running my app only in Eclipse, I'd managed to forget about the compiling-for-browsers step and wondered about the message. The way to fire up the compiler, if you're not using the Ant task, is to hit Google|GWT Compile in the project's context menu. That done, the JS in your app gets fleshed out and your app can run without Java on the client side.
And of course the message goes away.
It is a warning not an error. Does the app work? Otherwise you have to recompile the Vaadin widgetset. These might help too: http://vaadin.com/directory/help/using-vaadin-add-ons
Often this message meens:
you're missing the ?gwt.codesvr=127.0.0.1:9997 parameter in the URL (or have misspelled it).
your module uses the xs linker <add-linker name="xs" />. This is a known limitation and will be fixed in the future: Issue 4232: Allow Development Mode to work with XS Linker
You may need to clear the browser cache. It is possible that the compiled js that the browser is using is not the js that has most recently been compiled.
In Chrome you can see if the cached js is being used in the developer tools windows (ctrl + shift + i). In the size column it will say (from cache) instead of the actual size. You can then right click and clear the browser cache. ctrl + r to reload and the error should be gone.
Carl Smotricz is absolutely right.
Just Cleaning and Build Project on the topmost menu doesn't work.
You must use "Google | GWT Compile" on the context menu generated when right-clicking on your GWT project, prior to deployment.
The error may not be about not-adding "?gwt.codesvr=127.0.0.1:9997" at the end of host web page if he or she tried to deploy the GWT-based webapp on WAS external to Eclipse.
Server restart did the job for me.
I had tried clearing cache, clean and rebuild .. but i was still getting the same warning message.
Server restart made it reload all the stull from the latest compiled war.
It was a hit and trial and i am glad it worked :) :)