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

Edson Tirelli tirelli at post.com
Sun Sep 21 13:02:52 EDT 2008


   This is always related to classpath problems. Make sure you have all
dependencies set in your classpath and if that does not work, maybe make an
example project with the error available somewhere that another person can
take a look at it. (don't think you can send zip attachements to the list,
but not sure).

   Eclipse-plugin embeds a series of dependency jars that are transparently
added to the classpath. That is the major reason you may see the problem
outside of eclipse, but not inside. Classloader configuration is also
another reason.

   []s
   Edson

2008/9/18 Soterro <send_lotsa_spam_here at yahoo.com>

> 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
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
Edson Tirelli
JBoss Drools Core Development
JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080921/b69d2429/attachment.html 


More information about the rules-users mailing list