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

Justin Case send_lotsa_spam_here at yahoo.com
Mon Sep 22 03:18:37 EDT 2008


Thanks a lot for the answer. The problem is exactly that one: how could I know what the dependencies for the DRools compiler are?! I thought this list would know :)) Anyway, I'll print out the Eclipse runtime classpath and compare them two to see what stands out. 

The Ant task is mentioned here and there in the documentation (albeit without examples) so I kinda thought more people are using it. An older thread of this same list talks about adding (only) the drools-ant to the classpath, which of course solves the ant task itself but none of its dependencies... I find it difficult to believe that the compiler depends on some Eclipse stuff, especially after I added ALL the jars existing in the Eclipse configuration. The only thing I cannot directly rule out is the classloader issue, but that's also the only thing I have no idea how to debug/solve :(

Thank you,
M

--- On Sun, 9/21/08, Edson Tirelli <tirelli at post.com> wrote:
> 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


      



More information about the rules-users mailing list