Using External Jar in Java Snippet Node. Workflow Not able to initialize class of External jar

Hi all,

I will like ask for guidance and direction to proceed for this problem i am currently facing.

I currently thinking of using KNIME to read .pcap files (WIRESHARK Traces File format) and do some data mining.

I am using jNetPcap 1.3 / 1.4 library. There is no issue to do import org.jnetpcap.* after adding external jar inside the java snippet node. But when i run the java snippet, the KNIME console have warning ".... Exception message:com.slytechs.library.NativeLibrary.dlopen(Ljava/lang/String;)J" followed by a few lines of ".... Exception message: Could not initialize class org.jnetpcap.Pcap"

The code i wrote inside the java snippet is as follow:

 

//system imports

import org.jnetpcap.Pcap;

.....

//Enter your code here:

final String FILENAME = c_URL;

final StringBuilder errbuf = new StringBuilder();

final Pcap pcap = Pcap.openOffline(FILENAME, errbuf);

if(pcap == null){
OutputColumn = errbuf.toString();
}

Some of my Background (Java newbie) and using KNIME 2.9.2

Updating:

I notice that the java snippet is able to run as a workflow for the run execution (after the first reset, after opening knime). But the warnings are back again after the second reset. Unable to initialize the library, yet again.

I only can get it to work after exiting knime and start knime again.

Currently sticking to this tedious method to continue my coding. and testing once per exiting/starting knime cycle. 

From your exception stacktrace it seems it contains a native library too. Probably initializing that multiple times causes the problem. (I was unaware of this restriction if it is present.) Is not there an alternative with fully managed dependencies?

Cheers, gabor

Thanks aborg,

Meanwhile

I was reading various resources in the web (KNIME and jNetPcap on adding external jar/library into Eclipse IDE). I notices most will recommend using Build Path > Configure Build Path ...

Apparently, for KNIME workflow project. This option is not available.

Not sure if this is the correct direction i should be heading..

:) appreciate any help i can get.

 

This looks very much like a dedicated node for reading such files. The Java Snippet node is not useful for reading external data anyway, because it processes the input data row by row and has a 1:1 relation between input and output rows. What would be in the input in your case?