KnowledgeAgent exception while trying to deserialize KnowledgeDefinitionsPackage thrown by a Rules service
eleni.papadopoulou Jan 2, 2013 3:31 PMHi,
I have implemented a Rules service which uses a KnowldgeAgent and also references the rules through a ChangeSet.xml file.
This service is invoked by another switchyard service, but when this happens I get the following exception:
KnowledgeAgent exception while trying to deserialize KnowledgeDefinitionsPackage : java.lang.RuntimeException: KnowledgeAgent exception while trying to deserialize KnowledgeDefinitionsPackage
Caused by: java.net.UnknownHostException: C
The ChangeSet.xml tries to load the rules from a package which contains two drl files and I have implemented this package using the following code:
File file=null;
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.batch().add( ResourceFactory.newClassPathResource("ValidateCharging.drl", RulesPackageCreator.class), ResourceType.DRL).add(ResourceFactory.newClassPathResource("ValidateBillingType.drl", RulesPackageCreator.class),ResourceType.DRL).build();
if ( kbuilder.hasErrors() ) {
System.err.println( kbuilder.getErrors().toString() );
}
KnowledgePackage knowledgePackage = kbuilder.getKnowledgePackages().iterator().next();
FileOutputStream fos = null;
ObjectOutputStream out = null;
file = new File("myRulesPackage.pkg");
fos = new FileOutputStream(file);
try
{
DroolsStreamUtils.streamOut(fos, knowledgePackage);
}
catch (IOException e)
{
System.out.println("Cannot serialize object");
throw new Exception(e);
}
finally
{
try
{
fos.close();
}
catch (IOException e)
{
System.out.println("Exception: "+e);
}
}
The drools version I used to compile the package is the same with the version I used to execute the package, as I created a new Eclipse Drools Runtime environment, pointing to modules/org/drools/main directory.
Attached you can find the ChangeSet.xml file and the Switchyard.xml file.
Thank you in advance!!
-
switchyard.xml 2.4 KB
-
MyChangeSet.xml 440 bytes