当前位置: 首页 > 知识库问答 >
问题:

调用KieScanner引发ClassNotFoundException

章琛
2023-03-14

我有几个Drools项目,希望能够动态加载规则的变化。在我尝试将KieScanner添加到它们之前,这些项目都工作得很好。我遵循了以下说明:http://docs.jboss.org/drools/release/6.0.1.final/drools-docs/html/droolsreleasenoteschapter.html#d0e515

我使用drools 6.1.0。final和Wildfly 8.0.0。final

文档表明,在我的类路径中有kie-ci的依赖项就足够了。很明显,要么我做错了什么,要么文档是错误的。

<?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 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.sial.rules</groupId>
  <artifactId>sial-rules</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <repositories>
    <repository>
        <id>JBoss Repository</id>
        <url>https://repository.jboss.org/nexus/content/groups/public/</url>
    </repository>
  </repositories>   
   <dependencyManagement>
    <dependencies>
    <!-- Added to ensure that we have the correct DROOLS/JBOSS versions -->
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-bom</artifactId>
            <version>6.1.0.Final</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
       <dependency>
            <groupId>org.wildfly.bom</groupId>
            <artifactId>jboss-javaee-7.0-with-tools</artifactId>
            <version>8.0.0.Final</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency> 
        <dependency>
            <groupId>org.wildfly.bom</groupId>
            <artifactId>jboss-javaee-7.0-with-resteasy</artifactId>
            <version>8.0.0.Final</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>    
    </dependencies>
  </dependencyManagement>
  <dependencies>
        <dependency>
            <groupId>javax.enterprise</groupId>
            <artifactId>cdi-api</artifactId>
        </dependency>        
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
        </dependency>  
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-core</artifactId>
        </dependency>                        
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-compiler</artifactId>
        </dependency>       
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-decisiontables</artifactId>
        </dependency>       
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-persistence-jpa</artifactId>
        </dependency>                   
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>knowledge-api</artifactId>
        </dependency>       
        <dependency>
            <groupId>org.kie</groupId>
            <artifactId>kie-internal</artifactId>
        </dependency>       
        <dependency>
            <groupId>org.kie</groupId>
            <artifactId>kie-api</artifactId>
        </dependency>    
        <dependency>
            <groupId>org.kie</groupId>
            <artifactId>kie-ci</artifactId>
                      <exclusions>
                        <exclusion>
                           <groupId>org.jboss.netty</groupId>
                           <artifactId>netty</artifactId>
                        </exclusion>
                      </exclusions>
        </dependency>


        <dependency>
          <groupId>org.codehaus.jackson</groupId>
          <artifactId>jackson-core-asl</artifactId>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.codehaus.jackson</groupId>
          <artifactId>jackson-mapper-asl</artifactId>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.logging.log4j</groupId>
          <artifactId>log4j-api</artifactId>
          <version>2.0-rc1</version>
          <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
  </dependencies>  
  <build>
     <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>
      <plugin>
         <groupId>org.drools</groupId>
         <artifactId>drools-maven-plugin</artifactId>
         <version>6.0.0.CR5</version>
         <extensions>true</extensions>
      </plugin>
     </plugins>
  </build> 
</project>
        <dependency>
            <groupId>com.sial.rules</groupId>
            <artifactId>sial-rules</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
<dependency>
   <groupId>org.apache.maven</groupId>
   <artifactId>maven-aether-provider</artifactId>
   <version>3.0.5</version>
</dependency>

共有1个答案

羊新翰
2023-03-14

问题是kie-ci包含的maven(3.0.5)比Arquillian(3.1.1)更早的版本,特别是Maven-Aether-provider。Arquillian(真的收缩包装)真的想使用较新的版本。

我尝试在pom.xml中强制使用3.0.5版本,但遇到了解析器的问题。这是错误:java.lang.UnsupportedOperationException:无法boostrap Aether存储库系统。确保运行的是Maven 3.1.0或更新版本。

所以基本上kie 6.1.0.final与Arquillian 1.1.5.final不兼容

 类似资料:
  • 我有以下错误 ValidationException:HV000041:调用TraversableResolver.IsReachable()引发异常。在org.hibernate.validator.internal.engine.validatorimpl.isreachable(validatorimpl.java:1405)上 org.hibernate.validator.interna

  • 问题内容: 我有一个简单的方法,可将命令打印到屏幕上,扫描用户的输入,然后将其作为字符串返回。如果用户输入无效,它将通知用户并再次询问。该方法运行完美,但是我的讲师提到我们应该始终关闭资源,因此我回过头来添加了close方法,现在无论用户输入什么,每次调用该方法时都会收到NoSuchElementException。这是代码… 例外总是指向用户输入以scan.nextLine()。trim()开头

  • 当我调用EmailSenderController上的addHtml()方法将html文件文本添加到html编辑器时,会引发错误。 类似的线程,但例外是我没有像他那样初始化@fxml inject控件:JavaFX FileChooser抛出错误(可能很容易修复,但仍然混乱) 主类

  • 我已经创建了3个片段,在一个ViewPager中。我试图仅当特定片段对用户可见时才从服务器获取数据。为此,我在setUserVisibleHint()中调用了web服务方法。但是当我在该方法内部使用getActivity()时,我会得到NullPointerException。我如何确保我只加载一次数据并且当它对用户可见时?代码如下: 我已经验证了在setUserVisibleHint()之后调用

  • C++ 函数 向函数传递参数的引用调用方法,把引用的地址复制给形式参数。在函数内,该引用用于访问调用中要用到的实际参数。这意味着,修改形式参数会影响实际参数。 按引用传递值,参数引用被传递给函数,就像传递其他值给函数一样。因此相应地,在下面的函数 swap() 中,您需要声明函数参数为引用类型,该函数用于交换参数所指向的两个整数变量的值。 // 函数定义 void swap(int &x, in

  • 这是一个windows表单应用程序,我在其中有一个特定的表单。在这个表单上,我显示了一些应该在后台异步发生的处理的进度。所有这些都很好,除了当我尝试处理后台处理中捕获的异常时…… 这是表单代码中调用Async函数的子函数,该函数位于包含所有后台处理代码的模块中: 这是它调用的异步函数,它位于一个单独的模块中: 这是由异步函数调用的常规sub: 当我使用我知道最终会在子B中生成错误的数据运行此代码时