[rules-users] XStream, Pipeline

Bertrand Grottier b_grottier at hotmail.com
Thu Mar 11 08:54:54 EST 2010


Hello,

I still have a problem loading facts using XStream. The last line of the following code triggers a com.thoughtworks.xstream.mapper.CannotResolveClassException.

            // load up the knowledge base
            KnowledgeBase kbase = readKnowledgeBase();
            StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession();
            
            // Make the results, in this case the FactHandles, available to the user
            Action executeResultHandler = PipelineFactory.newExecuteResultHandler();

            // Insert the transformed object into the session associated with the PipelineContext
            KnowledgeRuntimeCommand insertStage = PipelineFactory.newStatefulKnowledgeSessionInsert();
            insertStage.setReceiver( executeResultHandler );
                
            // Create the transformer instance and create the Transformer stage, where we are going from Xml to Pojo.
            XStream xstream = new XStream();
            Transformer transformer = PipelineFactory.newXStreamFromXmlTransformer( xstream );
            transformer.setReceiver( insertStage );

            // Create the start adapter Pipeline for StatefulKnowledgeSessions
            Pipeline pipeline = PipelineFactory.newStatelessKnowledgeSessionPipeline( ksession );
            pipeline.setReceiver( transformer );

            // Instantiate a simple result handler and load and insert the XML
            ResultHandlerImpl resultHandler = new ResultHandlerImpl();
            InputStream is = new FileInputStream("D:/workspaces/prise_main_drools/src/main/rules/lproduits.xml");
            pipeline.insert( is, resultHandler );

Any idea ?
Thank you in advance.
Regards,
Benoît


 		 	   		  
_________________________________________________________________
Consultez gratuitement vos emails Orange, Gmail, Free, ... directement dans HOTMAIL !
http://www.windowslive.fr/hotmail/agregation/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100311/feea659d/attachment.html 


More information about the rules-users mailing list