私はアンドロイドではDroolsの実装に取り組んでいます、問題で立ち往生DroolsのAndroidの統合
java.lang.RuntimeException:活動ComponentInfo {com.decurtis.drooldemo/com.decurtis.drooldemo.MainActivityを開始することができません}:java.lang.RuntimeException:コンストラクタpublic org.drools.android.DexPackageClassLoader(org.drools.core.rule.JavaDialectRuntimeData、java.lang.ClassLoader)を使用して、クラス 'org.drools.android.DexPackageClassLoader'のオブジェクトをインスタンス化できません。 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646) とandroid.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)の にあります。でandroid.app.ActivityThread.-wrap12(ActivityThread.java) android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1460) (android.os.Handler.dispatchMessage(Handler.java:102) )にあります。 android.os.Looper.loop(Looper.java:154) android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(ネイティブメソッド) at com。 android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:866) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756) によって引き起こされる:java.lang.RuntimeException:できないclaのオブジェクトをインスタンス化するコンストラクタを持つss 'org.drools.android.DexPackageClassLoader' public org.drools.android.DexPackageClassLoader(org.drools.core.rule.JavaDialectRuntimeData、java.lang.ClassLoader) at org.drools.core.util.ClassUtils.instantiateObject ORGでorg.drools.core.rule.JavaDialectRuntimeData.onAdd(JavaDialectRuntimeData.java:243) で(ClassUtils.java:272)org.drools.core.rule.JavaDialectRuntimeData.makeClassLoader(JavaDialectRuntimeData.java:618)で (JavaDialect.java:187) org.drools.compiler.builder.impl.KnowledgeBuilderConfi (PackageRegistry.java:55) (org.drools.compiler.builder.impl.KnowledgeBuilderImpl.newPackage(KnowledgeBuilderImpl.java:1571))。 org.droolsでorg.drools.compiler.builder.impl.KnowledgeBuilderImpl.createPackageRegistry(KnowledgeBuilderImpl.java:1015) でorg.drools.compiler.builder.impl.KnowledgeBuilderImpl.initPackageRegistry(KnowledgeBuilderImpl.java:1044) で) .compiler.builder.impl.CompositeKnowledgeBuilderImpl.initPackageRegistries(CompositeKnowledgeBuilderImpl.java:297) at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.buildPackages(CompositeKnowl (AbstractKieModule.java:AbstractBieilderImpl.java:116) at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.build(CompositeKnowledgeBuilderImpl.java:105) at org.drools.compiler.kie.builder.impl.AbstractKieModule.buildKnowledgePackages (KieBuilderImpl.java:230) at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:198) at com.decurtis.drooldemo.MainActivity.kieExecute63(MainActivity.java:81) at com.decurtis.drooldemo。主な活動。android.app.ActivityThread.performLaunchActivityでandroid.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118) でandroid.app.Activity.performCreate(Activity.java:6662) でのonCreate(MainActivity.java:41) ( android.app.ActivityThread $ H.handleMessageでandroid.app.ActivityThread.-wrap12(ActivityThread.java) でandroid.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707) でActivityThread.java:2599) (ActivityThread .java:1460 android.os.Looper.loop(Looper.java:154でandroid.os.Handler.dispatchMessage(Handler.java:102) で) ) のandroid.app.ActivityThread.main(ActivityThread.java:6077) のjava.lang.reflect.Method.invoke(ネイティブメソッド) at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java :によって引き起こさcom.android.internal.os.ZygoteInit.main(ZygoteInit.java:756) における866) :java.lang.reflect.Constructor.newInstance0(ネイティブメソッドでにjava.lang.reflect.InvocationTargetException ) java.lang.reflect.Constructor.newInstance(Constructor.java:430) at org.drools.core.util.ClassUtils.instantiateObject(ClassUtils.java:270) at org.drools.core.rule.JavaDialectRuntimeData.m akeClassLoader(JavaDialectRuntimeData.java:618) at org.drools.core.rule.JavaDialectRuntimeData.onAdd(JavaDialectRuntimeData.java:243) at org.drools.compiler.rule.builder.dialect.java.JavaDialect。(JavaDialect.java :187) at org.drools.compiler.rule.builder.dialect.java.JavaDialectConfiguration.newDialect(JavaDialectConfiguration.java:91) at org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl.buildDialectRegistry(KnowledgeBuilderConfigurationImpl.java:392) ) at org.drools.compiler.compiler.PackageRegistry。(PackageRegistry.java:55) at org.drools.compiler.builder.impl.KnowledgeBuilderImpl.newPackage(KnowledgeBuilderImpl.java:1571) org.drools.compiler.builder.impl.KnowledgeBuilderImpl.initPackageRegistry(KnowledgeBuilderImpl.java:1044) at org.drools.compiler.builder.impl.KnowledgeBuilderImpl.createPackageRegistry(KnowledgeBuilderImpl.java:1015) at org.drools.compiler org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImplでorg.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.buildPackagesで.builder.impl.CompositeKnowledgeBuilderImpl.initPackageRegistries(CompositeKnowledgeBuilderImpl.java:297) (CompositeKnowledgeBuilderImpl.java:116) org.drools.compiler.kie.builder.impl.AbstractKieModule.buildKnowledgePackagesで.build(CompositeKnowledgeBuilderImpl.java:105) (AbstractKieModule.java:244) at org.drools.compiler.kie.builder.impl.AbstractKieProject.verify(AbstractKieProject.java:64) at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildKieProject(KieBuilderImpl.java:230) at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:198) com.decurtis.drooldemo.MainActivity.kieExecute63(MainActivity.java:81) at com.decurtis.drooldemo.MainActivity。 onCreate(MainActivity.java:41) android.app.Activity.performCreate(Activity.java:6662) android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118) android.app.ActivityThread.performLaunchAc tivity(ActivityThread。Javaの:2599)android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707で )android.app.ActivityThread.-wrap12 android.app.ActivityThread $ H.handleMessageで(ActivityThread.java) で (ActivityThread.java :1460) android.os.Handler.dispatchMessage(Handler.java:102) (android.os.Looper.loop(Looper.java:154) 、android.app.ActivityThread.main(ActivityThread.java:6077) ) at java.lang.reflect.Method.invoke(ネイティブメソッド) at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:866) at com.andr oid.internal.os.ZygoteInit.main(ZygoteInit.java:756) 原因:java.lang.NullPointerException:仮想メソッド 'java.lang.String java.io.File.getAbsolutePath()'をnullで呼び出そうとしていますオブジェクト参照 at org.drools.android.MultiDexClassLoader。(MultiDexClassLoader.java:70) 07-27 04:43:48.294 16631-16631/com.decurtis.drooldemo E/AndroidRuntime:at org.drools.android.DexPackageClassLoader。 (DexPackageClassLoader.java:44)
コード:私はdrools 6.5.0バージョンを使用しており、上記のエラーが発生しています。
KieServices ks = KieServices.Factory.get();
KieRepository kr = ks.getRepository();
KieFileSystem kfs = ks.newKieFileSystem();
kfs.write(ResourceFactory.newClassPathResource("rules/Fire.drl", Fire.class));
KieBuilder kb = ks.newKieBuilder(kfs);
kb.buildAll(); // kieModule is automatically deployed to KieRepository if successfully built.
if (kb.getResults().hasMessages(Message.Level.ERROR)) {
throw new RuntimeException("Build Errors:\n" + kb.getResults().toString());
}
KieContainer kContainer = ks.newKieContainer(kr.getDefaultReleaseId());
KieSession kSession = kContainer.newKieSession();
System.out.println("Fire All Rules...");
kSession.fireAllRules();
kSession.dispose();
このエラーが発生したことがありますか?