0

我是 drools 的新手,我正在尝试在 Tomcat7 上运行的 Drools kie 服务器 6.4.0.Final 上执行一个简单的 CEP 规则,但是当我尝试启动 kie 容器时出现以下错误。

[localhost-startStop-1] DEBUG KieModule Lookup. ReleaseId com.realtech:stdout:1.0-SNAPSHOT was not in cache, checking classpath
[localhost-startStop-1] DEBUG KieModule Lookup. ReleaseId com.realtech:stdout:1.0-SNAPSHOT was not in cache, checking maven repository
[localhost-startStop-1] ERROR Unable to build KieBaseModel:kbase1
Unable to Analyse Expression speed == 200:
[Error: unable to resolve method using strict-mode: com.realtech.flight.FlightStatus.speed()]
[Near : {... speed == 200 ....}]
             ^
[Line: 15, Column: 4] : [Rule name='flight print']

我的代码是这样的:

飞行状态.drl

package com.realtech.flight;
//import com.realtech.flight.FlightStatus;

declare FlightStatus
    @role(event)
end

rule "flight print"
no-loop true

when
    $flight : FlightStatus( speed == 200 ) // over window:time(1m)  
then
    System.out.println("test");     
end

FlightStatus.java

package com.realtech.flight;

/**
 * This class was automatically generated by the data modeler tool.
 */

public class FlightStatus implements java.io.Serializable
{

   static final long serialVersionUID = 1L;

   public java.lang.Float speed;

   public FlightStatus()
   {
   }

   public java.lang.Float getSpeed()
   {
      return this.speed;
   }

   public void setSpeed(java.lang.Float speed)
   {
      this.speed = speed;
   }

   public FlightStatus(java.lang.Float speed)
   {
      this.speed = speed;
   }

}

kie-workbench 中的知识库设置: 在此处输入图像描述

然后在 kie-server 中启动容器时出现异常。

但是当我删除声明时它是成功的:

declare FlightStatus
    @role(event)
end

或删除speed == 200

对不起,我的英语不好。

4

0 回答 0