Setup

Mac setup

JRebel setup

jrebel.tar

rebel.xml

Additional Tomcat setup

Install IntelliJ IDEA

IntelliJ IDEA settings

Care and feeding of Tomcat

Setup TOMCAT_HOME

Mac:

export TOMCAT_HOME=/Library/Tomcat/Home

Linux, if following directory pattern from Amazon EC2 setup example

export TOMCAT_HOME=/opt/tomcat/home
Shutdown Tomcat

Before trying to shutdown Tomcat, make sure the IntelliJ IDEA debugger doesn't have the process broken at a breakpoint.  If it does, quit the debugger.

Issue the shutdown command:

 cd $TOMCAT_HOME
./bin/shutdown.sh

Make sure it's really dead:

 ps auwwx | grep java

Look for processes with args relating to Tomcat.  If you see one, try to kill the process, ps again, etc.  If it still won't die, do kill -9.

Start Tomcat with JRebel and jpda debugging

Before issuing the Tomcat start command, make sure it is really not running.  If it is running, issue a shutdown/kill until it succumbs (see above).

Start a terminal to watch for monitoring the logs during startup (if this is the first time you're starting Tomcat you'll need to do this after startup since the log won't yet exist):

 tail -f $TOMCAT_HOME/logs/catalina.out

Issue the start request:

 cd $TOMCAT_HOME
./bin/catalina-jrebel.sh jpda start 

It will spew out lots of startup messages to the log, which should end with a message of the form:

  INFO: Server startup in 198652 ms

Now you should be good to go to http://localhost:8080/ and either login or register for an account.

Managing Modifications/Builds

Assuming you have JRebel working and properly integrated, different types of changes lead to different required actions to be properly reflected.  Changes made either through editing in IntelliJ IDEA or pulled from git are, as far as I know, equivalent for these purposes.

It helps if during development you disable the browser cache.  In chrome you do this via the following steps:

When changes are made, follow the lowest bullet that corresponds to the new set of changes:

Connector debugging

It helps to be able to use the admin console to be able to debug connectors.  Here are the steps:

First, you need to make yourself an admin in your local flx DB.  This assumes you're user ID 1; modify the 1 to some other number to affect a different user:

 mysql -u root flx
select * from Guest;
update Guest set roles = 'ROLE_USER,ROLE_ADMIN' where id=1;

In IntelliJ, open the Updater.java file specific to the connector you're debugging (example: FitBitTSUpdater.java for the Fitbit connector) and put a breakpoint in the updateDataHistory method.

If not already debugging, select  and click the debug start button: (see the Setup for debugging section of Notes about IntelliJ IDEA for how to set up to debug on jpda 9000).

Now go the the connector admin console at http://localhost:8080/admin/1

Find the name of the connector you want to debug and click the button that looks something like this .  The exact text will depend on the types of facets in use by that particular connector.

That should hopefully hit your breakpoint.