Non Maven Rules Project - Exception in thread "main" java.lang.RuntimeException: Cannot find a default KieSession

791 views Asked by At

For Testing drools application, I created 3 non-maven java projects one containing models/pojos, one containing .drl files for rules and one for testing the rules. In test projects jars created from model project and rules project have been supplied. When the test class is run, I get the following error.

Exception in thread "main" java.lang.RuntimeException: Cannot find a default KieSession
    at org.drools.compiler.kie.builder.impl.KieContainerImpl.findKieSessionModel(KieContainerImpl.java:538)
    at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:531)
    at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:514)
    at com.cft.hogan.deposits.knowledge.shared.BaseTest.createDefaultSession(BaseTest.java:31)
    at com.cft.hogan.deposits.knowledgetest.ClassifyItemsTest.main(ClassifyItemsTest.java:129)

In test project I supplied the following drools jars.

antlr-runtime-3.5.jar            kie-internal-6.3.0.Final.jar
commons-codec-1.4.jar            mockito-core-2.0.5-beta.jar
drools-compiler-6.3.0.Final.jar  mvel2-2.2.6.Final.jar
drools-core-6.3.0.Final.jar      objenesis-2.1.jar
ecj-4.3.1.jar                    protobuf-java-2.5.0.jar
hamcrest-core-1.3.jar            slf4j-api-1.7.2.jar
hamcrest-library-1.3.jar         xmlpull-1.1.3.1.jar
junit-4.11.jar                   xpp3_min-1.1.4c.jar
kie-api-6.3.0.Final.jar          xstream-1.4.7.jar
1

There are 1 answers

0
kushwah_a On BEST ANSWER

Classpath entry was the problem

<classpathentry excluding="**" kind="src" path="src/main/resources"/> (incorrect)

<classpathentry kind="src" path="src/main/resources"/> (Correct)

After making the above adjustment in .classpath file it worked on eclipse as well as in the executable jar manner. Though I started getting different error on ZOS for which I have created a separate thread. .drl file giving runtime error on zos