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

OptaPlanner AWT DataFlavor build time init error #20491

Closed
geoand opened this issue Oct 1, 2021 · 6 comments · Fixed by apache/incubator-kie-optaplanner#1594
Closed

OptaPlanner AWT DataFlavor build time init error #20491

geoand opened this issue Oct 1, 2021 · 6 comments · Fixed by apache/incubator-kie-optaplanner#1594
Assignees
Labels
area/mandrel kind/bug Something isn't working

Comments

@geoand
Copy link
Contributor

geoand commented Oct 1, 2021

Optaplanner native integration tests are failing to build native binary due to #20239

One of the issues is:

 javax.activation.ActivationDataFlavor the class was requested to be initialized at run time (). org.drools.compiler.kproject.models.KieModuleMarshaller caused initialization of this class with the following trace:
	at javax.activation.ActivationDataFlavor.<clinit>(ActivationDataFlavor.java)
	at java.lang.Class.forName0(Unknown Source)
	at java.lang.Class.forName(Class.java:398)
	at com.thoughtworks.xstream.core.JVM.loadClassForName(JVM.java:328)
	at com.thoughtworks.xstream.core.JVM.loadClassForName(JVM.java:307)
	at com.thoughtworks.xstream.XStream.setupAliases(XStream.java:801)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:540)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:470)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:444)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:397)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:371)
	at org.kie.soup.xstream.XStreamUtils.createNonTrustingXStream(XStreamUtils.java:198)
	at org.drools.compiler.kproject.models.KieModuleMarshaller.<init>(KieModuleMarshaller.java:47)
	at org.drools.compiler.kproject.models.KieModuleMarshaller.<clinit>(KieModuleMarshaller.java:45)

java.awt.datatransfer.DataFlavor the class was requested to be initialized at run time (Quarkus run time init for AWT). org.drools.compiler.kproject.models.KieModuleMarshaller caused initialization of this class with the following trace:
	at java.awt.datatransfer.DataFlavor.<clinit>(DataFlavor.java:115)
	at java.lang.Class.forName0(Unknown Source)
	at java.lang.Class.forName(Class.java:398)
	at com.thoughtworks.xstream.core.JVM.loadClassForName(JVM.java:328)
	at com.thoughtworks.xstream.core.JVM.loadClassForName(JVM.java:307)
	at com.thoughtworks.xstream.XStream.setupAliases(XStream.java:801)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:540)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:470)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:444)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:397)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:371)
	at org.kie.soup.xstream.XStreamUtils.createNonTrustingXStream(XStreamUtils.java:198)
	at org.drools.compiler.kproject.models.KieModuleMarshaller.<init>(KieModuleMarshaller.java:47)
	at org.drools.compiler.kproject.models.KieModuleMarshaller.<clinit>(KieModuleMarshaller.java:45)

The AWT extension pushes any java.awt classes to be run time initialized. In this case, some static initalization in org.drools.compiler.kproject.models.KieModuleMarshaller, which currently happens at build time, leads, through xstream dependency to trying to initialize java.awt.datatransfer.DataFlavor at build time, to clashes with the AWT extension.

Since the new AWT extension was introduced the Optaplanner quickstart has been failing (see #11563 (comment)).
graalvm/mandrel#292 might also be related

@geoand geoand added the kind/bug Something isn't working label Oct 1, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Oct 1, 2021

/cc @galderz, @zakkak

@galderz
Copy link
Member

galderz commented Oct 1, 2021

FYI graalvm/mandrel#292 will be fixed in upcoming Mandrel 21.2.0.2 version. See graalvm/mandrel#292 (comment) for details.

I'll look into the Optaplanner issue next.

@galderz galderz changed the title Investigate AWT related issues OptaPlanner AWT DataFlavor build time init error Oct 1, 2021
@galderz
Copy link
Member

galderz commented Oct 1, 2021

PR sent: https://github.com/kiegroup/optaplanner/pull/1594

@ge0ffrey
Copy link
Contributor

ge0ffrey commented Oct 2, 2021

cc @mariofusco Can we fix this upstream in Drools 8 such that this workaround can be removed? https://github.com/kiegroup/optaplanner/pull/1594

@ge0ffrey
Copy link
Contributor

ge0ffrey commented Oct 4, 2021

Thank you Galder! The fix is merged (@triceo is following up) I suspect this issue can be closed?

@galderz
Copy link
Member

galderz commented Oct 4, 2021

No worries Geoffrey :). Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/mandrel kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants