I am trying to convert .pcap files into .xml files using this repo https://github.com/ISCX/ISCXFlowMeter for my deep learning project. I am new to java so I can't understand how to resolve this issue. I am using 32 bit jdk on 64 bit ubuntu. Seems like there is an issue with jnetpcap. Please someone help me as my deadline is very near. Thank you.
1 Answers
From the looks of it I would say you are missing an external library, like a Shared Object (.so) in Linux or a Dynamic Link Library (.dll) in Windows. If you shared the entire exception we could find out exactly where the exception is thrown and try to see if the code tells us where the library is expected to be found. Otherwise, I'd look at your classpath and make sure it contains the relevant dynamic libraries jnetpcap needs (reading the doc, jnetpcap is just a Java wrapper over existing non-Java utilities so that makes complete sense that there are non-Java dependencies to provide).
I tracked down the code in your stacktrace on Github and found that the exception was thrown here while loading the libraries in this annotation. Therefore, my guess is that you're missing one of the following libraries in your classpath: wpcap
, pcap
, jnetpcap-pcap100
, jnetpcap
. Two of them can be found here, for Linux (Windows available in the same repo).

- 25,226
- 7
- 41
- 82
-
I have attached the picture.Check this out please. – Aug 11 '19 at 12:18
-
The error is thrown here: https://github.com/ruedigergad/clj-net-pcap/blob/master/jnetpcap/jnetpcap-src-1.4.r1425-1/src/java1.5/org/jnetpcap/Pcap.java#L500. I'll continue going down the code but in the meantime please print your classpath. – Dici Aug 11 '19 at 12:22
-
How can I print classpath? I mean for which class you want me to print classpath? – Aug 11 '19 at 12:24
-
I also followed the last 2 answers but it didn't work. https://stackoverflow.com/questions/39048964/jnetpcap-java-lang-unsatisfiedlinkerror-com-slytechs-library-nativelibrary-dl – Aug 11 '19 at 12:27
-
The classpath is something you set before starting the JVM (although it is possible to dynamically alter it, it's rarer). How do you launch your application? There are probably ways to print your classpath from Java, look it up on the internet. – Dici Aug 11 '19 at 12:27
-
Your exception is thrown either there (https://github.com/ruedigergad/clj-net-pcap/blob/master/jnetpcap/jnetpcap-src-1.4.r1425-1/src/java1.5/com/slytechs/library/JNILibrary.java#L289) or line 299, can't tell from your stacktrace. The function was called using these parameters: https://github.com/ruedigergad/clj-net-pcap/blob/master/jnetpcap/jnetpcap-src-1.4.r1425-1/src/java1.5/org/jnetpcap/Pcap.java#L239 – Dici Aug 11 '19 at 12:29
-
Are you able to run the code through the debugger and put breakpoints in the locations I've shown you? – Dici Aug 11 '19 at 12:29
-
Check /home/osama/New/ISCXFlowMeter/src/main/java/ /home/osama/New/jnetpcap.jar /home/osama/New/commons-math3-3.6.1/commons-math3-3.6.1.jar /home/osama/New/log4j-api-2.12.0.jar /home/osama/New/log4j-core-2.12.0.jar – Aug 11 '19 at 12:30
-
I am not using any IDE, I have to run this code on google colab for my project. so I will just use terminal for any operation. – Aug 11 '19 at 12:31
-
Can you check please stackoverflow's link? Seems like there was a similar issue. – Aug 11 '19 at 12:33
-
I tracked down the exception until the end: https://github.com/ruedigergad/clj-net-pcap/blob/master/jnetpcap/jnetpcap-src-1.4.r1425-1/src/java1.5/com/slytechs/library/NativeLibrary.java#L119. You have to know what was the name of the library it tried to load though, which you could do using a debugger. – Dici Aug 11 '19 at 12:33
-
@a2nineu I don't think we need StackOverflow for this. We have all the code available on Github, we know exactly what is being executed. – Dici Aug 11 '19 at 12:34
-
I think library is libjnetpcap.so or libjnetpcap-pcap100.so. – Aug 11 '19 at 12:36
-
Make sure the following binaries are available in the classpath: `wpcap`, `pcap`, `jnetpcap-pcap100`, `jnetpcap`. For Linux, you can find two of these binaries here: https://github.com/ruedigergad/clj-net-pcap/tree/master/jnetpcap/native/linux/amd64 – Dici Aug 11 '19 at 12:38
-
You mean like this: CLASSPATH=/path/to/.sofiles – Aug 11 '19 at 12:40
-
Depends how you launch the application. I'd same something like that if you do it on the CLI: `java -cp "path/to/jars:path/to/so/files" your/main/class` – Dici Aug 11 '19 at 12:45
-
class paths : /home/osama/New/ISCXFlowMeter/src/main/java/ /home/osama/New/jnetpcap.jar /home/osama/New/commons-math3-3.6.1/commons-math3-3.6.1.jar /home/osama/New/log4j-api-2.12.0.jar /home/osama/New/log4j-core-2.12.0.jar /home/osama/libjnetpcap.so /home/osama/libjnetpcap-pcap100.so – Aug 11 '19 at 12:52
-
This is not a valid classpath, paths must be separated with `:`. Can you use a debugger to figure out which library fails to load? – Dici Aug 11 '19 at 12:55
-
I used : in bashrc, this is the output of java program. Can you tell me please how can I use debugger? Thank you – Aug 11 '19 at 12:58
-
An IDE would give you that out of the box, that's a very useful tool for some investigations. – Dici Aug 11 '19 at 13:02