I have a Java Edit Variable node in a simple workflow (KNIME 4.3.2) that calls a method in an external jar which returns a string. The external jar allows us to connect to a password repository which returns a password and then we put the password into a flow variable which is provided to a Variable to Credentials node. We have added the jar file under the workflow folder in a data folder and reference it via the Additional Libraries tab in the node via the KNIME URL: knime://knime.workflow/data/PasswordManager.jar.
On my laptop I am able to run it successfully. When I try to run it on the KNIME server via a scheduled task, we receive the error:
There are messages for workflow “PWManager_Test 2021-11-05 13.46.00”
- Java Edit Variable 0:12 - ERROR: Configure failed (RuntimeException): An error occured in an expression with output flow variables.*
It looks like it is a configuration failure with either reading the jar or something else. Since the workflow runs properly (connecting and retrieving the password successfully from the password repository and putting it in a flow variable) on my local KNIME, it does not seem to be an issue with the definition or use of the flow variables themselves.
I included the code below from the Java Edit Variable. I cannot share the jar file due to proprietary reasons. The jar does expect a certain environment variable to exist for the user running the workflow, which we have setup for the server knime account. In the past if the environment variable was missing, we would have a different variable. Also when the jar file was not available we had a different error message, than this one.
Any suggestions as to where to look or focus on to fix this would be greatly appreciated.
A version of the code within the Java Snippet window is here:
// system imports
import org.knime.base.node.jsnippet.expression.AbstractJSnippet;
import org.knime.base.node.jsnippet.expression.Abort;
import org.knime.base.node.jsnippet.expression.Cell;
import org.knime.base.node.jsnippet.expression.ColumnException;
import org.knime.base.node.jsnippet.expression.TypeException;
import static org.knime.base.node.jsnippet.expression.Type.*;
import java.util.Date;
import java.util.Calendar;
import org.w3c.dom.Document;
// Your custom imports:
import com.test.passwordManager.PasswordManager;
// system variables
public class JSnippet extends AbstractJSnippet {
// Fields for input flow variables
/** Input flow variable: “knime.workspace” */
public String v_knimeworkspace;
// Fields for output flow variables
/** Output flow variable: “v_dbPassword” /
public String out_dbPassword;
/* Output flow variable: “v_dbUserName” */
public String out_dbUserName;
// Your custom variables:
// expression start
public void snippet() throws TypeException, ColumnException, Abort {
// Enter your code here:
//Note: PasswordManager assumes that the PWR_USER_KEY environment variable is set on the
// machine where this code is run. It uses this key to connect and authenticate with
// the password Manager.
//set username – test username
String dbUserName = “test123”;
//Populate the knime output flow variables
//Call to PasswordManager with the test parameters
out_dbPassword = PasswordManager.getPassword(“Development”, “test”, dbUserName);
out_dbUserName = dbUserName;
// expression end
}
}
Thanks,
Leslie