How to Use Stateless Session in Drools 6.2.0

1,097 views
Skip to first unread message

Ashish Soni

unread,
Jul 15, 2015, 3:01:48 PM7/15/15
to drools...@googlegroups.com

I am not sure how can i use the Stateless session when using Drools 6.2.0 as there is no good documentation i have placed my empty kmodule inside META-INF and my DRL rule file is inside  my package com.test.sample and when i run this outside of eclipse it gives below error

5/07/15 14:57:46 INFO scheduler.TaskSetManager: Lost task 10.1 in stage 0.0 (TID 11) on executor 10.200.37.158: java.lang.RuntimeException (Error while creating KieBase[Message [id=1, level=ERROR, path=org/drools/compiler/lang/dsl/rule1.drl, line=3, column=0
   text=[ERR 107] Line 3:0 mismatched input 'expander' expecting one of the following tokens: '[package, import, global, declare, function, rule, query]'.], Message [id=2, level=ERROR, path=org/drools/compiler/lang/dsl/rule1.drl, line=8, column=0
   text=[ERR 102] Line 8:13 mismatched input '1' in rule "new rule"], Message [id=3, level=ERROR, path=org/drools/compiler/lang/dsl/rule1.drl, line=0, column=0
   text=Parser returned a null Package]]) [duplicate 1]

Ashish Soni

unread,
Jul 15, 2015, 4:43:32 PM7/15/15
to drools...@googlegroups.com
Any one can explain as i have tried all the possible combination and done everything as per the documentation but still i get an error

java.lang.RuntimeException: Cannot find a default StatelessKieSession

Ashish

Mark Proctor

unread,
Jul 15, 2015, 6:11:44 PM7/15/15
to drools...@googlegroups.com
You're drl is not compiling, so the ksession cannot be built and thus cannot be found.

Mark
--
You received this message because you are subscribed to the Google Groups "Drools Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage...@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/d1354f86-5011-4191-864f-0a67e2314c66%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andreas Razmyslov

unread,
Nov 22, 2016, 1:06:20 PM11/22/16
to Drools Usage
Hallo Ashish,

i'm using Drools 6.5.0 for one of my projects and have exactly the same problem. Were you able to solve it?

Greetings
Andreas

Oleksandr Lytvyn

unread,
May 18, 2017, 1:43:34 PM5/18/17
to Drools Usage
Hey guys,

I have exactly the same issue as you. If I run the project from Eclipse, it works. Once I package a jar file (I tried tons of different ways to package) and run it as "java -jar ...", I get this "mismatched input '1' in rule "new rule"" error.

Were you able to solve it?

Thank you,
Olek

Parveen Chhikara

unread,
May 19, 2017, 1:25:58 PM5/19/17
to Drools Usage
@Lytvyn - I am facing the same behaviour. It is working fine in eclipse but not with jar. Please let me know if you find any solution. 

Dmitry Antonov

unread,
Aug 30, 2017, 4:34:53 AM8/30/17
to Drools Usage
Had the same issue with 7.1 - while debugging or packaging into separate jar's all works ok, but as soon as I packaged into a single jar with embedded dependencies, started getting the issue as in the original post.

I think it's caused by this file /org/drools/compiler/lang/dsl/rule1.drl which gets automatically picked up by the drools compiler.
As a workaround I've set packages property of kbase in kmodule.xml to point to my .drl location (note that's a path, not package name) as <kbase name="KBase1" default="true" eventProcessingMode="stream" equalsBehavior="equality" packages="org.package.folder">, now the dummy .drl gets filtered out. Before I had .drl in the resources folder and it was working fine automagically, however in order to make this work I had to move .drl out and tweak pom.xml with custom resources declarations. Now I like it even better than before, the packages attribute gives some flexibility.

As a side note, it seems to me that rule1.drl file shouldn't be included in the drools compiler package, however I'm just starting with drools and not 100% sure, its content is quite meaningless though.

~Dmitry
Reply all
Reply to author
Forward
0 new messages