-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Implement graphics for JAXB #12393
Comments
Removing the substitution isn't enough. The code would still fail with an error like:
|
@gastaldi I didn't try to remove the substitution. I can try to poke into it, to see whether it is possible to make this work ith camel-quarkus extension. I thought, that to fix this, there would be more work (not only to remove substitution). |
@JiriOndrusek removing the substitution is only the tip of the iceberg AFAIK. Maybe a solution is to add substitutions in FOP to not depend on Java2D processing instead. |
@gastaldi Yeas I agree that this is a working solution (see https://github.com/apache/camel-quarkus/blob/master/extensions/fop/runtime/src/main/java/org/apache/camel/quarkus/component/fop/PDFRendererOptionsConfigSubstitution.java#L29) But I was wondering if this "not implemented" part of quarkus will be implemented in future (and I wanted to show interest for this missing feature) |
If GraalVM supports the Java 2D classes I don't see why it wouldn't. I think it all depends on that |
@gastaldi I've found this document: https://www.graalvm.org/reference-manual/r/JavaInteroperability/#java-graphics-interoperability From my PoV it seems, that graalVM supports awt. (mainly the second paragraph) Is there anything I could do, to "move" this issue closer to making it work? |
I found that same document too yesterday, but then realized it talks about the It says that:
So I am not sure what we could do besides having a Substitution class for the parts where the Java2D Graphics API is required |
Graal 21.0.0 now support AWT and ImageIO oracle/graal#1163 and https://www.graalvm.org/release-notes/21_0/. These are issues I've been tracking for a long time. Is there any way to disable the current quarkus substitution until quarkus has a fix? |
/cc @zakkak for the 21 upgrade |
Could someone please point me to a reproducer? We should probably add an integration test for this as well. |
@zakkak there is no special reproducer created for this issue. Simulation could be done by execution of test https://github.com/apache/camel-quarkus/tree/master/integration-tests/fop
|
@JiriOndrusek I am not able to reproduce with:
|
@zakkak I'll verify it on Monday and let you know |
Bumping this issue. If you'd like a reproducer that's not from the camel project, the original graal issue on ImageIO should work - it also has lots of other context oracle/graal#1163 |
I am looking for something resulting in the exception mentioned in the description of this issue so that I could try to remove the substitution and trace the issue through Quarkus. AFAIK the reproducer in oracle/graal#1163 is working with GraalVM 21.0 so I want to see what's needed on the Quarkus side. |
@zakkak I'm sorry for the delay.
After execution I can see an error (executed as mvn clean verify -Pnative -f integration-tests/fop/):
|
Apologies I was not more clear @zakkak - you can wrap that example in any quarkus executable extension like Resteasy and it will reproduce if you build native because the substitute is in quarkus core. Sound like @JiriOndrusek has something you can run now, but if youd' like another example, let me know. |
Thanks @JiriOndrusek Removing the LCMS Substitutions and running with GraalVM CE 20.1 results in http://paste.debian.net/plain/1183561 which AFAICS is not triggered by the graphics part of the test (or some exception/error gets hidden). Note that I am not getting the exception reported here |
@zakkak This issue seems to have stalled out. Should I open a new with a specific reproducer just for quarkus core? Are you open a PR just removing the substitution? I really would like to use quarkus native with ImageIO and this seems like the last hurdle in this very long journey. |
@sherl0cks a minimal reproducer would probably help. However, keep in mind that ImageIO appears to be causing some issues (see #14972 for more details), so it is not yet clear how to proceed with it. |
Apart from the image size, the linking with the graph libraries has also caused some regressions in Mandrel. We are still investigating how to make ImageIO/AWT support an opt-in feature and handle it properly. Your reproducer might help in bringing in some initial support before polishing out the opt in part, but that's not my call to make :) |
Simple project from https://code.quarkus.io/ with Resteasy https://github.com/sherl0cks/quarkus-imageio-reproducer @zakkak ok this was very odd. I got it to work!?!? I need to go test quarkus 1.11.3 in my production app now, but at least this reproducer shows a working example. I left comments about one issue which I think is just my limited knowledge of graal. Perhaps you can point me in the right direction? |
@zakkak I was able to reproduce my original issue. It appears that the substitution is not a problem for jpg or png, but it is for tiff. Commit pushed with a new test that should make this clear. |
By you got it to work you mean that you got it compile right? When I run
If I understand correctly the issue is that you don't know how to generate the proper configuration for your Quarkus app to make it work with ImageIO. Unfortunately this is not yet implemented (see #13567) and you would need to run the steps manually to get it to work. However, the exception I posted above indicates that this is not a configuration issue (yet), Quarkus first needs to remove some substitutions to get ImageIO to work.
Nice, it looks like the jpg issue got fixed by oracle/graal#3032 and we need a similar patch for |
I think you got it. To summarize, I have 3 test cases that cover the current state of native / imageio:
|
Well I first applied the following diff to get rid of the exception I mentioned earlier: diff --git a/quarkus-logo.jpg b/quarkus-logo.jpg
index 637dd33..e69de29 100644
Binary files a/quarkus-logo.jpg and b/quarkus-logo.jpg differ
diff --git a/src/main/java/org/acme/GreetingResource.java b/src/main/java/org/acme/GreetingResource.java
index 2871e6f..242431f 100644
--- a/src/main/java/org/acme/GreetingResource.java
+++ b/src/main/java/org/acme/GreetingResource.java
@@ -24,10 +24,10 @@ public class GreetingResource {
@Produces(MediaType.TEXT_PLAIN)
public String hello() throws IOException {
BufferedImage bufferedImage = ImageIO.read(Thread.currentThread().getContextClassLoader().getResourceAsStream("quarkus-logo.png"));
- Graphics graphics = bufferedImage.getGraphics();
- graphics.setColor(Color.MAGENTA);
- graphics.drawString("test", 100, 100);
- graphics.dispose();
+ // Graphics graphics = bufferedImage.getGraphics();
+ // graphics.setColor(Color.MAGENTA);
+ // graphics.drawString("test", 100, 100);
+ // graphics.dispose();
File newFile = new File("quarkus-logo.jpg");
ImageIO.write(bufferedImage, "jpg", newFile);
BufferedImage bufferedImage2 = ImageIO.read(newFile);
@@ -59,4 +59,4 @@ public class GreetingResource {
}
-}
\ No newline at end of file
+} Then I:
So to summarize, it looks like you won't be able to get it to work even if you apply the configuration steps manually. |
Bummer. Thanks for testing. |
Oh I forgot to reply to this. Yes, by all means :) |
Looks easier said than done - was hoping it was a 1 liner but it looks like it needs a lot more than that. I will look closer. |
I was playing again with https://github.com/rsvoboda/rsvoboda-playground/tree/master/jfreesvg/jfreesvg-quarkus and GraalVM 201.0 to see how graphics support works in this version. I played with Quarkus master with removed Java2DSubstitutions.java and basically followed the flow that @zakkak described
And I received this error:
Did some search across oracle/graal issues and awt related work doesn't seem to be the priority. |
@zakkak I just added a new commit to my reproducer that leads to the below link error during the build. Wonder if this is instructive?
|
Hi @sherl0cks, I suspect this is an upstream GraalVM issue. |
Would the new AWT extension be useful in this case? |
+1 |
Description
I've implemented camel-quarkus extension for FOP (https://github.com/apache/camel-quarkus/tree/master/extensions/fop2).
I ran into following error using native-image:
I've issued bug for graal VM (oracle/graal#2850), but then I was corrected, that issue is not caused by graal VM but by quarkus.
Disabled feature could be seen here - https://github.com/quarkusio/quarkus/pull/3246/files#diff-0e389a06405b679615dee1750de18d4eR15
Would it be possible to implement this feature?
Steps to simulate the missing feature
You can use integration test in camel-quarkus fop extension - https://github.com/apache/camel-quarkus/blob/master/integration-tests/fop/src/test/java/org/apache/camel/quarkus/component/fop/it/FopTest.java
To make test fail with the reported
UnsupportdOperationException
, you have to change value in substitution tofalse
(https://github.com/apache/camel-quarkus/blob/master/extensions/fop/runtime/src/main/java/org/apache/camel/quarkus/component/fop/PDFRendererOptionsConfigSubstitution.java#L29)The text was updated successfully, but these errors were encountered: