Using the string you have there and reflection the system tries to load the JavaDialect, as long as its in your classpath it should work. The code to do this is straight forward and is in PackageBuilderConfiguration:
    public DialectRegistry buildDialectRegistry(PackageBuilder packageBuilder) {
        DialectRegistry registry = new DialectRegistry();
        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        for ( Iterator it = this.dialects.entrySet().iterator(); it.hasNext(); ) {
            Entry entry = (Entry) it.next();
            String str = (String) entry.getKey();
            String dialectName = str.substring( str.lastIndexOf( "." ) + 1 );
            String dialectClass = (String) entry.getValue();
            try {
                Class cls = classLoader.loadClass( dialectClass );
                Constructor cons = cls.getConstructor( new Class[]{PackageBuilder.class} );
                registry.addDialect( dialectName,
                                     (Dialect) cons.newInstance( new Object[]{packageBuilder} ) );
            } catch ( Exception e ) {
                throw new RuntimeDroolsException( "Unable to load dialect '" + dialectClass + ":" + dialectName + "'" );
            }
        }
        return registry;
    }

I've know idea why this is failing for you, let me know what you find.

Mark
Ronald R. DiFrango wrote:
All,

I am in the process of migrating my 3.0. project to the 4.x series and when I attempt to run my code I get the following exception when I attempt to load my .drl files:

Caused by: org.drools.RuntimeDroolsException : Unable to load dialect 'org.drools.rule.builder.dialect.java.JavaDialect:java'

Here is my package builder code:

static
    {
        try
        {
            builder = new PackageBuilder();
            builder.addPackageFromDrl( new InputStreamReader( RtvDecisionEngine.class.getResourceAsStream("rtv.drl" ) ) );
            builder.addPackageFromDrl( new InputStreamReader( RtvDecisionEngine.class.getResourceAsStream ("modelDiscrepancyRules.drl" ) ) );
            ruleBase = RuleBaseFactory.newRuleBase();
            ruleBase.addPackage( builder.getPackage() );
        }
        catch(Exception e)
        {
            throw new RuntimeException("Failure loading the Rules", e);
        }
    }


Any thoughts appreciated.

Ron

_______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users