how to debug gwt app server side code? - gwt

i have a maven gwt application with maven-jetty plugin, i tried to to debug the code with 'mvn jetty:run-war' and 'mvn gwt:debug', it start the application in gwt dev mode so i can debug the client side code but not the server side, how can i debug both the client side and server side code? i tried 'mvnDebug jetty:run-exploded', it said:
Preparing to Execute Maven in Debug Mode
Listening for transport dt_socket at address: 8000
then i brought up a browser point it to localhost:8000, nothing loaded and in the terminal it spitted out the message:
Debugger failed to attach: handshake failed - received >GET / HTTP/1.1< - excepted >JDWP-Handshake<
Debugger failed to attach: handshake failed - received >GET / HTTP/1.1< - excepted >JDWP-Handshake<
Debugger failed to attach: timeout during handshake
i have no clue what it mean? anyone can help me?

Port 8000 in the case you listed is the port that your remote debugger will connect to your remote instance, it is not for you to view the application. The GUI itself is most likely available over 8080 or 8888, but that depends on the config in Jetty or if you're running in Hosted Mode.
You need to connect a remote debugger to Jetty, like Eclipse or NetBeans whatever your IDE is.
http://docs.codehaus.org/display/JETTY/Debugging+Jetty+with+Eclipse
http://www.vijaykiran.com/2009/05/12/debugging-maven-jetty-web-application-in-netbeans/
Using Hosted Mode might be helpful as well:
http://code.google.com/webtoolkit/doc/1.6/FAQ_DebuggingAndCompiling.html#How_do_I_use_my_own_server_in_hosted_mode_instead_of_GWT's
More Advanced:
http://www.vogella.de/articles/EclipseDebugging/article.html

From your IDE you have to create remote debugging after launching debug from maven. In Eclipse you can do this by going to the Debug Configuration and create new Remote Java Application configuration. Then just refresh the page of your app in browser and start debugging.
If you use some other IDE, you have to find out how to use remote debugging for it by yourself. It is pretty much the same everywhere.

Related

How to prevent HTTP localhost preview problem?

I'm running a static web application in Eclipse + Tomcat and every time I run the application (Eclipse) and launched the project, I always encountered this problem 'Launching HTTP Preview at localhost' has encountered a problem:
I have changed the port number numerous time. I am afraid that this action might harm the server itself. Can anyone tell me what's going on and how do I prevent this from keep happening?
It looks like 8080 port is already being used by some other process/application
You can change the port using below steps (In Eclipse)
In Servers Tab, Double click the Tomcat server to open the
overview info
Under Ports section, HTTP/1.1 you can change the port you want and save it
Start the tomcat server, it should work
Thank you

Aws backend code debugging

I deployed my backend code(used framework is drop-wizard) in the form of jar file on AWS(Amazon Web service) server. I want to know is it possible to debug that jar file(jar file deployed on the AWS server) using eclipse on my local pc?? If yes than please display the way of how to do it??
Looking for a good response
Thanks
First, you need to start your application with remote debugging
enabled. With dropwizard, you are typically starting the application
on a server with:
java -jar myapp-0.0.1-SNAPSHOT.jar
Change this to:
java -Xdebug -agentlib:jdwp=transport=dt_socket,address=9999,server=y,suspend=n -jar myapp-0.0.1-SNAPSHOT.jar
This sets up Java to listen for remote debugging sessions on port
9999. Make sure you choose a port that's not blocked by firewalls or
your AWS security configuration.
Next, you have to configure Eclipse to connect to the remote
application for debugging. In Eclipse, right click on the project and
select Debug, Debug Configuration. Create a new configuration of
Remote Java Application. Set the host to your AWS server and the port
to 9999, as above.
Now you should be able to set a breakpoint in your code and start a
debug session on the remote server.

Start Websphere Liberty in Debug mode and connect via Eclipse

I am searching for a way to start the Websphere Liberty profile in debug mode from the command line? I want to be able to start Liberty, so that it is listening for debug connections on a specific port. Then I would like to connect to Liberty from Eclipse, so that I can step through and debug the server code running in Liberty.
I've tried integrating Liberty into Eclipse and using the Eclipse 'Servers' view. This works great and I can start and stop Liberty using debug mode. Unfortunately, this method does not satisfy my use case because the build process uses tools external to Eclipse.
Essentially, I need a way to do this via the command line.
I tried creating a jvm.options file for Liberty and starting it, but I still can't connect to the port I specified. I'm sure I'm doing something wrong, but thus far I haven't figured it out.
This page has some info on jvm.options
The Administering the Liberty profile from the command prompt page describes how to do this:
[bin]$ export WLP_DEBUG_ADDRESS=7778
[bin]$ ./server debug
Listening for transport dt_socket at address: 7778
You can then connect from Eclipse using Remote Debugging.

Remote Tomcat Server Configuration hangs the server startup when parameter suspend=y used

It would be great if someone can help me on this:
I configured a tomcat server for doing remote debugging using eclipse:
I used the gui for tomcat7
If I run tomcat with the command
-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n it works fine but
If I put suspend=y in the above command tomcat sert hangs in starting state and does not stop at all even after 2-3 hours.
When using suspend=y, the JVM remains suspended until a debug client connects.
To connect to the suspended Tomcat instance, you can create a new Eclipse Debug Configuration via Run->Debug Configurations. Then choose Remote Java Application. On the configuration panel, specify the host and port e.g. 8000 to connect. Finally, press Debug. This will attempt to connect to your suspended Tomcat instance. Once, the connection is made you can step through the code. (Of course, you must load that code into the Eclipse workspace)

Debug Struts Action Classes

My application runs on a remote server.
I use tomcat to deploy the web based part of my application.
The flow is Action classes calls the remote classes using RMI.
I am using Eclipse and When I browse a page, am able to debug the remote java classess, But I need to debug Action classes also as it also contains more logic.
How will I do it, Please help, Thanks in advance.
Regards,
Sridevi
Either launch Tomcat in debug mode from Eclipse, or launch tomcat with remote debug options, and attach a remote debug session from Eclipse to this tomcat server (in a similar way as you're probably doing for the remote RMI server).
See http://wiki.apache.org/tomcat/HowTo#How_do_I_debug_a_Tomcat_application.3F for how to start tomcat in remote debug mode:
set JPDA_ADDRESS=1044
set JPDA_TRANSPORT=dt_socket
catalina jpda start