0

当我尝试启动 spring boot 时出现此异常 威胁 java.lang.ClassNotFoundException: org.kie.api.KieServices$Factory at java.net.URLClassLoader.findClass
这就是我的 pom 的样子。我想我在 pom 文件中缺少一些依赖项,但我不确定我缺少哪些。有什么想法可以解决这个问题

    <?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>
    
    ```
4

1 回答 1

0

@mrobi 是使用 redhat 版本依赖项的任何特定原因。?您可以尝试以下方法

<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>
于 2020-07-18T13:22:48.640 回答