java errors that don't occur on Windows, but do in Ubuntu
NickName:EricO Ask DateTime:2021-07-08T03:44:13

java errors that don't occur on Windows, but do in Ubuntu

My company is moving to a target architecture that uses Ubuntu; we are migrating java applications from Windows. Our first application is running into this error on Ubuntu (runs fine on Win):

Error: A JNI error has occurred, please check your installation and try again
 Exception in thread "main" java.lang.NoClassDefFoundError: > org/apache/cxf/jaxrs/lifecycle/ResourceProvider
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
    at java.lang.Class.getMethod0(Class.java:3018)
    at java.lang.Class.getMethod(Class.java:1784)
    at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:650)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:632)
 Caused by: java.lang.ClassNotFoundException: org.apache.cxf.jaxrs.lifecycle.ResourceProvider
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    ... 7 more

Both environments are running java 1.8 jdk/jre (NOT OpenJDK on Ubuntu). We use an internal CodeCloud for git and everything is updated in both Win and Ubuntu. Maven shows all the dependencies have been met; I can even expand the maven classes and can see the ResourceProvider class.

I have read about versioning problems with Spring and CXF, but that refers to a version of CXF older than we are running, and I don't see anything that indicates why the code would run in the Windows environment, but not the 'nix environment. Also a lot of talk about WebLogic, where we are using embedded Jetty with CXF for the server side. This is a standalone console application that is not using a container, if that even matters.

Any thoughts or tips would be appreciated.

Edit: This error is occurring using 'run as java' in eclipse. Debugger doesn't even hit the first line of code in main.

enter image description here

Copyright Notice:Content Author:「EricO」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/68292183/java-errors-that-dont-occur-on-windows-but-do-in-ubuntu

More about “java errors that don't occur on Windows, but do in Ubuntu” related questions

java RuntimeExceptions and Errors

According to "Sams Teach Yourself Java in 21 Days" book "Unchecked exceptions, also called runtime exceptions..." Under that fact,Error are also runtime exception as they are unchecked exceptio...

Show Detail

Java : javax swing and awt errors

So, i have a code in Java that is says its successfull but i get errors that isn't even from my project. I can't do anything about it though.... I've tried importing only the needed parts and i sti...

Show Detail

Display java application errors in terminal/console

As you know when we building applications we get Errors/Exceptions such as NullPointerException etc. on IDE Console (I'm using IntelliJ IDEA). I want to display those errors simultaneously in my Mac

Show Detail

Mockito Java 8 compilation errors

I just moved to Java 8 and I am getting some compilation errors that I don't really understand how to overcome. The following code does not compile: Mockito.when( jdbcTemplate.query(Mockito.eq(

Show Detail

java errors in dr java

I added import java.util.ArrayList; (per suggestions here) to my code and then I got 2 different kinds of errors. They are: error: the type of the expression must be an array type but it resolved to

Show Detail

Java Errors and Exceptions

I am currently studying java Exception handling and I'm confused with Exceptions and Errors. I want to know to which category of Throwable class (Exception or Error/Throwable class) does following ...

Show Detail

Errors in Java saving into a File

Currently I am working on something but I don't know if its possible or not. My problem is that can i save all errors that is displayed in the console and saving it into a text file.? Also, is it...

Show Detail

How to debug Java memory errors?

There is a Java Struts application running on Tomcat, that have some memory errors. Sometimes it becomes slowly and hoard all of the memory of Tomcat, until it crashes. I know how to find and repa...

Show Detail

Java Errors on HttpURLConnection

I wrote something similar to this and it was giving me an error. So I found this online and it still gives me an error. What Am I not doing correct ? /* package whatever; // don't place package na...

Show Detail

Cannot create R.java b/c project has errors...errors result from lack of R.java

edit: This is an Android project. My problem arose when I added a new .wav file to my 'raw' folder. I seem to have gotten into an endless loop in Eclipse. I deleted my R.java file from my projec...

Show Detail