Closed PulsarFox closed 6 years ago
I never tested the library in a servlet container, in the past I remember that some care should be taken when dealing with native code related to memory handling and creation of components. Well, what I see is that you are not copying the native libraries. Grab https://search.maven.org/remotecontent?filepath=com/frostwire/jlibtorrent-macosx/1.2.0.16-RC1/jlibtorrent-macosx-1.2.0.16-RC1.jar and https://search.maven.org/remotecontent?filepath=com/frostwire/jlibtorrent-windows/1.2.0.16-RC1/jlibtorrent-windows-1.2.0.16-RC1.jar and uncompress them as regular zip files. You will get a .dylib
and a .dll
. Place them in the appropriated place for your servlet container. Let me know the results.
Hm i'm a bit of a newbie at springtool but I tried to add a Configuration class with SpringBootServletInitializer and load the library in it but nothing changes. The configuration is loaded but the error type is the same.
did you uncompress the native library? what OS are you testing at the moment?
Yes I unzipped it and I tested it on macosx Sierra 10.12.6
Where did you put the libjlibtorrent.dylib
file?
I tested on the same folder as the conf class, the project root, the resources folder I even linked the path to the library to the conf class
(you can correct me if I'm wrong) Is this Spring Tools an eclipse based IDE, right? if that's the case, you should open the run configuration and set your native library path -Djava.library.path=<path here>
to the location when you extracted the .dylib
. For deployment in production is another story, let me know.
I think it works now. I added the jar manually and specified the source and the library path to the right files. Also i didn't install the macosx version because it was throwing me a Classdefnotfound exception. Thank you for your time (and your superapp of course) and i'll keep you in touch if something goes wrong !
Reopen if you need to
Hello , i am working with PulsarFox. We managed to bind the Jar manually. Actually we can download the video file form a .torrent. But it seems that some class used in the Example can't be found : likes Utils Files , Hex, Logger and i can't find how load them. Thanks for your time and your help.
That classes are private and internal to jlibtorrent
, not intended for external use. You can replicate their features with any apache commons library, or just copy the source code from the repo.
btw, in the screenshoot I see a mix of 1.2.0.6-RC3
for the sources and that you are using 1.2.0.16-RC3
for the binary. You can use 1.2.0.16
now and maven/gradle should pull the corresponding source.
Ok i will try it thank you very much :)
Edit: Maven import still cause linkage error or NoClassDefFoundError Could not initialize class com.frostwire.jlibtorrent.swig.libtorrent_jni.. we will keep the manual binding way for the moment.
I'm using Spring Framework installed with Spring Tools and when i add the jlibtorrent dependency it all works well. The jar is here on maven dependancies. Spring even finds the autoimports. But when I want to use something from jlibtorrent it trows me this warn "Resolved exception caused by Handler execution: org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.LinkageError: Look for your architecture binary instructions at: https://github.com/frostwire/frostwire-jlibtorrent" I got java 1.8 and the same error happens in osx and windows.