Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » java.lang.ExceptionInInitializerError at javafx.scene.web.WebEngine.<clinit>(WebEngine.java:3
java.lang.ExceptionInInitializerError at javafx.scene.web.WebEngine.<clinit>(WebEngine.java:3 [message #1836432] Mon, 04 January 2021 09:47 Go to next message
smaoui asma is currently offline smaoui asmaFriend
Messages: 50
Registered: July 2009
Location: Paris Saclay, France
Member
Hello,

First of all Happy new Year :)

I am using javaFx in an Eclipse plugin already using swt.

My update site (manually built) works fine, however in the RCP built by maven I have this error

java.lang.ExceptionInInitializerError
at javafx.scene.web.WebEngine.<clinit>(WebEngine.java:317)
at javafx.scene.web.WebView.<init>(WebView.java:273)
at org.eclipse.papyrus.gamification.view.MainView.createFxScene(MainView.java:57)
at org.eclipse.fx.ui.workbench3.FXViewPart.createPartControl(FXViewPart.java:29)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.createPartControl(CompatibilityPart.java:154)....
Caused by: java.lang.RuntimeException: Internal graphics not initialized yet
at com.sun.glass.ui.Screen.getScreens(Screen.java:70)
at com.sun.javafx.webkit.prism.PrismGraphicsManager.<clinit>(PrismGraphicsManager.java:47)

Here is the line that raise the execption :

public class MainView extends FXViewPart {

private WebView browser;
private ViewManager viewManager;

/**
* @see org.eclipse.fx.ui.workbench3.FXViewPart#createFxScene()
*
* @return
*/
@Override
protected Scene createFxScene() {

browser = new WebView();
...
}

Any Idea how to solve this issue ?

I am using java8 with this version of efx 3.6.0.201907240103 org.eclipse.fx.ui.workbench3

I followed this example to build my RCP product https://github.com/fipro78/e4-cookbook-basic-recipe and I already added jfxswt jar file to the pluginmanagment in my root pom

<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<encoding>UTF-8</encoding>
<extraClasspathElements>
<extraClasspathElement>
<groupId>com.oracle</groupId>
<artifactId>javafx</artifactId>
<version>8.0.0-SNAPSHOT</version>
<systemPath>C:/Program Files/Java/jre1.8.0_271/jre/lib/jfxswt.jar</systemPath>
<scope>system</scope>
</extraClasspathElement>
</extraClasspathElements>
</configuration>
</plugin>

Thank you very much.
Re: java.lang.ExceptionInInitializerError at javafx.scene.web.WebEngine.<clinit>(WebEngine.ja [message #1836593 is a reply to message #1836432] Fri, 08 January 2021 09:42 Go to previous messageGo to next message
smaoui asma is currently offline smaoui asmaFriend
Messages: 50
Registered: July 2009
Location: Paris Saclay, France
Member
Hello,
I progress a little bit trying to solve this issue :
When I run my RCP with -console flag a long with debug I get this
osgi> FXClassLoader#getSWTClassloader - Fetching SWT-Classloader
FXClassLoader#getSWTClassloader - Done SWT-Classloader
FXClassLoader#createJREBundledClassloader - Started
FXClassLoader#createJREBundledClassloader - Assumed location (Java 8/Java 7): C:\Program Files\Java\jre1.8.0_271\lib\ext\jfxrt.jar
FXClassLoader#createJREBundledClassloader - SWT is available use different loading strategy
FXClassLoader#createJREBundledClassloader - Searching for SWT-FX integration at C:\Program Files\Java\jre1.8.0_271\lib\jfxswt.jar
FXClassLoader#createJREBundledClassloader - Found SWT/FX
FXClassLoader#createJREBundledClassloader - Delegate to system classloader
FXClassLoader.SWTFXClassloader#init - Primary Loader sun.misc.Launcher$ExtClassLoader@4844930a
FXClassLoader.SWTFXClassloader#init - Lastresort Loader org.eclipse.osgi.internal.loader.EquinoxClassLoader@6c742b84[org.eclipse.swt:3.114.100.v20200604-0951(id=803)]
FXClassLoader#createJREBundledClassloader - Ended

this means that the efx hook is used non ?

But when I try to open my FXViewPart I got this stack in the console

FXClassLoader.SWTFXClassloader#findClass - Loading org.eclipse.swt.widgets.Canvas with primary
FXClassLoader.SWTFXClassloader#findClass - ClassNotFoundException thrown
FXClassLoader.SWTFXClassloader#findClass - Loading org.eclipse.swt.widgets.Canvas with last resort
FXClassLoader.SWTFXClassloader#findClass - Result org.eclipse.swt.widgets.Canvas class org.eclipse.swt.widgets.Canvas
FXClassLoader.SWTFXClassloader#findClass - Loading org.eclipse.swt.widgets.Composite with primary
FXClassLoader.SWTFXClassloader#findClass - ClassNotFoundException thrown
FXClassLoader.SWTFXClassloader#findClass - Loading org.eclipse.swt.widgets.Composite with last resort
FXClassLoader.SWTFXClassloader#findClass - Result org.eclipse.swt.widgets.Composite class org.eclipse.swt.widgets.Composite
FXClassLoader.SWTFXClassloader#findClass - Loading org.eclipse.swt.widgets.Control with primary
FXClassLoader.SWTFXClassloader#findClass - ClassNotFoundException thrown
FXClassLoader.SWTFXClassloader#findClass - Loading org.eclipse.swt.widgets.Control with last resort
FXClassLoader.SWTFXClassloader#findClass - Result org.eclipse.swt.widgets.Control class org.eclipse.swt.widgets.Control
FXClassLoader.SWTFXClassloader#findClass - Loading org.eclipse.swt.graphics.Device with primary
FXClassLoader.SWTFXClassloader#findClass - ClassNotFoundException thrown
FXClassLoader.SWTFXClassloader#findClass - Loading org.eclipse.swt.graphics.Device with last

it seems that the FXCLassLoader did not manage to find all Swt widgets ?

Any idea ?

Thanks
Re: java.lang.ExceptionInInitializerError at javafx.scene.web.WebEngine.<clinit>(WebEngine.ja [message #1836742 is a reply to message #1836593] Wed, 13 January 2021 09:36 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
no as the output shows it is loading the those classes with the last-resort classloader - I really don't know why JavaFX should not be initialized as FXCanvas is supposed to initialize the JavaFX platform.
Re: java.lang.ExceptionInInitializerError at javafx.scene.web.WebEngine.<clinit>(WebEngine.ja [message #1836911 is a reply to message #1836742] Mon, 18 January 2021 14:25 Go to previous message
smaoui asma is currently offline smaoui asmaFriend
Messages: 50
Registered: July 2009
Location: Paris Saclay, France
Member
Thank you for the reply.

Yes, every thing is well loaded as you said :)

I found my error: before building with maven, I manually added the jfxswt.jar to the build.properties file.

I forgot to remove it when building with maven !

So every thing works as expected now, when removing this dependency in the build.properties.


Best Regards,
Previous Topic:How to compile a Java FX project
Next Topic:M1+Q or M1+Z don't call respective handler
Goto Forum:
  


Current Time: Wed Dec 11 17:00:11 GMT 2024

Powered by FUDForum. Page generated in 0.03106 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top