Reputation: 46
I'm integrating drools with spring boot 3 app running on java17, but while running the app kieBuilder.buildAll() is failing with exception
Sisu : Error injecting: org.apache.maven.plugin.internal.DefaultMavenPluginManager
What I Have Tried Verified that the required Drools dependencies are included in the pom.xml. Made sure the Drools .drl file is in the classpath. Checked if there is a compatibility issue with Java 17, Spring Boot 3, or Drools 9.44.0.Final. Tried running mvn clean install to ensure that dependencies are properly resolved.
Below is my drools java config
@Configuration
@Slf4j
public class DroolDataSourceConfig {
@Bean(name = "conditionalKieContainer")
public KieContainer createConditionalKieContainer() {
return createKieContainer("abc.drl");
}
private KieContainer createKieContainer(String droolsFilePath) {
log.info("init Kie Container");
KieServices kieServices = KieServices.Factory.get();
KieFileSystem kieFileSystem = kieServices.newKieFileSystem();
kieFileSystem.write(ResourceFactory.newClassPathResource(droolsFilePath, "UTF-8"));
KieBuilder kieBuilder = kieServices.newKieBuilder(kieFileSystem);
kieBuilder.buildAll();
KieModule kieModule = kieBuilder.getKieModule();
return kieServices.newKieContainer(kieModule.getReleaseId());
}
}
POM dependecies
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.4</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
<groupId>com.company.program</groupId>
<artifactId>test-program</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>test-program</name>
<description>Project for Tesgt</description>
<modules>
<module>child-common</module>
</modules>
<properties>
<java.version>17</java.version>
<org.apache.maven.plugins>3.13.0</org.apache.maven.plugins>
<mapstruct.version>1.5.5.Final</mapstruct.version>
<org.projectlombok.version>1.18.30</org.projectlombok.version>
<version.strati.boms>11.1.2</version.strati.boms>
<version.logging>5.5.0</version.logging>
<version.metrics>4.5.0</version.metrics>
<version.txn.marking>4.8.1</version.txn.marking>
<version.slf4j>1.7.4</version.slf4j>
<azure.spring.data.cosmos.version>5.3.0</azure.spring.data.cosmos.version>
<ccm.client.version>3.2.1</ccm.client.version>
<version.sppotless.maven.plugin>2.26.0</version.sppotless.maven.plugin>
<version.google.Java.Format>1.17.0</version.google.Java.Format>
<wfs.kafka.version>0.0.9-SNAPSHOT</wfs.kafka.version>
<versio.graphql.webclient>1.0.0</versio.graphql.webclient>
<version.commons.collections4>4.4</version.commons.collections4>
<version.openapi.swagger>2.5.0</version.openapi.swagger>
<version.kafka.streams>2.2.1</version.kafka.streams>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-streams</artifactId>
<version>${version.kafka.streams}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-graphql</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.graphql</groupId>
<artifactId>spring-graphql-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-spring-data-cosmos</artifactId>
<version>${azure.spring.data.cosmos.version}</version>
</dependency>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.10</version>
</dependency>
<!--openAPI-->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>${version.openapi.swagger}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.openapitools/jackson-databind-nullable -->
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.graphql-java/graphql-java-extended-scalars -->
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java-extended-scalars</artifactId>
<version>22.0</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.9.22</version>
</dependency>
<!-- retry-->
<dependency>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
<version>2.0.3</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>6.1.5</version>
</dependency>
<!-- drools dependencies -->
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-ci</artifactId>
<version>9.44.0.Final</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-decisiontables</artifactId>
<version>9.44.0.Final</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-mvel</artifactId>
<version>9.44.0.Final</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>9.44.0.Final</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>9.44.0.Final</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>${version.sppotless.maven.plugin}</version>
<configuration>
<java>
<googleJavaFormat>
<version>${version.google.Java.Format}</version>
<style>GOOGLE</style>
</googleJavaFormat>
</java>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- sonar-->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<systemPropertyVariables>
<ccm.configs.dir>${project.basedir}/src/test/resources/tunr</ccm.configs.dir>
</systemPropertyVariables>
</configuration>
<groupId>org.apache.maven.plugins</groupId>
<version>${apache.maven-surefire-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
<groupId>org.apache.maven.plugins</groupId>
<version>${org.apache.maven.plugins}</version>
</plugin>
</plugins>
</build>
</project>
Upvotes: 0
Views: 40