Skip to content

Quarkus Native with Optaplanner fails to start with EasyScoreCalculator #37871

@bithurder

Description

@bithurder

Describe the bug

Our Quarkus/OptaPlanner application works fine in JVM mode, but when compiled to Native executable, it throws a exception at initialization.
versionn (powered by Quarkus 2.16.12.Final)

We attempted to register the class via solverConfig.xml and added the resource refernce in application.properties, but it still did not help.
quarkus.native.resources.includes=solverConfig.xml

We have several services that use streaming constraint API and those are working fine. It's just this one with EasyScoreCalcuator that won't start.

Expected behavior

Solver should start normally.

Actual behavior

2023-12-20T15:18:32.848536120Z Caused by: java.lang.IllegalStateException: If there is no scoreDrl (null), scoreDrlFile (null) or constraintProviderClass (null) with DROOLS impl type (null), there can be no droolsAlphaNetworkCompilationEnabled (false) either.
    at org.optaplanner.core.impl.score.director.ScoreDirectorFactoryFactory.validateNoDroolsAlphaNetworkCompilation(ScoreDirectorFactoryFactory.java:217)
2023-12-20T15:18:32.848550921Z  at org.optaplanner.core.impl.score.director.ScoreDirectorFactoryFactory.decideMultipleScoreDirectorFactories(ScoreDirectorFactoryFactory.java:133)
    at org.optaplanner.core.impl.score.director.ScoreDirectorFactoryFactory.buildScoreDirectorFactory(ScoreDirectorFactoryFactory.java:40)
    at org.optaplanner.core.impl.solver.DefaultSolverFactory.buildScoreDirectorFactory(DefaultSolverFactory.java:166)
2023-12-20T15:18:32.848563806Z  at org.optaplanner.core.impl.solver.DefaultSolverFactory.<init>(DefaultSolverFactory.java:71)
2023-12-20T15:18:32.848567567Z  at org.optaplanner.core.api.solver.SolverFactory.create(SolverFactory.java:106)
2023-12-20T15:18:32.848570521Z  at org.optaplanner.quarkus.bean.DefaultOptaPlannerBeanProvider.solverFactory(DefaultOptaPlannerBeanProvider.java:46)
    at org.optaplanner.quarkus.bean.DefaultOptaPlannerBeanProvider_ProducerMethod_solverFactory_3b1fa4ff0a3de7781ba3e1239701086bba97ef14_Bean.create(Unknown Source)

How to Reproduce?

Create a native Quarkus OptaPlanner with an EasyScoreCalculator

//Inject solverManager class: 
import org.optaplanner.core.api.solver.SolverManager;
@Inject
 SolverManager<OptimizationSolution, Integer> solverManager;

//Start a solver executable
    solverManager.solveAndListen( id,
            this::findById,
            this::save,
            this::saveFinal,
            this::solverException
            );

Output of uname -a or ver

Linux U-3NLJDFGJ7UOQR 6.2.0-1017-aws #17~22.04.1-Ubuntu SMP Fri Nov 17 21:07:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

openjdk 17.0.9 2023-10-17

Mandrel or GraalVM version (if different from Java)

mandrel22

Quarkus version or git rev

2.16.12.Final

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

Maven 3.9.1

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions