Greetings!

I am attempting to run the HelloWorld example for Drools 4.  I have Eclipse 3.3 
setup on Windows with the Drools plugin.  I have created a project with the 
Drools examples and added all the Drools .jar files to the project.  Everything 
compiles.  When I initially ran HelloWorldExample.java it appeared that it 
could not find the HelloWorld.drl file.  So, I moved that file into the same 
directory as HelloWorldExample.java and ran again.  This time I am getting an 
error that the JDT compiler is not found even though it appears that there are 
JDT jar files in the Eclipse plugins.

I also attempted to run this example under Linux from the command line.  In 
this case I placed all the Drools .jar files into the JRE ext folder and 
changed the source code to use the Janino compiler by adding:

//  Set up for the Janino compiler, not Eclipse
System.setProperty("drools.dialect.java.compiler", "JANINO");
PackageBuilderConfiguration cfg = new PackageBuilderConfiguration();
JavaDialectConfiguration javaConf = 
(JavaDialectConfiguration)cfg.getDialectConfiguration("java");

This version compiles with javac and runs with java -cp . HelloWorldExample but 
gives me an error within the compiler while compiling the .drl file:

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String 
index out of range: -1
        at java.lang.String.substring(String.java:1938)
        at 
org.drools.base.ClassTypeResolver.importClass(ClassTypeResolver.java:242)
        at 
org.drools.base.ClassTypeResolver.resolveType(ClassTypeResolver.java:158)
        at 
org.drools.rule.builder.dialect.mvel.MVELDialect.addImport(MVELDialect.java:257)
        at 
org.drools.compiler.DialectRegistry.addImport(DialectRegistry.java:98)
        at 
org.drools.compiler.PackageBuilder.mergePackage(PackageBuilder.java:377)
        at 
org.drools.compiler.PackageBuilder.newPackage(PackageBuilder.java:350)
        at 
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:267)
        at 
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:167)
        at HelloWorldExample.main(HelloWorldExample.java:39)

It is dying on this line:

builder.addPackageFromDrl( source );

My version of HelloWorldExample.java the same as the given example except for 
the addition of the lines above for Janino.  My ultimate goal is to run this 
all under Linux, I am not an Eclipse user.

Any help getting this working would be greatly appreciated!

Ron



_________________________________________________________________
Introducing Live Search cashback .  It's search that pays you back!
http://search.live.com/cashback/?&pkw=form=MIJAAF/publ=HMTGL/crea=introsrchcashback
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to