There is an application that writes video from rtsp stream. The project is collected using gradle. On the local machine (kubuntu stands there) everything works well and correctly. As I send my .war to the server (CentOS stands there), I get this error

java.lang.ClassNotFoundException: org.bytedeco.javacpp.avutil $ AVFrame.

And on the local and remote machine is Tomcat. I tried to build a project on a different machine with kubuntu and there, too, everything works without errors. What is the trouble?

UDP: java.lang.NoClassDefFoundError Error

enter image description here

So add all dependencies to gradle .

enter image description here

And a tree with libraries

enter image description here

I checked which libraries go to war. really org.bytedeco.javacpp.avutil class is not there.

enter image description here

What am I doing wrong? On two kubuntu machines it works.

UPDATE

As I understood for CentOS, you need to build the library yourself. I do everything according to the instructions

Building JavaCV on CentOS 6.5

But in step 9, I get an error

  1. Local maven cache

    mvn install --projects opencv

enter image description here

UPDATE 2

I contacted the library developer. He says that this is an old library creation instruction and proposed a new one. Instructions But I get an error on the step

$ wget https://linuxsoft.cern.ch/cern/devtoolset/slc6-devtoolset.repo

$ rpm --import https://linuxsoft.cern.ch/cern/slc6X/x86_64/RPM-GPG-KEY-cern

Mistake

  • one
    Add the last error text, please. - LEQADA
  • one
    You still have the same problem with javacpp. The error clearly states that opencv2/core/types_c.h: File does not exist . - LEQADA
  • Try this: rpm -k --import https://linuxsoft.cern.ch/cern/slc6X/x86_64/RPM-GPG-KEY-cern - LEQADA

2 answers 2

java.lang.ClassNotFoundException always means the same thing: the virtual machine could not find the class called by the string representation of its full name.

In this case, Java cannot find the class org.bytedeco.javacpp.avutil$AVFrame in CLASSPATH . Make sure the appropriate library (probably JavaCPP Presets , on which JavaCV depends) got into the assembly.

  • The same assembled project. On two machines with kubuntu works like a tado. And on the server where CentOS stands, this is the error - MrGarison
  • I got it. But can you confirm that JavaCPP Presets? - Nofate
  • I can only check after the weekend. And it seems like I confused the exception with NoClassDefFoundError - MrGarison
  • NoClassDefFoundError means that at the time of compilation the class was available, but not when the application was running. - Nofate
  • I tried and collected my project on the server. gradle pulled all the libraries needed to build. But still does not work. I will check on Monday whether the class exactly falls into CLASSPATH . But there are no problems with other libraries. for example, for reports in docx I use compile('org.docx4j:docx4j:3.2.1') , and for plotting compile ('com.xeiam.xchart:xchart:2.5.0') and there are no problems with them - MrGarison

It seems to work with javacv: 1) add the OpenCV library in OS 2) add the JavaCV dependency to the maven. JavaCV works as a wrapper for the main OpenCV library.

  • and it seems OpenCV should go out of the box of Ubuntu-like systems, and I don’t understand Cent Os myself - vaszol