The kjb, ktr and xml files that can be used to reproduce the Shared objects file issue in Pentaho Data Integration Community Edition 9.4.
When we used PDI-CE 8.0, we used the feature Shared objects file in the transformation Miscellaneous tab. We defined database connections in different files to support different database engines. We set up a variable DB_CONN_SHARED_FILE in a previous transformation step. The value of the variable is the location of a shared object file (XML), like sharefiles/database-connections-mysql.xml. Then we used the variable as the value of the Shared objects file field as shown below. So, we could dynamically support various database engines, like MySQL, SQL Server, with the same *.ktr files.
It used to work in PDI-CE 8.0. But after we upgraded to PDI-CE 9.4, it does not work anymore. If we hard-code the value in the Shared objects file field, as shown below, like sharefiles/database-connections-mysql.xml, it works. But the variable does not work anymore.
- Linux
- MySQL database engine
- Download the file
pdi-ce-9.4.0.0-343.zip- https://www.hitachivantara.com/en-us/products/dataops-software/data-integration-analytics/pentaho-community-edition.html - Decompress the zip file to your local
- Go to the folder
data-integration - Run the command:
git clone [email protected]:albertwangnz/reproduce-shared-objects-file-issue-pdice-9.4.git - Go to the folder reproduce-shared-objects-file-issue-pdice-9.4
- Create the
testdatabaseon the MySQL database engine by using the filetest.sql - Edit the file
sharefiles/database-connections-mysql.xmland modify the following values based on your situation
- server
- port
- username
- password
- PORT_NUMBER
- Go back to the folder
data-integration - Copy the file
mysql-connector-java-5.1.48.jarto the folderlib
- Edit the file
reproduce-shared-objects-file-issue-pdice-9.4/use_shared_object_file_variable.ktr
- Line #419 shows we currenty use a hard-code value of the
Shared objects file
- Run the command:
sh kitchen.sh -file="reproduce-shared-objects-file-issue-pdice-9.4/main.kjb" - You will see the ETL runs without error
- In the log, you will see the variable
DB_CONN_SHARED_FILEis set value to${Internal.Entry.Current.Directory}/sharefiles/database-connections-mysql.xml, even though we don't use the variable in this transformation.
- Edit the file
reproduce-shared-objects-file-issue-pdice-9.4/use_shared_object_file_variable.ktr
- Comment line #419
- Uncomment line #418, now we use variable
- Run the command:
sh kitchen.sh -file="reproduce-shared-objects-file-issue-pdice-9.4/main.kjb" - You will see the ETL is failed
- In the log, you will see the error
You need to specify a database connection. That means the transformation did not use the filesharefiles/database-connections-mysql.xmlso it cannot find the neededdatabase connection.