Reputation: 51
I need to migrate to Drools 8 while touching as little code as possible. I have been following their guide which says that I need to replace the KieContainer with the KieRuntimeBuilder.
The issue is instantiating this value. I have added the kogito-legacy dependency and the documentation claims that you simply add the @Inject annotation and that Kogito will inject the value for you.
That did not work of course since it wasn't picked up as a Spring bean but even after adding the external package to the ComponentScan, it still gets the same error - No qualifying bean of type 'org.kie.kogito.legacy.rules.KieRuntimeBuilder' available: expected at least 1 bean which qualifies as autowire candidate.
I've add these dependencies to my pom -
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-engine</artifactId>
<version>${version.drools}</version>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>kogito-legacy-api</artifactId>
<version>1.20.0.Final</version>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>kogito-quarkus-rules</artifactId>
<version>1.44.1.Final</version>
</dependency>
There is another KieRuntimeBuilder available from Drools. Even though the instructions are to add the kogito-legacy version, I also tried the other. Although this also failed, it seems a little closer to the mark as the bean was at least successfully created (but as null) -
Caused by: java.lang.NullPointerException: Cannot invoke "org.kie.api.runtime.KieRuntimeBuilder.getKieBase()" because "this.kieRuntimeBuilder" is null
Upvotes: 2
Views: 275