prasad.pbc wrote:
Hi Guys,
Iam using Eclipse tool for writing drl , i have written drl .
Then i have written an ant script to convert this drl to PKG .
i have used drools5.1.1.jars. i was sucessfully convert drl to pkg.
knowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add( ResourceFactory.newFileResource(
"c:/Sample.pkg" ),
ResourceType.PKG );
iam getting below error:
java.lang.ClassCastException: org.drools.reteoo.ReteooRuleBase cannot be
cast to org.drools.rule.Package
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:487)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at com.test.rules.MyRulesEngine.<init>(MyRulesEngine.java:51)
at com.test.rules.MyRulesEngine.getInstance(MyRulesEngine.java:39)
at com.test.rules.MyRulesExecuter.main(MyRulesExecuter.java:38)
Can anybody help resolving my problem..
Thanks
prasad
Based on the stack trace I would guess that the file Sample.pkg contains a
serialized KnowledgeBase and not a serialized KnowledgePackage. Maybe you
could try to do your export like this:
KnowledgeBase kbase = ...;
KnowledgePackage kpackage = kbase.getKnowledgePackages().iterator().next();
FileOutputStream fos = new FileOutputStream(new File("c:/Sample.pkg"));
DroolsStreamUtils.streamOut(fos, kpackage);
/Mattias
--
View this message in context:
http://drools.46999.n3.nabble.com/Help-needed-tp3224168p3234832.html
Sent from the Drools: User forum mailing list archive at
Nabble.com.