-
Notifications
You must be signed in to change notification settings - Fork 3k
Fix JAXB substitutions for native-image #24768
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
Conversation
|
Hi @Sanne and @yrodiere, I see from the gitlogs that you have done some work on The issue is that with 22.1 Quarkus now returns runtime errors like the following: I started by making sure the reported Proxy Classes mentioned in the errors are properly registered, but stopped once I saw that new Proxy classes (not referenced till now) are needed to be registered. Do you have any recommendation on how to find all the Proxy classes that are needed to be registered and how to decide what would be the best place to register them? (i.e. how to decide if I should register them in the hibernate-orm extension or jaxb or elsewhere?) |
|
Hi @zakkak, So... do I understand well that some annotations used not to be included in the runtime image, and therefore no proxy was ever being created for those annotations? And now that annotations are present in the runtime image, the annotation proxies do get instantiated? I'm not sure trying to add annotation proxies is a good idea... Mainly because Quarkus used to work before, without ever needing these annotations or instantiating these proxies, so evidently they were not necessary. In the case of Hibernate ORM, we add annotation proxies because we know they are necessary at runtime. So, it's different. I can think of two other approaches, feel free to tell me if they are not viable:
As to where the fixes should be... I'd say that depends on what instantiates the annotation proxies. If it's jaxb, the fix should be in the jaxb extension for example. Do you have stack traces? |
|
I'm not sure the problems you are seeing are actually being caused by Hibernate. From the look of the errors, it seems reminiscent of those situations in which GraalVM gets confused regarding the callpath and reports a call path which in fact isn't reachable in practice. |
@yrodiere Yes, that's my understanding as well!
I agree with you. The argument behind this decision is: """ Please feel free to argue against that in oracle/graal#4414
I am not sure whether this will work. I will need to check. Thanks for the suggestion!
Well I can't think of any other way than using substitutions so it looks the same to option 1 :)
Yes I do, I'll come back if I need more help on that front. Thanks again
@Sanne I agree that these call paths are not reachable, the thing is that GraalVM >= 22.1 now includes all the annotations so that even if something becomes reachable it will be able to support it without requiring reconfiguration, at least according to oracle/graal#4414 (comment). Regarding the allow-incomplete-classpath this is indeed the new default, but Quarkus |
Well I don't necessarily disagree with that change. In a nutshell:
|
|
@zakkak but my objection isn't about reachability, but about impossible callstacks. For example, looking into the stacktraces on oracle/graal#4414 there's none actually involving So that's why I wonder if this actually relates to Hibernate; yet is seems a common problem of integration tests which also happen to have Hibernate included in the application. So it's possible the reported callstacks are being confused - I've seen that happening before. Do you have other stacktraces or callpaths actually pointing to specific Hibernate code? |
681c8f4 to
852a5c1
Compare
|
Following @yrodiere 's suggestion I traced the issue to be in JAXBSubstitutions.java which no longer substitutes some of the methods due to changes between the JDK 8 implementation of jaxb (which Quarkus no longer supports) and the one provided by org.glassfish.jaxb:jaxb-runtime which is being used now. Fixing the substitutions resolves the issue with the proxy classes as well. |
This comment has been minimized.
This comment has been minimized.
* Unconditionally substitute jaxb methods to detect changes in libraries through failures, as done for other libraries * Remove substitutions for com.sun.xml.internal.* Classes, they don't exist in the org.glassfish.jaxb:jaxb-runtime jaxb implementation The above two were not done previously in order to support Java 8 which Quarkus no longer supports.
852a5c1 to
e93a20d
Compare
|
That had an awful lot of failures... I've rebased the branch to see if a fresh build helps |
The above two were not done previously in order to support Java 8 which Quarkus no longer supports.