Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no jniavdevice in java.library.path #1579

Closed
danybenjamin opened this issue Jan 27, 2021 · 11 comments
Closed

no jniavdevice in java.library.path #1579

danybenjamin opened this issue Jan 27, 2021 · 11 comments

Comments

@danybenjamin
Copy link

I am getting this error when running on ec2 runner but it works locally just fine.

my pom has:

 <dependency>
            <groupId>org.bytedeco</groupId>
            <artifactId>javacv-platform</artifactId>
            <version>1.5.4</version>
        </dependency>

        <dependency>
            <groupId>org.bytedeco</groupId>
            <artifactId>javacv</artifactId>
            <version>1.5.4</version>
        </dependency>

        <dependency>
            <groupId>org.bytedeco</groupId>
            <artifactId>ffmpeg</artifactId>
            <version>4.3.1-1.5.4</version>
        </dependency>

The error:

Caused by: java.lang.UnsatisfiedLinkError: /root/.javacpp/cache/ffmpeg-4.3.1-1.5.4-linux-x86_64.jar/org/bytedeco/ffmpeg/linux-x86_64/libjniavdevice.so: libxcb.so.1: cannot open shared object file: No such file or directory
@saudet
Copy link
Member

saudet commented Jan 27, 2021 via email

@danybenjamin
Copy link
Author

It's not just a warning, it's failing my unit test and won't let keep going:

Full error:

Tests run: 9, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 6.221 sec <<< FAILURE!
testConvertingVideo(StatusManagementServiceTest)  Time elapsed: 2.415 sec  <<< ERROR!
java.lang.UnsatisfiedLinkError: no jniavdevice in java.library.path
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
	at java.lang.Runtime.loadLibrary0(Runtime.java:871)
	at java.lang.System.loadLibrary(System.java:1124)
	at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1683)
	at org.bytedeco.javacpp.Loader.load(Loader.java:1300)
	at org.bytedeco.javacpp.Loader.load(Loader.java:1123)
	at org.bytedeco.ffmpeg.global.avdevice.<clinit>(avdevice.java:28)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:348)
	at org.bytedeco.javacpp.Loader.load(Loader.java:1190)
	at org.bytedeco.javacpp.Loader.load(Loader.java:1139)
	at com.tc.video.statusManagement.services.StatusManagementService.convertVideoFilesToMp3(StatusManagementService.java:468)
	at com.tc.video.statusManagement.services.StatusManagementService.run(StatusManagementService.java:338)
	at StatusManagementServiceTest.testConvertingVideo(StatusManagementServiceTest.java:146)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.mockito.internal.runners.DefaultInternalRunner$1$1.evaluate(DefaultInternalRunner.java:46)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.mockito.internal.runners.DefaultInternalRunner$1.run(DefaultInternalRunner.java:77)
	at org.mockito.internal.runners.DefaultInternalRunner.run(DefaultInternalRunner.java:83)
	at org.mockito.internal.runners.StrictRunner.run(StrictRunner.java:39)
	at org.mockito.junit.MockitoJUnitRunner.run(MockitoJUnitRunner.java:163)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Caused by: java.lang.UnsatisfiedLinkError: /root/.javacpp/cache/ffmpeg-4.3.1-1.5.4-linux-x86_64.jar/org/bytedeco/ffmpeg/linux-x86_64/libjniavdevice.so: libxcb.so.1: cannot open shared object file: No such file or directory
	at java.lang.ClassLoader$NativeLibrary.load(Native Method)
	at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934)
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1817)
	at java.lang.Runtime.load0(Runtime.java:810)
	at java.lang.System.load(System.java:1088)
	at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1633)
	... 48 more
Results :
Tests in error: 
  testConvertingVideo(StatusManagementServiceTest): no jniavdevice in java.library.path

@saudet
Copy link
Member

saudet commented Jan 27, 2021 via email

@danybenjamin
Copy link
Author

danybenjamin commented Jan 27, 2021

I don't? I'm not sure how to exclude that.

I tried with just this in my pom:

<dependency>
    <groupId>org.bytedeco</groupId>
    <artifactId>ffmpeg</artifactId>
    <version>4.3.1-1.5.4</version>
</dependency>

but then I get:

java.lang.UnsatisfiedLinkError: no jniavutil in java.library.path: [/Users/dany.benjamin/Library/Java/Extensions, /Library/Java/Extensions, /Network/Library/Java/Extensions, /System/Library/Java/Extensions, /usr/lib/java, .]

So, I saw another issue thread where you suggested adding the other two dependencies and with that, it worked locally on my mac.

@saudet
Copy link
Member

saudet commented Jan 27, 2021 via email

@danybenjamin
Copy link
Author

which package has avdevice?
which one should I exclude it from?

<dependency>
    <groupId>org.bytedeco</groupId>
    <artifactId>javacv-platform</artifactId>
    <version>1.5.4</version>
</dependency>

<dependency>
    <groupId>org.bytedeco</groupId>
    <artifactId>javacv</artifactId>
    <version>1.5.4</version>
</dependency>

@saudet
Copy link
Member

saudet commented Jan 28, 2021

It's part of FFmpeg, but you don't need to exclude anything. Just don't use its functions and you will be fine!

@danybenjamin
Copy link
Author

I'm not using any function other than this:

 String ffmpeg = Loader.load(org.bytedeco.ffmpeg.ffmpeg.class);

        //ffmpeg -y -i <input> -c copy <output>
        ProcessBuilder pb = new ProcessBuilder(
            ffmpeg, "-y", "-i", workingDir + "/" + file, "-c", "copy", localFilePath);
        pb.inheritIO().start().waitFor();

I am not actively calling any other function for ffmpeg

@saudet
Copy link
Member

saudet commented Jan 28, 2021

Ah, I see, the ffmpeg program links with avdevice. If you really can't install libxcb, etc, the only way around that would probably be to build your own custom version of FFmpeg with these features disabled.

@saudet
Copy link
Member

saudet commented Jan 28, 2021

Duplicate of bytedeco/javacpp-presets#593

@saudet saudet marked this as a duplicate of bytedeco/javacpp-presets#593 Jan 28, 2021
@saudet saudet closed this as completed Jan 28, 2021
@sunqb
Copy link

sunqb commented May 17, 2024

yum install alsa-lib-devel -y
yum install gtk2 -y


can reslove my problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants