Interactive Development and Debugging

We no longer develop with Eclipse, but use IntelliJ IDEA instead.  Ignore what it says on this page.  Check the install instructions for the platform you are using for how to setup IntelliJ IDEA:

Requirements

You need Eclipse Indigo with Java EE (WTP) development tools and Tomcat 7

Importing the project into Eclipse

You will need egit and m2eclipse.

Once everything is set up, to import the project, you can either:

  • import -> Git -> Projects from Git, then in the final step choose "open existing projects"
  • or import -> Maven -> Existing Maven Projects, then when the project is imported, do Team->Share->Git
If you get an error with m2e not recognizing yuicompressor's compress goal on the -webapp project, you can safely "permanently ignore it for future eclipse builds"
You can import -> Maven -> as existing maven project each of fluxtream-app's sub-modules
Team -> share (use 'parent's git local repository) will let you instantly see your changes

Running in Tomcat

Run tomcat's startup scripts (startup.sh or catalina.sh) from Tomcat's bin/ directory.

Debugging using JPDA

Original article: http://www.techiegyan.com/2009/04/12/debug-java-application-using-jpda-eclipse/

I am going to let you know how to quickly set up your Eclipse development Environment and tomcat server to enable debugging using JPDA. Using this you can debug the local tomcat server running on your machine or a tomcat running on remote machine.

Step 1:

Before starting the tomcat server, you need to set two environment parameters

set JPDA_TRANSPORT=dt_socket
set JPDA_ADDRESS=9000

You can set these parameters either in your path as environment variables or can change the catalina.sh/catalina.bat file directly to set values of these parameters. You can also include following lines in your .bashrc file of the user using which you are running tomcat server on your linux server :

export JPDA_TRANSPORT=dt_socket
export JPDA_ADDRESS=9000

Step 2:

Generally we execute startup.sh file for starting the server but this time start your server like following:

#/path_to_tomcat_directory/bin/catalina.sh jpda start

Step 3:

Configure Eclipse IDE for debugging the code running on server. Go To Run -> Debug Configuration… and select Remote Java Application in left side tree. Click on New to create new configuration for Remote Java Application

jdpa-debugging

a. Rename the configuration name as you like
b. Select the project you want to debug.
c. Keep the Connection Type ‘Standard(Socket Attach)
d. Change the host accordingly. If you have tomcat on your machine ‘localhost’ will work else change it to ip address of remote machine.
e. change the port (in our case JPDA port is 9000)
f. Change to ‘Source’ tab and add source to you debug configurations.
g. Click apply and then Debug to start debugging.

You can set breakpoints in your code now and code control will go to the break point when it will come in execution path.

If you are unable to connect to JPDA socket following can be reasons:

a. Any body else is already connected to that socket means already in debugging session
b. Socket is not opened on remote machine. This will require some firewall settings to open the socket for debugging.

Make sure you have same version of source which is running on server else you will face issues while debugging the application.

Setting up JRebel

Because of the compiled nature of the Java language, J2EE development can be a PITA if you don't use the right tools. JRebel is a software agent that instruments the JVM and automatically reloads modified bytecodes at runtime. It's an absolute must for web development.

Aim for JRebel Social, which you can use for free on Open Source Software.