Java Snippet UnsatisfiedLinkError when using external/additional library

Workflow requires the execution of a Java Snippet node that is inside of a loop. The snippet node is configured to utilize several java libraries. The workflow runs successfully for 2 iterations, then all subsequent iterations fail after an UnsatisfiedLinkError exception within the snippet node. There are several sources saying that reloading of libraries may cause this error.

Attempted resolution:
I removed the external libraries from the snippet node, and added them to the build path user libraries list - hoping that these libraries would be loaded only once on start-up. This too did not work, resulting in an UnsatisfiedLinkError exception after the second iteration of the workflow.

I used a python node to call a java subprocess.

Hi davekalpak!

Thanks for documenting the process of working around this issue!

The library will indeed be reloaded for every execution of the Java Snippet. What suprises me a little is that in the first described scenario the second iteration runs fine?

Is this issue specific to the library you are using? Or is this reproducible with any .jar?

Also, may I ask which version of KNIME Analytics Platform you’re on?

Thanks in advance,

At the time I was experiencing this issue, I was using version 3.5.2

I believe the failure was specific to the library I was using, the CPLEX optimization library. I had other libraries that did not fail, however that may be due to the load sequence of the libraries - as CPLEX was the lowest level dependency.

I’m not sure why it was able to run for 2 iterations then fail - I can only speak to the consistency with which that was happening.

This usually happens if the Jar loads some native system library. In contrast to Jars, native libraries must not be loaded more than once, otherwise you get these errors.

Thank you both for the insight. In light of this, I have updated the title of this post to reflect the fact that this is the inner workings of Java, rather than an actual KNIME bug.

1 Like