Issue in Drools 5.5 concerned with rule and scanning list with from command
by braveheart85
Hello,
I'm having a strange issue. I have a medium size rule file with rules like
these:
when
InvestigationTarget( $code : identifierCode )
$s: SubjectData( identifierCode == $code )
$r: Registry( )
$y: YearData( ) from $r.years
$p: Purchase( customerIdentifierCode == $s.identifierCode ) from
$y.purchases
then
...
My application is actually still a prototype and i work building a session
with facts already inserted and when the system started the user changes DRL
to use with facts.
My issue is when i add resource to knowledge builder. I catch an exception
when exists one fact can activate the above rule:
java.lang.RuntimeException: unable to invoke method:
org.titan.registry.BusinessEntityData.getIdentifierCode: target of method is
null
at
com.liferay.portal.kernel.portlet.LiferayPortlet.callActionMethod(LiferayPortlet.java:171)
at
com.liferay.util.bridges.mvc.MVCPortlet.callActionMethod(MVCPortlet.java:250)
at
com.liferay.portal.kernel.portlet.LiferayPortlet.processAction(LiferayPortlet.java:80)
at
com.liferay.util.bridges.mvc.MVCPortlet.processAction(MVCPortlet.java:220)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:70)
at
com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:48)
at
com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:73)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:593)
at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:530)
at
com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:534)
at
com.liferay.portlet.InvokerPortletImpl.invokeAction(InvokerPortletImpl.java:579)
at
com.liferay.portlet.InvokerPortletImpl.processAction(InvokerPortletImpl.java:294)
at
com.liferay.portal.action.LayoutAction.processPortletRequest(LayoutAction.java:944)
at
com.liferay.portal.action.LayoutAction.processLayout(LayoutAction.java:688)
at com.liferay.portal.action.LayoutAction.execute(LayoutAction.java:249)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at
com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:176)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at
com.liferay.portal.servlet.MainServlet.callParentService(MainServlet.java:560)
at com.liferay.portal.servlet.MainServlet.service(MainServlet.java:537)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
at
com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:294)
at
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:73)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471)
at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
at
com.liferay.portal.servlet.FriendlyURLServlet.service(FriendlyURLServlet.java:138)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
at
com.liferay.portal.servlet.filters.strip.StripFilter.processFilter(StripFilter.java:335)
at
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
at
com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:123)
at
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
at
com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:294)
at
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
at
com.liferay.portal.servlet.filters.i18n.I18nFilter.processFilter(I18nFilter.java:241)
at
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
at
com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.processFilter(AutoLoginFilter.java:246)
at
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
at
com.liferay.portal.servlet.filters.sso.ntlm.NtlmPostFilter.processFilter(NtlmPostFilter.java:83)
at
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
at
com.liferay.portal.sharepoint.SharepointFilter.processFilter(SharepointFilter.java:80)
at
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at
com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
at
com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.processFilter(VirtualHostFilter.java:216)
at
com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:187)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:167)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:167)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:187)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
at
com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:73)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.RuntimeException: unable to invoke method:
org.titan.registry.BusinessEntityData.getIdentifierCode: target of method is
null
at
org.mvel2.optimizers.impl.refl.nodes.GetterAccessor.getValue(GetterAccessor.java:66)
at
org.mvel2.optimizers.impl.refl.nodes.VariableAccessor.getValue(VariableAccessor.java:37)
at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:108)
at
org.mvel2.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:107)
at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
at
org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:123)
at org.mvel2.MVEL.executeExpression(MVEL.java:930)
at
org.drools.rule.constraint.MvelConditionEvaluator.evaluate(MvelConditionEvaluator.java:70)
at
org.drools.rule.constraint.MvelConditionEvaluator.evaluate(MvelConditionEvaluator.java:49)
at
org.drools.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:167)
at
org.drools.rule.constraint.MvelConstraint.isAllowedCachedLeft(MvelConstraint.java:136)
at
org.drools.common.SingleBetaConstraints.isAllowedCachedLeft(SingleBetaConstraints.java:130)
at org.drools.reteoo.FromNode.updateSink(FromNode.java:473)
at org.drools.reteoo.RuleTerminalNode.attach(RuleTerminalNode.java:344)
at
org.drools.reteoo.builder.ReteooRuleBuilder.addSubRule(ReteooRuleBuilder.java:168)
at
org.drools.reteoo.builder.ReteooRuleBuilder.addRule(ReteooRuleBuilder.java:128)
at org.drools.reteoo.ReteooBuilder.addRule(ReteooBuilder.java:116)
at org.drools.reteoo.ReteooRuleBase.addRule(ReteooRuleBase.java:445)
at org.drools.common.AbstractRuleBase.addRule(AbstractRuleBase.java:956)
at
org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:627)
at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:472)
at
org.drools.impl.KnowledgeBaseImpl.addKnowledgePackages(KnowledgeBaseImpl.java:150)
at
org.myproject.frontend.investigation.drools.DroolsInvestigationEngine.setResources(DroolsInvestigationEngine.java:137)
at
org.myproject.frontend.investigation.drools.filter.InvestigationFilter.setupEnvironment(InvestigationFilter.java:118)
at
org.myproject.frontend.investigation.drools.DroolsFilter.execute(DroolsFilter.java:19)
at
org.myproject.frontend.investigation.drools.DroolsInvestigationSession.executeFilter(DroolsInvestigationSession.java:64)
at org.myproject.portlet.SearchResult.openGraph(SearchResult.java:86)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.liferay.portal.kernel.portlet.LiferayPortlet.callActionMethod(LiferayPortlet.java:153)
... 136 more
Caused by: java.lang.NullPointerException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.mvel2.optimizers.impl.refl.nodes.GetterAccessor.getValue(GetterAccessor.java:43)
... 167 more
I tried a workaround modifying rule in this way:
$p: Purchase( customerIdentifierCode == $code ) from $y.purchases
thus i don't catch the exception anymore, but simply the rule don't activate
though it should.
If anyone could help me...
Best regards
--
View this message in context: http://drools.46999.n3.nabble.com/Issue-in-Drools-5-5-concerned-with-rule...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 1 month
KIE API
by thilo
I'm quite new to Drools Expert and so far the framework looks promising. As
we started a new project, I went for Drools Export 6.0.0CR4. Creating a
prototype, I realized that the class KnowledgeBase is deprecated, so I tried
to use the new KIE API. After checking the examples
https://github.com/droolsjbpm/drools/tree/master/drools-examples-api
and this previous discussion here:
http://drools.46999.n3.nabble.com/KIE-api-verbosity-td4023024.html
I'm a bit confused about the new API (also because there is little
information in the official documentation yet).
- Is the KIE API stable (because of the CR) and is it save to use or are we
better off, using 5.5?
- Except for the examples above, is there more documentation available (the
API is really verbose)? Is there any documentation for the CDI part?
- Our requirements are easy: we will have to some simple DRL files and we
want to use them in a stateless session, but it would be nice to allow rule
updates in the running system. Is this possible with KModules or is there
any other proper way using the KIE API?
Thanks in advance for all inputs!
Thilo
--
View this message in context: http://drools.46999.n3.nabble.com/KIE-API-tp4026336.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 1 month
BuildError: Unable to Analyse Expression var == "a"
by richie
Why var can not be used in the when clause? I tried to use it in then clause
such as modify ($d) {var = "d"}; it just worked well.
Is var a keyword in drools or mvel? I didn't find it anywhere both in drools
export doc and mvel guide.
Following is the content of my drl file:
package test
declare Dd
@propertyReactive
var : String
age : Integer
end
rule "Rule A"
dialect "mvel"
salience 0
no-loop
when
$d:Dd(var == "a")
then
modify ($d) {age = 3};
end
In the eclipse editor, it just shows an error marker before line $d:Dd(var
== "a"):
BuildError: Unable to Analyse Expression var == "a":
[Error: unexpected end of statement]
[Near : {... var == "a" ....}]
^
[Line: 14, Column: 0]
And when invoke the rule, it just threw following exception:
java.lang.RuntimeException: Error while creating KieBase[Message [id=1,
level=ERROR, path=rules/Sample.drl, line=14, column=0
text=Unable to Analyse Expression var == "a":
[Error: unexpected end of statement]
[Near : {... var == "a" ....}]
^
[Line: 14, Column: 0]]]
at
org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:176)
at
org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:315)
at
org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:290)
at com.sample.DroolsTest.main(DroolsTest.java:18)
I really appreciate any help you can provide.
--
View this message in context: http://drools.46999.n3.nabble.com/BuildError-Unable-to-Analyse-Expression...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 1 month
Finalizing Drools 5.6
by Mario Fusco
Hi all,
we are about to finalize Drools 5.6 and we would like to complete this
process as soon as possible.
However we would also like to be sure that we are not leaving any important
fix out, so please, if you want to signal any outstanding issue, report it
with a proper reproducer within one week from today.
Moreover, before to file a new jira ticket, try to be reasonably sure that
you are not just duplicating an already existing reported issues: we fixed
lots of bugs in the last months, and I believe (or better I hope) that it
is quite improbable that there could be many problems still waiting to be
discovered and resolved.
Thanks for you help,
Mario
11 years, 1 month
kie-spring and drools-wb integration
by clayton.tabone
Hi,
In Drools 5 it was possible to configure a drools server (based off of the
drools-camel-server-example) and in the Spring configuration the resources
could point to assets from Guvnor. It was also possible to configure the
knowledge agent to poll these assets for changes.
In Drools/KIE 6 I am aware that the following things have changed (kindly
correct me if I'm wrong):
- Guvnor was replaced by Drools/KIE WB
- Drools/KIE WB no longer builds to the binary PKG format and
packages/publishes a Maven repository with kmodules instead
- The concept of KnowledgeAgent no longer exists or otherwise this might
have been superseded by the KIE scanner in KIE CI
- KIE CI uses Maven/Aether to resolve kmodules
- The XML schema for KIE Spring includes the same configuration attributes
like kmodule.xml
- The KIE Spring configuration can expose the Camel endpoints for the
ksessions via the KModuleBeanFactoryPostProcessor using the classpath
container
Is it possible to use the Spring configuration to configure a KContainer
which loads kmodules from Drools/KIE WB? The Spring configuration only seems
to allow the definition of kmodules in the classpath container.
Best regards,
Clayton
--
View this message in context: http://drools.46999.n3.nabble.com/kie-spring-and-drools-wb-integration-tp...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 1 month
protobuf for marshalling
by Alexander Wolf
[Drools 5.5.0 Final]
Hey,
for using the marshaller I needed to add ProtoBuf jars to my project like this:
<!-- Protobuf (!important: v2.4.1) for marshalling drools knowledge sessions -->
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>2.4.1</version>
</dependency>
Is there any particular reason why it is not included in the drools jars or at least mentioned in the documentation?
Apparently drools (5.5) only works with v2.4.1 and not with the new v2.5 of ProtoBuf
- Alex
11 years, 1 month
Problem setting up Eclipse in Windows8 (Drools disappears, and most server options aren't displayed)
by ChayaCooper
I've installed Eclipse on two machines (one is running Windows 8 and the
other has Mac OS X v.10.5.8), but it doesn't seem to be running correctly in
Windows 8 as I'm experiencing two significant problems while setting up a
new project.
When I use the wizard to Define a New Server it only lists 2 Basic Server
Type options (HTTP Preview & HTTP Server), even once I've downloaded
additional servers/server adapters.
Drools is running correctly for me until I set the runtime and restart
Eclipse, when all the references to Drools vanish from the Eclipse workspace
(including Preferences, File -> New, Perspective, or even as a result when I
search in 'Quick Access'). It does however still showed Drools as installed
(when I click on 'What is already installed?'). I've tried reinstalling
Drools, as well as manually unzipping it and adding it to the plugin folder,
but it still isn't showing up in Eclipse. In order to verify that Drools
hadn't been corrupted, I created a 2nd instance of Eclipse on my desktop
(where I repeated the plugin installation process) with the exact same
result.
I've installed both Apache (Apache HTTP Server 2.2.25) and JBoss Application
Server 7 (EAP 6.1.0). In addition, I've downloaded JBoss Tools 4.1 to
address the potential issue raised in this post
https://community.jboss.org/en/tools/blog/2013/10/08/update-to-jboss-tool...
I'm running:
Eclipse Java EE IDE for Web Developers, Version: Kepler Service Release
1, Build id: 20130919-0819
Drools 6.0.0.CR4
Windows 8
--
View this message in context: http://drools.46999.n3.nabble.com/Problem-setting-up-Eclipse-in-Windows8-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 1 month
Implementation of my use case - what am I doing wrong?
by Elran Dvir
Hi all,
A few weeks ago I posted a question about my use case to the mailing list. The correspondence is attached.
This is the example of the use case I implemented:
Port scan event - the basic event is connection log. For each combination
of source_ip and destination_ip, detect a port scan event,
if over 5 seconds there were more than 2 connection logs with
different ports .
The event will stay open for 10 seconds and an update will be
sent for any new port detected. Every update will contain the count of
connection logs combining it and their id ("marker").
the drl fie:
package test;
import correlation.impl.drools.Log
import correlation.impl.drools.CorrelatedEvent
global correlation.server.EventsHandler externalEventsHandler;
declare Log
@role( event)
end
declare CorrelatedEvent
@role( event)
@timestamp( getTimestamp().getTime() )
@expires( 10s )
@duration( getDuration() )
end
// this rule will create a "Port Scan" event if none exist for this group-by values
rule "Create Port Scan Event"
dialect "java"
no-loop
when
$log : Log() from entry-point "Log stream" //get all the logs in the last 5 seconds
accumulate( Log( this after[0s,5s] $log, fieldsMap.get("src") == $log.fieldsMap.get("src") , fieldsMap.get("dst") == $log.fieldsMap.get("dst"), $port : fieldsMap.get("port")) from entry-point "Log stream";
$portSet : collectSet($port);
$portSet.size > 2 )
accumulate( Log( this after[0s,5s] $log, fieldsMap.get("src") == $log.fieldsMap.get("src") , fieldsMap.get("dst") == $log.fieldsMap.get("dst"), $marker : fieldsMap.get("marker")) from entry-point "Log stream";
$markerSet : collectSet($marker))
not CorrelatedEvent(getName() == "portScan" , fieldsMap.get("src") == $log.fieldsMap.get("src") , fieldsMap.get("dst") == $log.fieldsMap.get("dst"))
then
System.out.println(drools.getRule().getName());
CorrelatedEvent $ce = new CorrelatedEvent();
$ce.setName("portScan");
$ce.setEventsHandler(externalEventsHandler);
$ce.setDurationInSec(10);
$ce.fieldsMap.put("src", $log.fieldsMap.get("src"));
$ce.fieldsMap.put("dst", $log.fieldsMap.get("dst"));
$ce.endUpdate($markerSet);
insert($ce);
end
rule "Create Port Scan Event - update"
dialect "java"
no-loop
when
$ce: CorrelatedEvent(getName() == "portScan")
accumulate( Log(fieldsMap.get("src") == $ce.fieldsMap.get("src") , fieldsMap.get("dst") == $ce.fieldsMap.get("dst") , $port : fieldsMap.get("port") , (this meets $ce || this during $ce || this metby $ce)) from entry-point "Log stream";
$portSet : collectSet($port);
$portSet.size > 0 )
accumulate( Log(fieldsMap.get("src") == $ce.fieldsMap.get("src") , fieldsMap.get("dst") == $ce.fieldsMap.get("dst") , $marker : fieldsMap.get("marker") , (this meets $ce || this during $ce || this metby $ce)) from entry-point "Log stream";
$markerSet : collectSet($marker))
then
System.out.println(drools.getRule().getName());
modify( $ce ) {endUpdate($markerSet)}
end
my questions:
1) If I have only one stream of data , can I omit the use of entry point and insert logs to the session ? Or the use of entry points is mandatory in Drools Fusion?
2) When I tested it with matching data, rule "Create Port Scan Event - update" was never fired. When I replaced "(this meets $ce || this during $ce || this metby $ce)" with "this after $ce.getStartTime() , this before $ce.getEndTime()" everything worked fine.
Why?
3) I tried to use sliding windows in rule "Create Port Scan Event" and an exception was thrown at runtime. I decided to use "this after[0s,5s] $log" instead. Is it correct?
4) Is my basic Implementation correct?
Thank you all very much.
Log class:
public class Log {
public HashMap<String, Object> fieldsMap = new HashMap<>();
}
CorrelatedEvent class:
public class CorrelatedEvent
{
public Map<String, Object> fieldsMap;
private String name;
private Set<String> markersSet;
private long logsCount;
private Calendar startTime;
private Calendar endTime;
private int duration;
private EventsHandler eventsHandler;
public CorrelatedEvent()
{
startTime = Calendar.getInstance();
endTime = Calendar.getInstance();
endTime.setTime(startTime.getTime());
fieldsMap = new HashMap<>();
markersSet = new HashSet<>();
logsCount = 0;
}
public Date getTimestamp()
{
return startTime.getTime();
}
public Date getStartTime()
{
return startTime.getTime();
}
public Date getEndTime()
{
return endTime.getTime();
}
public void setDurationInSec(int duration)
{
this.duration = duration;
endTime.setTime(startTime.getTime());
endTime.add(Calendar.SECOND, duration);
}
public int getDuration()
{
return duration;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
fieldsMap.put("name", name);
}
public void setEventsHandler(EventsHandler eventsHandler)
{
this.eventsHandler = eventsHandler;
}
public void endUpdate(Set<String> markersSet)
{
this.markersSet.addAll(markersSet);
if (this.markersSet.size() > logsCount) {
logsCount = this.markersSet.size();
if (eventsHandler == null)
return;
Map<String, Object> clonedFieldsMap = getClonedFieldsMap();
clonedFieldsMap.put("markers", this.markersSet.toString()); //need a function that converts a set of markers to a "\n" separated list
clonedFieldsMap.put("count", logsCount);
eventsHandler.handleEvent(clonedFieldsMap);
}
}
private Map<String, Object> getClonedFieldsMap()
{
Map<String, Object> clonedFieldsMap = new HashMap<>();
clonedFieldsMap.putAll(fieldsMap);
return clonedFieldsMap;
}
}
11 years, 1 month
Drools 6 and Janino
by rib
Hi there,
I need to replace the JDT compiler with Janino in a project and the only
information within the documentation is this:
NOTE: if you are using Drools in J2EE or servlet containers and you come
across classpath issues with "JDT", then you can switch to the janino
compiler. Set the system property "drools.compiler": For example:
-Ddrools.compiler=JANINO.
After doing this I get compilation problems, so my questions are:
Which version of Janino do I need to include?
The behaviour should be the same as with JDT or are there any other aspects
I have to consider?
Thanks,
Richard
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-6-and-Janino-tp4026318.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 1 month