Goal
The aim of this document is to provide guidance and advice on how to debug Denodo custom extensions using the Eclipse IDE.
Debugging custom extensions
Denodo provides a series of APIs that allow users to develop their own Denodo extensions using Java code. This increases the flexibility of Denodo allowing the user to implement their own business logic or custom connectors to not supported sources.
These APIs allow:
- Creating VDP custom functions, stored procedures or custom wrappers. The Virtual DataPort Developer Guide section of the documentation describes the steps to create these artifacts.
- Creating Scheduler custom exporters or custom handlers. Refer to Scheduler Developer API to find further information about Scheduler extensions.
When developing any code, having debugging capability is one of the most important tools to create code and find errors as it allows the developer to check how the code is working step by step.
So the question is, how can a Denodo custom extension be debugged? We have different alternatives:
- The article How to debug Denodo custom extensions with IntelliJ IDEA provides guidance and advice on how to debug Denodo custom extensions using the Visual Studio Code IDE.
- The article How to debug Denodo custom extensions with Visual Studio Code provides guidance and advice on how to debug Denodo custom extensions using the Visual Studio Code IDE.
- In this article we describe how to debug Denodo Extensions using Eclipse.
Debugging Eclipse projects for Denodo custom extensions
There are a few steps to enable a Denodo server to be used for debugging.Let’s go through that with an example.
We are going to create a VDP custom function to return a “Hello World” message using a Maven project in Eclipse.
First, we have created our own Maven project called “mycustomfunction”.
Keep in mind that our HelloWorld.java class has been created according to the Developing Custom Functions section of the Denodo documentation. We will not focus much on the code as this is not the goal of this article.
The code of our Hello World function is pretty simple though.
package com.denodo.testing; import org.apache.log4j.Logger; import com.denodo.common.custom.annotations.CustomElement; import com.denodo.common.custom.annotations.CustomElementType; import com.denodo.common.custom.annotations.CustomExecutor; import com.denodo.common.custom.annotations.CustomExecutorReturnType; @CustomElement(type=CustomElementType.VDPFUNCTION, name="helloworld") public class HelloWorld { private static final Logger logger = Logger.getLogger(HelloWorld.class);
/** * This method is invoked when the custom function is executed * * @param input parameters * * @return custom value */ @CustomExecutor public String execute () {
logger.debug("Executing Custom Function"); return "Hello World"; }
/** * This method is invoked to compute the return type before executing the function. * If the execute method returns a simple Java type, this method is not needed. * * @param type for execute method input parameters * * @return custom type that execute method will return */ @CustomExecutorReturnType public Class<String> executeReturnType () {
logger.debug("Getting Custom Function return type");
return String.class; } } |
In order to prepare Eclipse for debugging go to Run -> Debug Configurations
Create a new Remote Java Application configuration
Configure the remote application as follows:
Note that the host must be the one where the VDP server is running and the port (1099) will be enabled in the VDP server later. Any other available port can be configured on both ends.
Then click Apply, then Close.
Now it is time to configure the VDP server to enable communications from Eclipse using the port 1099 specified above.
In the Denodo Control Center go to Configure -> JVM Options and append the following settings in the Virtual DataPort Server option.
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:1099 |
Click on “Ok” and “Apply” to persist the new settings, then restart the server.
If using a headless installation and the Denodo Control Center is not available, include the aforementioned settings following these steps.
- Open the <DENODO_HOME>/conf/vdp/VDBConfiguration.properties file.
- Find the java.env.DENODO_OPTS_START property and append the settings -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:1099 to the current values.
- Save the file.
- For the changes to take effect run the <DENODO_HOME>/bin/regenerateFiles.(bat/sh)script.
- Restart the VDP server.
NOTE: Adding this parameter to the JVM may have effects in the performance of the JVM. It is not recommended to modify the configuration in this way in production environments.
Finally, create the package of the Eclipse project ((i.e.) export as a JAR file) and load it in the VDP server using the Web Design Studio as described in the Importing Extensions section of the Denodo documentation.
Once this is done, back in eclipse, run the debug configuration. If you get a connection refused error, then remake the configuration, and try running it again.
Note: If the Debug configuration is already running then you will get a connection refused error. To find if Debug configuration is already running, hover over the Debug icon. A sample screenshot below
If there are no errors then the connection to the VDP server is established. Now just include a breakpoint in Eclipse and run the custom extension from the VQL shell of the Web Design Studio , and Eclipse will catch the breakpoint.
And the final result of our “Hello World” function is…
References
Virtual DataPort Developer Guide
The information provided in the Denodo Knowledge Base is intended to assist our users in advanced uses of Denodo. Please note that the results from the application of processes and configurations detailed in these documents may vary depending on your specific environment. Use them at your own discretion.
For an official guide of supported features, please refer to the User Manuals. For questions on critical systems or complex environments we recommend you to contact your Denodo Customer Success Manager.

