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

Cloud Deployment error - Could not initialize class org.bytedeco.javacpp.opencv_highgui #1490

Closed
josephincture opened this issue Aug 9, 2020 · 11 comments

Comments

@josephincture
Copy link

I had added Loader.load(opencv_java.class);

to my source code and build the .war file for my web app. But the deployment is throwing the following error while loading the class..

DispatcherServlet:1093 - Failed to complete request: org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.bytedeco.javacpp.opencv_highgui

But the web app works fine when it is run on a local server..

kindly help me resolve the issue ASAP..(Deployment pending..PS)

@saudet
Copy link
Member

saudet commented Aug 9, 2020 via email

@josephincture
Copy link
Author

josephincture commented Aug 10, 2020

Am I supposed to have all these dependancies...

org.bytedeco.javacpp-presets » opencv

org.bytedeco.javacpp-presets » ffmpeg

org.bytedeco » javacv

org.bytedeco » javacpp

Previously I had only

org.bytedeco.javacpp-presets opencv-platform 4.0.1-1.4.4

I'm using this only for a facial recognition service using Fisherfaces...

Can you tell me which are the ones required for Loader.load(opencv_java.class) for the project to build without taking up space...

@josephincture
Copy link
Author

This is the detailed log....

2020-08-10T03:12:15.681+0000 [APP/PROC/WEB/0] ERR 2020-08-10 03:12:15 DEBUG DispatcherServlet:1093 - Failed to complete request: org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.bytedeco.javacpp.opencv_highgui
2020-08-10T03:12:15.682+0000 [APP/PROC/WEB/0] OUT [CONTAINER] tainerBase.[Catalina].[localhost].[/].[dispatcher] SEVERE Servlet.service() for servlet [dispatcher] in context with path [] threw exception [Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.bytedeco.javacpp.opencv_highgui] with root cause
2020-08-10T03:12:15.682+0000 [APP/PROC/WEB/0] OUT java.lang.NoClassDefFoundError: Could not initialize class org.bytedeco.javacpp.opencv_highgui
2020-08-10T03:12:15.682+0000 [APP/PROC/WEB/0] OUT at java.lang.Class.forName0(Native Method)
2020-08-10T03:12:15.682+0000 [APP/PROC/WEB/0] OUT at java.lang.Class.forName(Class.java:348)
2020-08-10T03:12:15.682+0000 [APP/PROC/WEB/0] OUT at org.bytedeco.javacpp.Loader.load(Loader.java:1176)
2020-08-10T03:12:15.682+0000 [APP/PROC/WEB/0] OUT at org.bytedeco.javacpp.Loader.load(Loader.java:1125)

@saudet
Copy link
Member

saudet commented Aug 10, 2020

You can still just include opencv-platform, that works.

@josephincture
Copy link
Author

But Still the deployment is throwing error...

@saudet
Copy link
Member

saudet commented Aug 10, 2020

You'll need to find where the first exception occurs

@josephincture
Copy link
Author

josephincture commented Aug 10, 2020

This is the log...

DispatcherServlet:1093 - Failed to complete request: org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.bytedeco.javacpp.opencv_highgui
2020-08-10T08:57:56.394+0000 [APP/PROC/WEB/0] OUT [CONTAINER] tainerBase.[Catalina].[localhost].[/].[dispatcher] SEVERE Servlet.service() for servlet [dispatcher] in context with path [] threw exception [Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.bytedeco.javacpp.opencv_highgui] with root cause
2020-08-10T08:57:56.394+0000 [APP/PROC/WEB/0] OUT java.lang.NoClassDefFoundError: Could not initialize class org.bytedeco.javacpp.opencv_highgui
2020-08-10T08:57:56.394+0000 [APP/PROC/WEB/0] OUT at java.lang.Class.forName0(Native Method)
2020-08-10T08:57:56.394+0000 [APP/PROC/WEB/0] OUT at java.lang.Class.forName(Class.java:348)
2020-08-10T08:57:56.394+0000 [APP/PROC/WEB/0] OUT at org.bytedeco.javacpp.Loader.load(Loader.java:1176)
2020-08-10T08:57:56.394+0000 [APP/PROC/WEB/0] OUT at org.bytedeco.javacpp.Loader.load(Loader.java:1125)

My pom has only...

org.bytedeco.javacpp-presets opencv-platform 4.0.1-1.4.4

@saudet
Copy link
Member

saudet commented Aug 10, 2020 via email

@saudet
Copy link
Member

saudet commented Aug 19, 2020

BTW, what is usually missing for cloud deployment is an installation of GTK.
See, for example, issues #1415 and bytedeco/javacpp-presets#593.

@saudet
Copy link
Member

saudet commented Nov 8, 2021

I'm assuming that installing GTK solved this issue, but let me know if it doesn't. Thanks!

@saudet saudet closed this as completed Nov 8, 2021
@saudet
Copy link
Member

saudet commented Nov 8, 2021

Duplicate of bytedeco/javacpp-presets#593

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

2 participants