Drools错误及相关资源文档

Exception in thread "main" java.lang.NoSuchMethodError: org.antlr.runtime.Lexer.<init>(Lorg/antlr/runtime/CharStream;Lorg/antlr/runtime/RecognizerSharedState;)V
    at org.drools.lang.DRLLexer.<init>(DRLLexer.java:180)
    at org.drools.lang.DRLLexer.<init>(DRLLexer.java:177)
    at org.drools.compiler.DrlParser.getParser(DrlParser.java:318)
    at org.drools.compiler.DrlParser.parse(DrlParser.java:142)
    at org.drools.compiler.DrlParser.parse(DrlParser.java:148)
    at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:287)
    at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:488)
    at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
    at com.huawei.Test.main(Test.java:28)

KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
        File f = new File("D:\\wKF19407\\WV_WorkPlace\\yingxiao20100108\\hadoop\\test.drl");
        if(f.exists()){
            System.out.println("file exist!");
        }
        kbuilder.add(ResourceFactory.newFileResource(f), ResourceType.DRL);
        Collection<KnowledgePackage> kpackage = kbuilder.getKnowledgePackages();
        KnowledgeBaseConfiguration kbConf = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
        kbConf.setProperty("org.drools.sequential", "true");
        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(kbConf);
        kbase.addKnowledgePackages(kpackage);// 将KnowledgePackage集合添加到KnowledgeBase当中
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
        HashMap<String, Integer> keys = new HashMap<String, Integer>();
        keys.put("汽车", 5);
        keys.put("旅游", 5);
        keys.put("互联网", 11);
        keys.put("IT", 12);
        
        UserKeys userKeys = new UserKeys();
        
        userKeys.setUserID("王伟Id");
        
        List<FactHandle> lf = new ArrayList<FactHandle>();
        lf.add(ksession.insert(userKeys));
        ksession.fireAllRules();
        for (FactHandle handle : lf)
        {
            ksession.retract(handle);
        }

 

你可能感兴趣的:(java,hadoop,互联网,F#,旅游)