Deadlock Eclipse(R) has a great set of tools such as the debugger. A debugger allows a user to control a program while it is executing. Using a debugger to understand how a program works is a good way to find potential bugs. The debugger can be remotely attached to a JVM running in the Wrapper and you can see step by step what is happening. In the following example, you will see how the debugger is easy to setup.


Download the Java Service Wrapper

In this example, we will use the latest available version of the Wrapper: 3.5.26. Please download the Wrapper for your platform and save it somewhere on your disk. For example: /home/tanuki/wrapper-3.5.26/

Download the Java source code

The source code of the Java Service Wrapper is accessible via SourceForge. Please download the source code here download for the version you just downloaded in the previous step. In this example, we will use the source code for version 3.5.26.

Extract the files somewhere on your machine, for example: /home/tanuki/wrapper_3.5.26_src


The Java source code is the same for all the editions (Community, Standard and Professional) of the Wrapper.

Eclipse files

Create the following two files (used by Eclipse) in the folder: /home/tanuki/wrapper_3.5.26_src/src/java

<?xml version="1.0" encoding="UTF-8"?>
	<classpathentry kind="src" path="."/>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<?xml version="1.0" encoding="UTF-8"?>


Import the Java source code in Eclipse:

  • Start Eclipse
  • Click on file
  • Continue on import
  • Select General > Existing Projects into Workspace
  • Go to Next
  • Select the folder /home/tanuki/wrapper_3.5.26_src/src/java
  • Click on Finish

As soon as the folder is imported, you will see an error in Eclipse. To fix this, do the following steps:

  • Remove the extension .in from the file
Open the file and apply the following changes:
  • Change @version.root@ to 3.5.26
  • Change to 20131212
  • Change @build.time@ to 1200

My application

In Eclipse, we will create an application "MyApplication" that will be launched by the Java Service Wrapper. The folder for this project is /home/tanuki/workspace/MyApplication.

Create a class
import org.tanukisoftware.wrapper.WrapperManager;

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Enter your name: ");

        BufferedReader br = new BufferedReader(new InputStreamReader(;

        String name = "";

        try {
            name = br.readLine();
        } catch (IOException ioe) {
            System.out.println("Could not read your name!");

        System.out.println("Hello, " + name + "!");
        String version = WrapperManager.getVersion();
        System.out.println("Wrapper Version: " + version);

Eclipse will display some errors about the WrapperManager. To solve it open MyApplication's Properties and add the wrapper-code in the build path.

Link the Java Service Wrapper to MyApplication

Open the file /home/tanuki/wrapper-3.5.26/conf/wrapper.conf and set the following properties:

# information to run MyApplication

# set the path to your application

# set the Wrapper in debug mode,address=8001,server=y,suspend=y


Port 8001 will be used later by Eclipse.

In this example, we are using the Integration Method 1 to integrate MyApplication with the Java Service Wrapper.

Run the Java Service Wrapper

Run the Java Service Wrapper using the following command:

TestWrapper Example Application
bin/testwrapper console console

You will see that the process looks frozen.

waiting for a debugger
Listening for transport dt_socket at address: 8001
In fact, the Wrapper is waiting for a debugger to be attached.

Run the debugger

In Eclipse, follow the steps to create a remote debugger:

  • Select in the menu Debug->Debug Configuration...->Remote Java Application.
  • Create a New Launch Configuration.
  • Set a name (for example "RemoteWrapper")
  • Select the project wrapper-code.
  • Set Host to localhost.
  • Set Port to 8001 (same value we set in wrapper.conf)
  • Click on tab Source
  • Click on Add, select Java project and choose both MyApplication and wrapper-code.
  • Finally click on Debug

From this point, the Eclipse debugger is linked to MyApplication and the Wrapper! If you look at the terminal, you will see that MyApplication is running. Back in the source code, you can add a breakpoint and debug the application. You will be able to see which line is executed.