While developing and testing a plugin for Spoon, which I remember being the area dedicated to the design of ETL processes, you may want to start debug sessions useful for the detection of errors (bugs) found using the plugin. In this short article we’ll see how it is possible for a plugin Kettle, start a debug session from our development environment, which we assume to be Eclipse. The plugin that will take as an example is the same as that distributed by Pentaho called DummyPlugin 3, more details on this plugin can be found at http://wiki.pentaho.com/display/EAI/DummyPlugin+3+plugin+page.
There are several ways to start Kettle in debug mode, the easiest way is to change your options for starting the JVM such that the Eclipse debugger, but in general any kind of debugger will be able to attach to the process. These new options to set for the JVM are:
|-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000|
Listing 1 The JVM startup options
The JVM startup options listed in Listing 1, will allow the opening of Kettle in debug mode by opening a TCP / IP listen on port 8000 on all network interfaces of your workstation. The options for the JVM must be indicated on the following files located on the root installation of Kettle:
- spoon.sh for Unix/Linux
- spoon.bat for Windows
- Info.plist for Mac OS X. This file resides in two different locations:
- Data Integration 64-bit.app/Contents
- Data Integration 32-bit.app/Contents
In Listing 2 and Listing 3 are shown the changes to the startup files.
|OPT=”$OPT $PENTAHO_DI_JAVA_OPTIONS -Djava.library.path=$LIBPATH -DKETTLE_HOME=$KETTLE_HOME -DKETTLE_REPOSITORY=$KETTLE_REPOSITORY -DKETTLE_USER=$KETTLE_USER -DKETTLE_PASSWORD=$KETTLE_PASSWORD -DKETTLE_PLUGIN_PACKAGES=$KETTLE_PLUGIN_PACKAGES -DKETTLE_LOG_SIZE_LIMIT=$KETTLE_LOG_SIZE_LIMIT -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000|
Listing 2 Changes to the file Spoon.sh
<string>-Xmx256m -Xms256m -XX:MaxPermSize=128m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000</string>
List 3 Changes to the file Info.plist
|tcp4 0 0 *.8000 *.* LISTEN
[0x0-0x72072].Data Integration 64-bit: Listening for transport dt_socket at address: 8000
Log 1 Output of the netstat command and syslog
To Log 1 has highlighted the opening of a TCP / IP after the start of Spoon.
After configuring the environment Kettle in debug mode, you just have to proceed with the configuration of the Eclipse debugger. The configuration operation is very simple, just open the configuration menu of the debugger Run-> Debug Configurations, and create a new Remote Java Application configuration as well as shown in Figure 1.
Once you set the connection properties, you can click the Debug button to start the connection with the server in debug Kettle listen on TCP / IP port 8000.
At this point, the start of a debugging session becomes very simple, you must set a breakpoint, for example, the method setValue () in class DummyPluginMeta (see Figure 2) and then try to edit the metadata from the plugin designer Spoon. Upon confirmation of the change of the metadata, will start the debug session in Eclipse. The illustrations below show a summary of the steps that allow the start of the debugging session.
Council to read the article Developing a custom Kettle Plugin: Looking up values in Voldemort and the blog by the same author Slawomir Chodnicki. Comments and corrections are welcome.