简体   繁体   English

Eclipse Drools 6.2.0插件错误:org / drools / StatefulSession

[英]Eclipse Drools 6.2.0 Plugin Error: org/drools/StatefulSession

This may be a bit too vague for this forum but I'm trying anyway.. 对于这个论坛来说,这可能有点含糊不清,但我还是想尝试。

I have Eclipse Juno with the Drools 6.2.0 plugin, using a Java 8 JRE. 我有使用Drools 6.2.0插件的Eclipse Juno,使用Java 8 JRE。 I have a DRL file which appears to be valid as it runs without error, however Eclipse reports an error: org/drools/StatefulSession . 我有一个DRL文件,该文件似乎有效,因为它运行时没有错误,但是Eclipse报告了一个错误: org / drools / StatefulSession

在此处输入图片说明

It also does not pick up syntax errors such as a missing semi-colon, so Eclipse is obviously just not validating correctly. 它还不会出现语法错误(例如缺少分号),因此Eclipse显然无法正确验证。

For example, a very simple rule such as: 例如,一个非常简单的规则,例如:

rule "ABC"
salience 1000
when
    Person($surname : surname)
then
    logger.info("Surname is " + $surname)
end

does not flag that the logger.info line is missing a semi-colon. 不会标记logger.info行缺少分号。

My project that the DRL file is in references the JRE library along with some custom classes. 我的DRL文件所在的项目引用了JRE库以及一些自定义类。

I have created a Drools runtime via the Eclipse preferences, which is selected. 我已经通过选中的Eclipse首选项创建了Drools运行时。

I noticed that if I select the Drools option "Allow cross reference in DRL files" then the StatefulSession error goes away, but it still won't validate on general Java syntax errors such as missing semi-colons (this might be a more general issue with my Eclipse Java setup). 我注意到,如果选择Drools选项“在DRL文件中允许交叉引用”,则StatefulSession错误消失了,但是它仍然无法验证一般的Java语法错误,例如缺少分号(这可能是更常见的问题)与我的Eclipse Java设置)。

My drools coding knowledge is adequate but my knowledge of the Eclipse setup and use of Drools plugin isn't I'm afraid so apologies if this is a simple setup issue. 我的drools编码知识是足够的,但是我对Eclipse设置和Drools插件的使用的了解不是很害怕,如果这是一个简单的设置问题,那么请您道歉。

My questions are: 我的问题是:

  1. Where is this StatefulSession error coming from and what does it mean? 这个StatefulSession错误从哪里来?它是什么意思?
  2. Why is Eclipse not flagging Java syntax errors in my rules "then" sections? 为什么Eclipse在我的规则“然后”部分中未标记Java语法错误?

Thanks in advance. 提前致谢。

Drools does not require you to add a semicolon after a statement on the right hand side if there is a line end following it. Drools不需要您在右侧的语句后添加分号(如果后面紧跟着一行)。

RHS code is parsed by a special (peculiar) parser, not strictly adhering to Java syntax. RHS代码由特殊的(特殊的)解析器解析,而不严格遵循Java语法。 It's more lenient, but may not always be able to cope with full Java. 它比较宽大,但可能并不总是能够处理完整的Java。 Note that it must be able to handle a superset of statements: including modify(...){...} and the "macros" such as insert() or delete() . 请注意,它必须能够处理语句的超集:包括modify(...){...}和“宏”,例如insert()delete()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM