java.lang.NoClassDefFoundError: javafx/embed/swing/JFXPanel
Problem:
When you preview or export big data charts, the dashboard page is inaccessible, and the error message is displayed as follows.
Handler processing failed, nested exception is java.lang.NoClassDefFoundError: javafx/embed/swing/JFXPanel
Error Screenshot
View the background logs (corresponding to the web server, such as %tomcat%/logs/catalina.log), and you can see the detailed log error.
Cause
Many functions of FineBI V5.1 use JavaFX, but some OpenJDK do not include OpenJFX. If FineBI V5.1 is deployed with a web container under the OpenJDK that does not include JavaFX, the big data function and export function of the chart will be influenced and cannot be used, reporting the above error.
Solution
This section takes the example of Red Hat build of OpenJDK in the Windows system. You can follow it to enable the OpenJFX function in OpenJDK to add the OpenJFX function to OpenJDK without OpenJFX. Before proceeding, ensure that FineBI is closed.
The following table describes some content types.
1. Red Hat build of OpenJDK is a common OpenJDK, and it does not contain OpenJFX. Download Red Hat build of OpenJDK on this page, install it, and configure the environment variables.
2. Download OpenJFX. Download the following ZIP files according to your operating system (Windows, Linux, or macOS).
System | OpenJFX |
Windows | |
Linux | |
macOS |
3. Unzip the downloaded OpenJFX file. The directory structure in the Windows system is as follows.
4. After extracting OpenJFX, copy the files from each directory and paste them to the directory respectively where OpenJDK is installed. For example, the files in the bin directory are javafxpackager.exe and javapackager.exe, as shown in the following figure.
Copy and paste them to bin in the OpenJDK installation directory, as shown in the following figure.
5. Similarly, copy and paste all the files from the jre and lib directories to the corresponding directories in OpenJDK. After you complete the operation, this OpenJDK will include OpenJFX.
6. Start FineBI and view the dashboard that reported an error before, and the dashboard is displayed normally.