[rules-users] Unable to load dialect java from Ant task

Soterro send_lotsa_spam_here at yahoo.com
Thu Sep 18 18:45:34 EDT 2008


Hi all,

I have a perfectly running Eclipse 3.3 with DRools 4.0.4 and JDK 1.5.14. 
The rules are compiled with a post build Ant task which uses Janino (need it for Tomcat compatibility).
Now OUTSIDE Eclipse it seems I cannot use that Ant task to save my life :(
I tried switching from Janino to the default compiler, same thing. I always get this infamous error:

 BUILD FAILED
 E:\buildRules-hudson.xml:30: RuleBaseTask failed: Unable to load dialect 
 'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java'
	at com.csc.ezbook.eztarif.rules.DroolsCompilerAntTaskStandalone.execute
	(DroolsCompilerAntTaskStandalone.java:163)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
	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:585)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java
	:105)
	at org.apache.tools.ant.Task.perform(Task.java:348)
 [...]
 Caused by: org.drools.RuntimeDroolsException: Unable to load dialect  'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java'
	at org.drools.compiler.PackageBuilderConfiguration.addDialect(
	PackageBuilderConfiguration.java:152)
	at org.drools.compiler.PackageBuilderConfiguration.
	buildDialectConfigurationMap(PackageBuilderConfiguration.java:140)
	at org.drools.compiler.PackageBuilderConfiguration.init(
	PackageBuilderConfiguration.java:117)
	at org.drools.compiler.PackageBuilderConfiguration.<init>(
	PackageBuilderConfiguration.java:94)
	at com.my.app.rules.DroolsCompilerAntTaskStandalone.getPackageBuilder(
	DroolsCompilerAntTaskStandalone.java:257)
	at com.my.app.rules.DroolsCompilerAntTaskStandalone.execute(
	DroolsCompilerAntTaskStandalone.java:136)

That "DroolsCompilerAntTaskStandalone" is my task using the default compiler like this:
    PackageBuilderConfiguration conf = new PackageBuilderConfiguration();
    conf.setClassLoader( loader );
    PackageBuilder builder = new PackageBuilder( conf );

If I use Janino like below the error is exactly the same...
    PackageBuilderConfiguration pkgBuilderCfg = new 
    PackageBuilderConfiguration();
    pkgBuilderCfg.setClassLoader( loader );
    JavaDialectConfiguration javaConf = (JavaDialectConfiguration) 
    pkgBuilderCfg.getDialectConfiguration( "java" );
    javaConf.setCompiler( JavaDialectConfiguration.JANINO );
    PackageBuilder builder = new PackageBuilder( pkgBuilderCfg );

Again, in Eclipse all is working fine. I checked Ant's classpath, here it is:
 E:\apache-ant-1.7.0\bin\..\lib\ant-launcher.jar 
 E:\apache-ant-1.7.0\lib\*.jar 
 C:\Program Files\Java\jdk1.5.0_14\lib\tools.jar 

Here is how I provide a classpath:
	<taskdef name="rulescompiler" classname="com.my.app.rules.
	DroolsCompilerAntTaskStandalone" classpathref="droolsutils.classpath" />

	<target depends="newfilesarethere" name="build" unless="rulesCompile.
	notRequired">
		<rulescompiler srcdir="${THIS_PROJ}/src/com/my/app/rules" 
		               tofile="${THIS_PROJ}/build/classes/com/my/app/rules/
		               packaged.rules"
		               classpathref="droolsutils.classpath" >
		    <include name="*.drl" />
		</rulescompiler>
	</target>

The classpath I provide contains pretty much all libraries I use normally in the project, but I tried even to add ALL jar's from the Eclipse 3.3 install directory (that would include all DRools 4.0.4 libraries, with antlr and whatnot)

I tried also with DRools 4.0.7, same behaviour...

What does that mean and where is it coming from? Could it have issues with the tools.jar from Java 1.5.0_14? 

Thank you for any input,
M


      



More information about the rules-users mailing list