Run a .jar file within Spoon (Pentaho Kettle)

I am trying to run a java jar file from Spoon. The jar file contains a single class named "Limpieza" within the package com.overflow.csv.clean. I would like to be able to execute this class with or without parameters. I have placed the jar file in the directory: C:\Program Files (x86)\Kettle\data-integration\lib. To call the Limpieza class from a Modified JavaScriptValue step, I used the following syntax: var jar = com.everis.csv.clean.Limpieza; Unfortunately, this method is not working for me. Is there an alternative approach that could make it work? Additionally, I would like to be able to view the program's logs when it runs. Although I do not encounter any errors during the transformation process. Thank you.

Answer №1

Take a look at the blog linked below:

Hopefully, this information proves helpful :)

Answer №2

Spoon will automatically load any jar files found in its

data-integration\lib

directory and its subdirectories upon startup. If you need to use classes from a custom jar, simply place the jar file here.

To utilize a custom class in either the "Modified Java Script Value" or "User Defined Java Class" step, make sure to reference it by its fully qualified name. For instance,

var jar = com.everis.csv.clean.Limpieza.getInstance().getMyString();

Note: Remember to restart Spoon after adding the jar file.

If the issue persists, please provide the Pentaho.log (located at data-integration-server/logs/Pentaho.log) and catalina.out (found in data-integration-server/tomcat/logs) logs for further investigation.

Answer №3

To solve the problem, I decided to implement a custom Java class following Rishu's instructions. Below is the code that successfully addressed the issue:

import java.util.*;
import com.mycompany.csv.Cleaner;

public boolean executeTransformation(StepMetaInterface smi, StepDataInterface sdi) throws KettleException
{
    Cleaner cleaner = new Cleaner();
    cleaner.clean();

    // Additional steps for proper functionality
    // Also, ensure to include a Generate Rows step that feeds data into this one.
    
    Object[] rowData = getRow();

    if (rowData == null) {
        setOutputComplete();
        return false;
    } 

    rowData = createNewOutputRow(rowData, data.outputRowMeta.size());
    addRowToOutput(data.outputRowMeta, rowData);

    return true;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Exploring the binary search algorithm in the world of Java programming, alongside the

I'm currently working on a Java project where I am developing a game similar to Mastermind. The game involves generating a random 4-digit number, which the user must guess. After each guess, the computer provides feedback on how many correct digits ar ...

Having trouble utilizing a method from an external jQuery file within an Angular 7 component

Having trouble accessing a method from an external jQuery file in an Angular 7 component. I've attempted various approaches but can't seem to call the method in the external file. Here's the code snippet: external file: > (function ($) ...

Implementing swipe functionality to Bootstrap carousel

This is the code snippet I am working with: <div class="container"> <div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="3000"> <!--Indicators--> <ol class="carousel-indicators"> ...

What is the process for transforming a method into a computed property?

Good day, I created a calendar and now I am attempting to showcase events from a JSON file. I understand that in order to display a list with certain conditions, I need to utilize a computed property. However, I am facing difficulties passing parameters to ...

In Nodejs, the function 'require' fails to load a module when using specific filenames

Hello everyone, I am a long-time user but this is my first time asking a question. So, I have a file named file.js where I am trying to require another file called user.service.js at the beginning of the file: var userService = require('./user.servi ...

What is the process of removing a document with Next.JS and MongoDB by utilizing next-connect?

Currently in the process of constructing my first CRUD application using NextJS/Mongodb and I've decided to utilize next-connect for handling the methods. As a newcomer to this field, I have managed to successfully create posts and update user profile ...

Is there a way to create a dynamic associative array using jquery?

I am looking to create an array structured like the following:- arr[0][from] = value arr[0][to] = value arr[1][from] = value arr[1][to] = value . . And so forth. I have input array html elements for the from & to fields. <input type="text" name ...

Leveraging the button's class attribute to initiate an ajax request

I have a form that submits multiple fields to MySQL and an ajax function. Here is the ajax code I am using: $(function() { $(".CommentSend").click(function() { var comment = $("input#Comment").val(); var user = $("input#InverrtedUser").val(); var ...

Is it possible for two overlapping Javascript divs to both be draggable at the same time?

I have multiple stacked div elements. The top one needs to be draggable, while the one beneath should remain clickable. An illustration is provided below for better understanding: The green div elements are contained within cells. Clicking on a cell trigg ...

There is a potential risk of NextResponse.json file compromising the integrity of JSON

Running nextjs 13.5.3 and implementing an API route handler under /app This route handler mainly fetches data from a CMS and then returns the response. The IDs on the client side are hashed, so one of the functions is to unhash the IDs from a request and ...

Transforming an SQL query to Spark using the "not exists" operator

I have a SQL query that I need help with load1.sqlContext() .sql("select object_id, parent_id, object_id as root_id, attr_id, attr_name, value from load l1 where not exists (select 1 from load l2 where l2.object_id = l1.parent_id)" ...

How can I send a file and a string request using the POST method to a Spring REST controller that accepts byte[] and Strings with Angular

Need help with sending a post method that includes a file and another string request parameter to a spring rest controller using angular. The server controller parameter is set up to receive an array of bytes for the file and another string request wrappe ...

Make the most of your Bootstrap 3 layout by utilizing a full page container that fills both the width and height between a fixed header and

I am currently working on a basic bootstrap page with the Example template from Bootstrap's website. I want the content in the middle to take up the space between the header and footer, while ensuring that both the header and footer remain visible at ...

In React, a singular reference cannot establish focus amidst an array of references

Scenario In this scenario, we are restricted to using only keyboard navigation without any mouse clicks. Imagine a situation where we have 10 table rows displayed on the screen. Each row contains a menu button for interaction. When the tab key is pressed ...

Encountering installation issues with npm for bcrypt installation due to a

While working on an Express JS project, I encountered issues trying to install the bcrypt module for data authentication. Despite multiple attempts, I kept receiving the same errors. [email protected] install /media/iron/1d6c195f-2350-423c-a3f0-050 ...

Displaying a collection of objects in HTML by iterating through an array

As someone new to coding, I am eager to tackle the following challenge: I have designed 3 distinct classes. The primary class is the Place class, followed by a restaurant class and an events class. Both the restaurant class and events class inherit core p ...

Start a Draft.js Editor that includes an unordered list feature

I am trying to pre-populate a draft.js editor with an unordered list made from an array of strings. Here is the code I have so far: const content = ContentState.createFromText(input.join('*'), '*') const editorState = EditorState.crea ...

The 'in' operand is invalid

I am encountering a JavaScript error: "[object Object]" TypeError: invalid 'in' operand a whenever I attempt to perform an AJAX request using the following code: .data("ui-autocomplete")._renderItem = function( ul, item ) { return $( " ...

How to achieve padding of strings in JavaScript or jQuery

Does anyone have information on a similar function in jQuery or JavaScript that mimics the prototype toPaddedString method? ...

Synchronize the scrolling of two tables sharing a common data source to ensure both tables scroll in unison

I encountered some issues while using ui-scroll in my application. My goal is to have ui-scroll function on the same datasource that is used to populate two tables. By scrolling one table, I want the other table created from the same data source to also s ...