Remote debug debugging for kettle client and source code environment --- Remote debug debugging for deployed java projects (idea version)

Table of contents

Kettle client for remote debugging

①Open the spoon.bat file with an editor

② Configure the remote debug environment in idea

③Running kettle and monitoring environment

④ Interrupt and debug according to the requirements

Remotely debug plug-ins or custom plug-ins in the kettle source code environment


        Recently, during the secondary development of Kettle, I needed to debug the plug-in code I wrote, and then searched for information on the Internet. I thought that the source code environment must be deployed to debug the plug-in code, so I spent a day. Deploying the source code environment of this kettle is mainly because the download dependency is too slow and requires a special foreign image, so it may be relatively slow. If the network is not good, it may take several hours, and it will continue intermittently. The source code of kettle is not displayed here Environment, I will explain the source code environment deployment of kettle8.3 in the next blog.

  However, it was discovered afterwards that the kettle can also be debugged and remotely debugged using the client , and the java virtual machine supports debug and remote debugging . The following two ways will speak! In fact, not only kettle can be used for remote debugging, but also jar deployed projects can be used for remote debugging, which may require different configurations.

Kettle client for remote debugging

The kettle client environment I demonstrated is kettle7.1.0.0-12. Let me first explain what the kettle client is. It is a software zip archive that we downloaded before. After decompression, it can be directly executed, also known as the green installation version. First install the kettle version you need directly on the kettle official website: Official website: Pentaho from Hitachi Vantara - Browse /Data Integration at SourceForge.net

 After downloading and decompressing the corresponding zip, you can see the following directory situation: the specific installation is that the zip software is installed in the same way, if you are not sure, you can directly search for kettle installation on Baidu/Google, and a bunch of related information.

Let's take a look at what the kettle looks like after running:

Configure the remote debugging environment for kettle:

①Open the spoon.bat file with an editor

Find the following line:

Add after this line: Do not put double quotes! ! ! address is the port number configured to monitor.

-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000

 After the configuration is complete, it is as follows:

② Configure the remote debug environment in idea

Special attention: the listening port should be the same as the port you just set in spoon.bat! ! !

After the configuration is complete, the following will appear:

③Running kettle and monitoring environment

Double-click spoon.bat in the installation decompression package, wait for the kettle to run successfully, and start the debug in the idea

④ Interrupt and debug according to the requirements

Maybe you will have doubts, the running project contains jar packages, how to break the point, in fact, I was also puzzled at the beginning, but after various attempts, I did find a way to break the point;

The kettle interface opened by idea is as follows, and the kettle is running at this time, and the remote debug in idea is also running!

Just find a plugin for remote debug testing:

Then find the dependency package jar of the corresponding plug-in in the client opened by idea: take it as a dependency, so that it can be used to break the point

 Then we can see that the jar dependency can be expanded to see the relevant class files, and we can directly break the point in this class file: first find the class file of the window code Note: At this time, the  remote debug in our idea is to run on! ! !

 Then we go to the kettle and double-click the plugin :

 Trigger the debug effect:

Then you can go to the place you want to debug according to your own needs for debugging! ! !

If you want to delete the add as library you just added, it is also possible:

Remotely debug plug-ins or custom plug-ins in the kettle source code environment

 Assuming that you have already built the source code environment of kettle, I will demonstrate the source code environment of kettle8.3 below;

Find the program entry file under the path: org.pentaho.di.ui.spoon.Spoon:

Execute this startup file. If the kettle source code is deployed correctly, the corresponding operation page will be opened:

 The plug-ins in the source code environment of kettle8.3 need to deploy the plug-in jar dependencies to a special folder to take effect on the operation page. I will talk about it later.

After using the source code environment to start this program, some original functions of kettle can be directly debugged, and can be debugged directly in the corresponding code , and there is no need for remote debugging, just use the debug method to start the spoon class directly, and then Just go to the corresponding java code break point.

But if you need to debug some plug-ins or custom plug-ins, you can directly use the debug function of idea to debug (you need to start the spoon program in debug mode). Just use the add as library of the corresponding plug-in jar, and then other operations are the same as on the client.

But when we go to the start-up operation page to find it, we will find that the operation of the plug-in is not in the above page, and it needs to be deployed directly to be displayed on the operation page:

 Note: This jar is the jar of the packaged plug-in, and the lib is some external dependencies required by the plug-in, see the requirements configuration.

 This version.xml opens with these things:

<?xml version="1.0" encoding="UTF-8"?>
<version branch='TRUNK'>7.1.0.0-12</version>

 The jar package can be obtained in two ways:

①: If the custom-developed plug-in is a maven project, maven can be used to package the plug-in source code

②: If it is an external plug-in that comes with kettle, you can find it in the zip of the client

After deploying the corresponding plug-in in the source code environment, start the spoon in debug mode to see the deployed plug-in on the operation page, and then add the plug-in jar add as library to break the class file:

 

Guess you like

Origin blog.csdn.net/weixin_53142722/article/details/126903430