0

I have this exception when I try to start spring boot Exception in threat java.lang.ClassNotFoundException: org.kie.api.KieServices$Factory at java.net.URLClassLoader.findClass
This is how my pom looks like. I think i'm missing some dependency in the pom file but i'm not sure which ones i'm missing. Any ideas how I can fix this

    <?xml version="1.0" encoding="UTF-8"?>
            <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"`enter code here` xmlns="http://maven.apache.org/POM/4.0.0"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
              <modelVersion>4.0.0</modelVersion>
            
              <parent>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-parent</artifactId>
                <version>2.2.2.RELEASE</version>
                <relativePath/> <!-- lookup parent from repository -->
              </parent>
            
              <groupId>com.myspace</groupId>
              <artifactId>Onboarding</artifactId>
              <version>1.0.2-SNAPSHOT</version>
              <packaging>kjar</packaging>
              <name>Onboarding</name>
              <description>onboarding</description>
            
              <properties>
                <java.version>1.8</java.version>
              </properties>
            
              <dependencies>
            
                <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.boot</groupId>
                  <artifactId>spring-boot-autoconfigure</artifactId>
                  <version>2.2.2.RELEASE</version>
                </dependency>
            
                <dependency>
                  <groupId>com.thoughtworks.xstream</groupId>
                  <artifactId>xstream</artifactId>
                  <version>1.4.10</version>
                  <scope>test</scope>
                </dependency>
                <dependency>
                  <groupId>org.kie</groupId>
                  <artifactId>kie-internal</artifactId>
                  <version>7.26.0.Final-redhat-00005</version>
                  <scope>provided</scope>
                </dependency>
                <dependency>
                  <groupId>org.optaplanner</groupId>
                  <artifactId>optaplanner-core</artifactId>
                  <version>7.26.0.Final-redhat-00005</version>
                  <scope>provided</scope>
                </dependency>
                <dependency>
                  <groupId>junit</groupId>
                  <artifactId>junit</artifactId>
                  <version>4.12</version>
                  <scope>test</scope>
                </dependency>
                <dependency>
                  <groupId>org.optaplanner</groupId>
                  <artifactId>optaplanner-persistence-jaxb</artifactId>
                  <version>7.26.0.Final-redhat-00005</version>
                  <scope>provided</scope>
                </dependency>
                <dependency>
                  <groupId>org.kie</groupId>
                  <artifactId>kie-api</artifactId>
                  <version>7.26.0.Final-redhat-00005</version>
                  <scope>provided</scope>
                </dependency>
            
                <dependency>
                  <groupId>org.kie</groupId>
                  <artifactId>kie-dmn-core</artifactId>
                  <version>7.26.0.Final-redhat-00005</version>
                </dependency>
            
                <!-- Required if not using classpath kie container -->
                <dependency>
                  <groupId>org.kie</groupId>
                  <artifactId>kie-ci</artifactId>
                  <version>7.26.0.Final-redhat-00005</version>
                </dependency>
            
                <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter</artifactId>
                </dependency>
            
                <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-jersey</artifactId>
                </dependency>
                <dependency>
                  <groupId>org.projectlombok</groupId>
                  <artifactId>lombok</artifactId>
                  <optional>true</optional>
                </dependency>
            
                <dependency>
                  <groupId>org.drools</groupId>
                  <artifactId>drools-decisiontables</artifactId>
                  <version>7.1.0.Beta2</version>
                </dependency>
            
            
                <dependency>
                  <groupId>org.apache.cxf</groupId>
                  <artifactId>cxf-rt-rs-service-description-swagger</artifactId>
                  <version>3.2.6</version>
                </dependency>
                <dependency>
                  <groupId>io.swagger</groupId>
                  <artifactId>swagger-jaxrs</artifactId>
                  <version>1.5.15</version>
                  <exclusions>
                    <exclusion>
                      <groupId>javax.ws.rs</groupId>
                      <artifactId>jsr311-api</artifactId>
                    </exclusion>
                  </exclusions>
                </dependency>
            
                <dependency>
                  <groupId>org.webjars</groupId>
                  <artifactId>swagger-ui</artifactId>
                  <version>2.2.10</version>
                </dependency>
            
              </dependencies>
              <build>
                <plugins>
                  <plugin>
                    <groupId>org.kie</groupId>
                    <artifactId>kie-maven-plugin</artifactId>
                    <version>7.26.0.Final-redhat-00005</version>
                    <extensions>true</extensions>
                  </plugin>
            
                    <plugin>
                      <groupId>org.springframework.boot</groupId>
                      <artifactId>spring-boot-maven-plugin</artifactId>
                    </plugin>
                </plugins>
              </build>
            </project>
    
    ```
tarilabs
  • 2,178
  • 2
  • 15
  • 23
mrobi
  • 17
  • 10
  • That's a very strange set of versions. Why are you using an old beta version of drools-decisiontables? Admittedly, I have no idea what you're actually trying to do, but i've always managed to make due with just a dependency on `drools-core` and `drools-decisiontables`. None of this kie internals stuff. – Roddy of the Frozen Peas Jul 13 '20 at 15:46
  • I removed the old version of drools-decicisontable. i'm using this one ` org.drools drools-decisiontables 7.26.0.Final-redhat-00005 ` But i'm still getting the same error – mrobi Jul 13 '20 at 17:50
  • the reason i have the kie stuff is that I took the project from Redhat Business central and converted it to a sprinboot app so they come as but of the maven from Business central – mrobi Jul 13 '20 at 17:52
  • Yeah sorry I have no experience with 'business central'. All my spring-boot drools apps just used the open source stuff like I mentioned. The KieService and its child Factory class should come from drools-core in the open-source side of things. – Roddy of the Frozen Peas Jul 13 '20 at 18:16
  • thanks mate. let me try to continue to solve it – mrobi Jul 13 '20 at 22:33
  • It looks you are using the Subscription and Productized version of Red Hat DM/PAM, this question shall be raised via the Red Hat Customer Portal so you can (also) receive the support included with your Subscription – tarilabs Jul 14 '20 at 06:56
  • @tarilabs yes there is a reason why i'm using it – mrobi Jul 22 '20 at 07:10
  • 1
    @mrobi please don't forget to raise the ticket via the Red Hat Customer Portal when using Subscription and Productized version of Red Hat DM/PAM ! Thank you – tarilabs Jul 22 '20 at 07:13
  • thanks guys. I have figured out the solution. I had the dependency as provided so at runtime it was ignoring my provide version. I fixed it by removing the scope – mrobi Jul 22 '20 at 07:17
  • ` org.drools drools-model-compiler 7.26.0.Final-redhat-00005 org.drools drools-core 7.26.0.Final-redhat-00005 ` – mrobi Jul 22 '20 at 07:20
  • Are you using drools working memory persistence on a DB? – sam Mar 07 '21 at 15:05

1 Answers1

0

@mrobi is any specific reason to use redhat versions dependency.? You can try the following

<groupId>com.drools</groupId>
  <artifactId>sample</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>drools sample</name>
  <description>Microservices for the drools sample</description>
  <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <drools.version>7.36.1.Final</drools.version>
    </properties>
    
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
      
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        
        
        
         <!-- Swagger -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.9.2</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.9.2</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-bean-validators</artifactId>
            <version>2.9.2</version>
        </dependency>
         <!-- Swagger -->
         
            <!-- Logback -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
        </dependency>
        <dependency>
            <groupId>org.codehaus.janino</groupId>
            <artifactId>janino</artifactId>
        </dependency>
         <!-- Logback -->
         
         
         <!-- Drools dependcy -->
         
         <dependency>
            <groupId>org.kie</groupId>
            <artifactId>kie-spring</artifactId>
            <version>${drools.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-tx</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-beans</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-context</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-compiler</artifactId>
            <version>${drools.version}</version>
        </dependency>
           <!-- Drools dependcy -->
         
         
         
                <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
         
    </dependencies>
Thilakar Raj
  • 37
  • 13