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

AWT native extension needs porting to JDK 24 ea #44001

Closed
Karm opened this issue Oct 21, 2024 · 5 comments · Fixed by #44092
Closed

AWT native extension needs porting to JDK 24 ea #44001

Karm opened this issue Oct 21, 2024 · 5 comments · Fixed by #44092
Assignees
Milestone

Comments

@Karm
Copy link
Member

Karm commented Oct 21, 2024

Describe the bug

AWT extension needs adjusting for the latest JDK 24 ea.

Expected behavior

AWT integration tests pass.

Actual behavior

AWT integration tests fail.

Why hasn't it been caught already?

#43997

How to Reproduce?

$ wget https://ci.modcluster.io/view/Mandrel/job/mandrel-master-linux-build-matrix/1547/JDK_RELEASE=ea,JDK_VERSION=24,LABEL=el8_aarch64/artifact/mandrel-java24-linux-aarch64-24.2.0-devc6e7912f0d0.tar.gz
....
$ export JAVA_HOME=/home/tester/karm/openjdk-17/;export GRAALVM_HOME=/home/tester/karm/mandrel-java24-24.2.0-devc6e7912f0d0;export PATH=${JAVA
_HOME}/bin:${PATH}
$ ./mvnw verify -f integration-tests/pom.xml -pl awt -Pnative

2024-10-21 12:58:31,448 ERROR [io.qua.run.Application] (main) Failed to start application: java.lang.RuntimeException: Failed to start quarkus
	at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
	at io.quarkus.runtime.Application.start(Application.java:101)
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:121)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:124)
	at io.quarkus.runner.GeneratedMain.main(Unknown Source)
Caused by: jakarta.enterprise.inject.CreationException: java.io.IOException: Problem reading font data.
	at io.quarkus.awt.it.Application_Bean.create(Unknown Source)
	at io.quarkus.awt.it.Application_Bean.create(Unknown Source)
	at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:119)
	at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:38)
	at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:35)
	at io.quarkus.arc.generator.Default_jakarta_enterprise_context_ApplicationScoped_ContextInstances.c1(Unknown Source)
	at io.quarkus.arc.generator.Default_jakarta_enterprise_context_ApplicationScoped_ContextInstances.computeIfAbsent(Unknown Source)
	at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:35)
	at io.quarkus.arc.impl.ClientProxies.getApplicationScopedDelegate(ClientProxies.java:21)
	at io.quarkus.awt.it.Application_ClientProxy.arc$delegate(Unknown Source)
	at io.quarkus.awt.it.Application_ClientProxy.arc_contextualInstance(Unknown Source)
	at io.quarkus.awt.it.Application_Observer_Synthetic_ynG-oL43sl6JgV-MAWMK4JViQwo.notify(Unknown Source)
	at io.quarkus.arc.impl.EventImpl$Notifier.notifyObservers(EventImpl.java:351)
	at io.quarkus.arc.impl.EventImpl$Notifier.notify(EventImpl.java:333)
	at io.quarkus.arc.impl.EventImpl.fire(EventImpl.java:80)
	at io.quarkus.arc.runtime.ArcRecorder.fireLifecycleEvent(ArcRecorder.java:163)
	at io.quarkus.arc.runtime.ArcRecorder.handleLifecycleEvents(ArcRecorder.java:114)
	at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy_0(Unknown Source)
	at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy(Unknown Source)
	... 7 more
Caused by: java.io.IOException: Problem reading font data.
	at java.desktop@24-beta/java.awt.Font.createFont0(Font.java:1205)
	at java.desktop@24-beta/java.awt.Font.createFont(Font.java:1076)
	at io.quarkus.awt.it.Application.init(Application.java:63)
	at io.quarkus.awt.it.Application_Bean.doCreate(Unknown Source)
	... 26 more

The problem is likely in the part where we cope with the fact that JDK code expects JAVA_HOME to be there to look up font files while native-image neither needs nor has any JAVA_HOME.

Output of uname -a or ver

Linux mandrel2 5.14.0-407.el9.aarch64 #1 SMP PREEMPT_DYNAMIC Thu Jan 11 00:18:37 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux

Output of java -version

OpenJDK Runtime Environment Temurin-17.0.13+11 (build 17.0.13+11) \n OpenJDK Runtime Environment Mandrel-24.2.0-devc6e7912f0d0 (build 24-beta+19-ea)

Quarkus version or git rev

main

Build tool (ie. output of mvnw --version or gradlew --version)

mvnw

Additional information

No response

@Karm Karm added the kind/bug Something isn't working label Oct 21, 2024
Copy link

quarkus-bot bot commented Oct 21, 2024

/cc @galderz (mandrel), @zakkak (mandrel,native-image)

@Karm Karm self-assigned this Oct 21, 2024
@melloware
Copy link
Contributor

Thanks @Karm a bunch of extensions would not be what they are without the AWT support! POI, OpenPDF, JasperReports, PrimeFaces, etc etc etc!

@jerboaa
Copy link
Contributor

jerboaa commented Oct 30, 2024

We see CI failures related to the AWT extension that look like:

2024-10-30 01:13:20,333 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (executor-thread-1) HTTP Request to /graphics?entrypoint=ImageReader failed, error id: 65b052b0-b3ec-4502-9843-fdd625349ddb-8: org.jboss.resteasy.spi.UnhandledException: java.lang.UnsupportedOperationException: Add AWT Quarkus extension to enable Java2D/ImageIO. Additional system libraries such as `freetype' and `fontconfig' might be needed.
	at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:107)
	at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:344)
	at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:205)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:452)
	at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invokePropagateNotFound$6(SynchronousDispatcher.java:275)
	at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:154)
	at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:321)
	at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:157)
	at org.jboss.resteasy.core.SynchronousDispatcher.invokePropagateNotFound(SynchronousDispatcher.java:260)
	at io.quarkus.resteasy.runtime.standalone.RequestDispatcher.service(RequestDispatcher.java:86)
	at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.dispatch(VertxRequestHandler.java:151)
	at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler$1.run(VertxRequestHandler.java:97)
	at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:627)
	at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654)
	at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594)
	at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:11)
	at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:11)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base@24-beta/java.lang.Thread.runWith(Thread.java:1589)
	at java.base@24-beta/java.lang.Thread.run(Thread.java:1576)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:832)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:808)
Caused by: java.lang.UnsupportedOperationException: Add AWT Quarkus extension to enable Java2D/ImageIO. Additional system libraries such as `freetype' and `fontconfig' might be needed.
	at java.desktop@24-beta/javax.imageio.spi.ServiceRegistry.getServiceProviders(ServiceRegistry.java:82)
	at java.desktop@24-beta/javax.imageio.ImageIO.getImageReadersByFormatName(ImageIO.java:714)
	at io.quarkus.awt.it.GraphicsResource.graphics(GraphicsResource.java:67)
	at java.base@24-beta/java.lang.reflect.Method.invoke(Method.java:573)
	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:154)
	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:118)
	at org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:560)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:452)
	at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$2(ResourceMethodInvoker.java:413)
	at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:321)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:415)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:378)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:356)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:70)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:429)
	... 20 more

See: https://github.com/graalvm/mandrel/actions/runs/11584744646/job/32253322009#step:12:1176

@Karm
Copy link
Member Author

Karm commented Oct 30, 2024

@jerboaa

Caused by: jakarta.enterprise.inject.CreationException: java.io.IOException: Problem reading font data.

That is what this #44092 PR fixes.

Add AWT Quarkus extension to enable Java2D/ImageIO. Additional system libraries such as `freetype' and `fontconfig' might be needed.    

Are expected messages for quarkus-integration-test-no-awt test, note the no prefix.

@Karm
Copy link
Member Author

Karm commented Oct 30, 2024

@jerboaa You began to see this thanks to #43997 being fixed and tests running again...

@quarkus-bot quarkus-bot bot added this to the 3.17 - main milestone Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants