Search code examples
droolsmvel

Drols exception Unable to load dialect 'mvel'


I'm trying to start a rather trivial example

KieContainer kieContainer = KieServices.Factory.get().getKieClasspathContainer();
StatelessKieSession kieSession = kieContainer.newStatelessKieSession("MyStatelessValidationStep");

and at the 2nd line I get an error NullPointerException which seems to be caused by the exception Unable to load dialect 'mvel'. It happens with the latest Drools version 7.57.0.Final but works OK with e.g. 7.39.0.Final. I've listed the docs trying to find out what changed between those versions, but couldn't find the answer. So, is this a bug or I'm missing something new in my source code?

p.s.

Here is a list of the libraries I'm using:

ext {
    drools_version = '7.57.0.Final'
    slf4j_version = '1.7.32'
    mvel_version = '2.4.12.Final'
    junit_version = '5.6.0'
}

@"Roddy of the Frozen Peas", here are the dependencies:

dependencies {
    // https://mvnrepository.com/artifact/org.drools/drools-core
    implementation group: 'org.drools', name: 'drools-core', version: "$drools_version"

    // https://mvnrepository.com/artifact/org.drools/drools-compiler
    implementation group: 'org.drools', name: 'drools-compiler', version: "$drools_version"

    // https://mvnrepository.com/artifact/org.kie/kie-api
    compileOnly group: 'org.kie', name: 'kie-api', version: "$drools_version"

    // https://mvnrepository.com/artifact/org.kie/kie-internal
    implementation group: 'org.kie', name: 'kie-internal', version: "$drools_version"

    // https://mvnrepository.com/artifact/org.slf4j/slf4j-api
    implementation group: 'org.slf4j', name: 'slf4j-api', version: "$slf4j_version"

    // https://mvnrepository.com/artifact/org.slf4j/slf4j-nop
    implementation group: 'org.slf4j', name: 'slf4j-nop', version: "$slf4j_version"

    // https://mvnrepository.com/artifact/org.mvel/mvel2
    implementation group: 'org.mvel', name: 'mvel2', version: "$mvel_version"

    testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
}

Note that if I replace compileOnly with implementation for the kie-api, nothing changes in the final result - I still get NPE.


Solution

  • Since 7.45.0.Final MVEL evaluation has been moved to a separated module called drools-mvel, see the release notes. Please add that module as well or use instead the aggregator module drools-engine-classic