Debug a FirstSpirit server remotely with Intellij

gorecki
I'm new here
1 3 2,423

A very useful feature in Intellij is the debugging functionality. In some cases you need to debug a FirstSpirit server running on a different machine than your own. Intellij provides Run/Debug Configurations which can be used to connect to a running JVM on another machine over a certain port. Here is a quick guide for setting up this remote debugging connection:

1. Configure the debug port in your FS server

Open the fs-wrapper.conf in FS's conf-folder and add the folowing two parameters in the section "Java parameters for garbage collection". I'll use port 50005 as debug port in this example.

wrapper.java.additional.24=-Xdebug
wrapper.java.additional.25=-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=50005

It is important to adjust the numbers of these additional parameters. A continuous enumeration is needed!

2. Restart the FirstSpirit server

Restart the FirstSpirit server. Smiley Wink

3. Set up a Run/Debug Configuration in Intellij

  • Open the Run/Debug Configurations (Run -> Edit Configurations)
  • Add a new remote configuration by clicking on the plus sign in the upper  left corner and select "Remote" from the drop list.
  • In the settings panel enter the hostname of the machine where your FS  server is running and the debug port we configured in step 1. (I used  50005.)

4. Start your new Run/Debug Configuration

  • Be sure that you FS server is running by checking the FS start page or  the fs-wrapper.log logfile.
  • Start the remote debug connection by launching your new configuration.  For that click on Run -> Debug... and select your new remote  configuration.

After a secound or two your Intellij console should  prompt something like this:

"Connected to the target VM, address:  'myhost:50005', transport: 'socket'"

Now you can stop the JVM by setting breakpoints in your code.

Enjoy!

Tested with FS 4.2.R2

3 Comments
Version history
Last update:
‎07-08-2010 10:27 AM
Updated by: