JavaCV RedHat Linux 6.6 x64 NoClassDefFound:无法初始化类org.bytedeco.javacpp.avutil

时间:2015-11-28 19:02:07

标签: java ffmpeg javacv

我想在Linux计算机上运行简单的.flv.mp4转换

直到现在我还包括以下依赖项,它在Ubuntu 12.x和CentOS上工作正常

<dependency>
   <groupId>org.bytedeco.javacpp-presets</groupId>
   <artifactId>ffmpeg</artifactId>
   <version>2.7.1-1.0</version>
   <classifier>linux-x86_64</classifier>
</dependency>

Red Hat uname -a

x86_64 #1 SMP Tue Sep 16 01:56:35 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux

Red Hat lsb_release -a
LSB Version:    :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: RedHatEnterpriseServer
Description:    Red Hat Enterprise Linux Server release 6.6 (Santiago)
Release:        6.6
Codename:       Santiago

CentOS uname -a

.x86_64 #1 SMP Tue Nov 3 19:10:07 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

但是在RedHat Linux中尝试时,我会遇到以下异常

应用程序启动失败

java.lang.NoClassDefFoundError: Could not initialize class org.bytedeco.javacpp.avutil
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:270)
    at org.bytedeco.javacpp.Loader.load(Loader.java:390)
    at org.bytedeco.javacpp.Loader.load(Loader.java:358)
    at org.bytedeco.javacpp.avformat$AVFormatContext.<clinit>(avformat.java:2539)
    at org.bytedeco.javacv.FFmpegFrameGrabber.startUnsafe(FFmpegFrameGrabber.java:383)
    at org.bytedeco.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.java:377)
    at com.example.Application.convert(Application.java:53)
    at com.example.Application.run(Application.java:103)
    at org.springframework.boot.SpringApplication.runCommandLineRunners(SpringApplication.java:674)
    at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:693)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:322)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:969)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:958)
    at com.example.Application.main(Application.java:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
    at java.lang.Thread.run(Thread.java:745)

我尝试使用32位版本:

<dependency>
   <groupId>org.bytedeco.javacpp-presets</groupId>
   <artifactId>ffmpeg</artifactId>
   <version>2.7.1-1.0</version>
   <classifier>linux-x86</classifier>
</dependency>

同样的结果。

然后我尝试了简单

   org.bytedeco    javacv    1.0

mvn package -Dplatform.dependencies=true所以我得到了所有依赖项。

还是一样。任何人都知道我做错了什么?

1 个答案:

答案 0 :(得分:2)

avutil类在您使用的版本中不可用 使用2.8.1-1.1版本。 <version>2.8.1-1.1</version>