marshaller = MarshallerFactory.newMarshaller( ksession.getKnowledgeBase() );
marshaller.marshall( baos,
ksession );
baos.close();
serializedRulebase = DroolsStreamUtils.streamOut( ruleBase );
session.dispose();
// now recreate the rulebase, deserialize the session and test it
ruleBase = (RuleBase) DroolsStreamUtils.streamIn( serializedRulebase );
marshaller = MarshallerFactory.newMarshaller( new KnowledgeBaseImpl( ruleBase ) );
ksession = (StatefulKnowledgeSessionImpl) marshaller.unmarshall( new ByteArrayInputStream( baos.toByteArray() ),