Problem
Create a JavaFX maven project using IDEA 2024.3, try to run the main application entry HelloApplication with JDK 23, then get this exception instead:
Dec 27, 2024 8:44:26 AM com.sun.glass.ui.mac.MacApplication lambda$waitForReactivation$6
WARNING: Timeout while waiting for app reactivation
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '0x0 is an invalid NSTrackingRectTag. Common possible reasons for this are: 1. already removed this trackingRectTag, 2. Truncated the NSTrackingRectTag to 32bit at some point.'
*** First throw call stack:
(
0 CoreFoundation 0x0000000191342e80 __exceptionPreprocess + 176
1 libobjc.A.dylib 0x0000000190e2acd8 objc_exception_throw + 88
2 Foundation 0x0000000192551978 -[NSCalendarDate initWithCoder:] + 0
3 AppKit 0x000000019569ab80 -[_NSTrackingAreaAKViewHelper removeTrackingRect:] + 200
4 libglass.dylib 0x000000010394af7c Java_com_sun_glass_ui_mac_MacApplication__1getMacKey + 3456
5 libglass.dylib 0x0000000103950074 RemoteLayerHostRemoteIdInLocal + 3620
6 AppKit 0x0000000194e71db8 -[NSView setFrame:] + 304
7 libglass.dylib 0x00000001039500d4 RemoteLayerHostRemoteIdInLocal + 3716
8 AppKit 0x0000000194e7e908 -[NSView resizeWithOldSuperviewSize:] + 488
9 AppKit 0x0000000194e7e294 -[NSView resizeSubviewsWithOldSize:] + 360
10 AppKit 0x0000000194e645c0 -[NSView setFrameSize:] + 948
11 AppKit 0x0000000194e71db8 -[NSView setFrame:] + 304
12 AppKit 0x0000000194e7e908 -[NSView resizeWithOldSuperviewSize:] + 488
13 AppKit 0x0000000194e7e294 -[NSView resizeSubviewsWithOldSize:] + 360
14 AppKit 0x0000000194e645c0 -[NSView setFrameSize:] + 948
15 AppKit 0x0000000194e7d3ec -[NSThemeFrame setFrameSize:] + 244
16 AppKit 0x0000000194e7cd50 -[NSWindow _oldPlaceWindow:fromServer:] + 532
17 AppKit 0x0000000194e7c204 -[NSWindow _setFrameCommon:display:fromServer:] + 2032
18 libglass.dylib 0x000000010395b0c4 Java_com_sun_glass_ui_mac_MacWindow__1setBounds2 + 416
19 ??? 0x0000000114b64fd4 0x0 + 4642459604
...
42 ??? 0x0000000114b616b0 0x0 + 4642444976
43 ??? 0x0000000114b5c114 0x0 + 4642423060
44 libjvm.dylib 0x0000000104398764 _ZN9JavaCalls11call_helperEP9JavaValueRK12methodHandleP17JavaCallArgumentsP10JavaThread + 984
45 libjvm.dylib 0x000000010440975c _ZL20jni_invoke_nonstaticP7JNIEnv_P9JavaValueP8_jobject11JNICallTypeP10_jmethodIDP18JNI_ArgumentPusherP10JavaThread + 992
46 libjvm.dylib 0x000000010440e184 jni_CallVoidMethod + 284
47 libglass.dylib 0x0000000103946998 JNI_OnLoad + 204
48 Foundation 0x00000001924bcf80 __NSThreadPerformPerform + 264
49 CoreFoundation 0x00000001912d0894 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
50 CoreFoundation 0x00000001912d0828 __CFRunLoopDoSource0 + 176
51 CoreFoundation 0x00000001912d058c __CFRunLoopDoSources0 + 244
52 CoreFoundation 0x00000001912cf128 __CFRunLoopRun + 840
53 CoreFoundation 0x00000001912ce724 CFRunLoopRunSpecific + 588
54 HIToolbox 0x000000019c826530 RunCurrentEventLoopInMode + 292
55 HIToolbox 0x000000019c82c348 ReceiveNextEventCommon + 676
56 HIToolbox 0x000000019c82c508 _BlockUntilNextEventMatchingListInModeWithFilter + 76
57 AppKit 0x0000000194e39034 _DPSNextEvent + 660
58 AppKit 0x000000019579d2d4 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 688
59 AppKit 0x0000000194e2c060 -[NSApplication run] + 480
60 libglass.dylib 0x0000000103948b20 JNI_OnLoad + 8788
61 Foundation 0x00000001924bcf80 __NSThreadPerformPerform + 264
62 CoreFoundation 0x00000001912d0894 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
63 CoreFoundation 0x00000001912d0828 __CFRunLoopDoSource0 + 176
64 CoreFoundation 0x00000001912d058c __CFRunLoopDoSources0 + 244
65 CoreFoundation 0x00000001912cf128 __CFRunLoopRun + 840
66 CoreFoundation 0x00000001912ce724 CFRunLoopRunSpecific + 588
67 libjli.dylib 0x0000000102c94e84 CreateExecutionEnvironment + 404
68 libjli.dylib 0x0000000102c90984 JLI_Launch + 1152
69 java 0x0000000102c4bbb0 main + 404
70 dyld 0x0000000190e68274 start + 2840
)
libc++abi: terminating due to uncaught exception of type NSException
pom.xml 's dependencies section:
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>17.0.6</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>17.0.6</version>
</dependency>
<dependency>
<groupId>org.controlsfx</groupId>
<artifactId>controlsfx</artifactId>
<version>11.2.1</version>
</dependency>
</dependencies>
Cause
This is because each JavaFX version binds to a JDK version range, for example, https://github.com/openjdk/jfx/blob/master/doc-files/release-notes-23.md , usually this will be a JavaFX bug instead of a JDK bug.
Resolution
- Use JDK 17 to run the project.
- Or upgrade your JavaFX dependencies version to the latest in
pom.xmlthen Reload All Maven Projects in the Maven tool window.
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>24-ea+19</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>24-ea+19</version>
</dependency>
<dependency>
<groupId>org.controlsfx</groupId>
<artifactId>controlsfx</artifactId>
<version>11.2.1</version>
</dependency>
</dependencies>
Below is a full example pom.xml file of JDK 23 + JavaFX 23:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>javafx_23</artifactId>
<version>1.0-SNAPSHOT</version>
<name>javafx_23</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.version>5.10.2</junit.version>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>24-ea+19</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>24-ea+19</version>
</dependency>
<dependency>
<groupId>org.controlsfx</groupId>
<artifactId>controlsfx</artifactId>
<version>11.2.1</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<executions>
<execution>
<!-- Default configuration for running with: mvn clean javafx:run -->
<id>default-cli</id>
<configuration>
<mainClass>org.example.javafx_23/org.example.javafx_23.HelloApplication</mainClass>
<launcher>app</launcher>
<jlinkZipName>app</jlinkZipName>
<jlinkImageName>app</jlinkImageName>
<noManPages>true</noManPages>
<stripDebug>true</stripDebug>
<noHeaderFiles>true</noHeaderFiles>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Refer: https://github.com/adoptium/adoptium-support/issues/1043 https://stackoverflow.com/questions/53780246/assertion-failure-and-crash-on-javafx-application-macos
Comments
0 comments
Please sign in to leave a comment.