I work on a program which its integrate an engine rule, build with Drools. At the startup of my program I load spreadsheet files with Drools and everything is fine. My class constructor :
public DecisionTable(ApplicationServiceImpl applicationServiceImpl, DecisionTableInputType decisionTableInputType) {
this.applicationServiceImpl = applicationServiceImpl;
if (this.applicationServiceImpl.getDecisionTableConfiguration() == null) {
this.applicationServiceImpl.setDecisionTableConfiguration(KnowledgeBuilderFactory.newDecisionTableConfiguration());
}
this.applicationServiceImpl.getDecisionTableConfiguration().setInputType(decisionTableInputType);
knowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
}
But later in my program, users can upload a file with a primefaces UI, and then I have several exception throw. When I debug step by step my code I go down to class org.drools.compiler.rule.builder.dialect.java.JavaDialectConfiguration on the method "setCompiler" I have the following RuntimeException : "The Eclipse JDT Core jar is not in the classpath" which is throw by a ClassNotFoundException.
public void setCompiler(final CompilerType compiler) {
// check that the jar for the specified compiler are present
if ( compiler == CompilerType.ECLIPSE ) {
try {
Class.forName( "org.eclipse.jdt.internal.compiler.Compiler", true, this.conf.getClassLoader() );
} catch ( ClassNotFoundException e ) {
throw new RuntimeException( "The Eclipse JDT Core jar is not in the classpath" );
}
} else if ( compiler == CompilerType.JANINO ){
try {
Class.forName( "org.codehaus.janino.Parser", true, this.conf.getClassLoader() );
} catch ( ClassNotFoundException e ) {
throw new RuntimeException( "The Janino jar is not in the classpath" );
}
}
switch ( compiler ) {
case ECLIPSE :
this.compiler = CompilerType.ECLIPSE;
break;
case JANINO :
this.compiler = CompilerType.JANINO;
break;
case NATIVE :
this.compiler = CompilerType.NATIVE;
break;
default :
throw new RuntimeException( "value '" + compiler + "' is not a valid compiler" );
}
}
That exception is only throw when I try to load a file after my program has been start. At the startup I do not have exceptions, the setCompiler method is correctly runs. I cannot find the difference, my DecisionTable class is called by the same ApplicationServiceImpl at startup and when I run my code.
Some says the Eclipse JDT Core is missing, but if it is missing, why the program runs correctly at startup ? The engine rule with Drools runs correctly and my engine rules works correctly.
I use primefaces 6, Java JDK 1.7, and I use the Drools following version :
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-ci</artifactId>
<version>7.28.0.Final</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-decisiontables</artifactId>
<version>7.28.0.Final</version>
</dependency>