Unit Test (droolsjbpm-ide-common) org.drools.ide.common.server.util.BRLPersistenceTest.testRoundTrip() performs what you are attempting too. This test passes.<br><br>I am still uncertain why you reference &quot;org.drools.brms&quot; packages in your import statements. What version of Drools are you using?<br>
<br><div class="gmail_quote">2011/9/15 AZZAZ mohamed <span dir="ltr">&lt;<a href="mailto:azzazm@gmail.com">azzazm@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<span style="color:rgb(51, 51, 51);font-family:arial, sans-serif;background-color:rgb(245, 245, 245)"><br><span>I added</span> <span>all</span> <span>necessary</span> <span>jar</span> <span>in the classpath.</span><br>
<span>Here is an</span> <span>excerpt from my</span> <span>code:</span></span><div><span style="color:rgb(51, 51, 51);font-family:arial, sans-serif;background-color:rgb(245, 245, 245)"><span>Just</span> <span>for information</span> <span>I am</span> <span>beginner</span> <span>in</span> <span>BRMS</span></span></div>

<div><span style="color:rgb(51, 51, 51);font-family:arial, sans-serif;background-color:rgb(245, 245, 245)"><span><br></span></span></div><div><span style="background-color:rgb(245, 245, 245)"><span><div>
<font color="#333333" face="arial, sans-serif">/**</font></div><div><font color="#333333" face="arial, sans-serif"> * </font></div><div><font color="#333333" face="arial, sans-serif"> */</font></div>
<div><font color="#333333" face="arial, sans-serif">package fr.dto;</font></div><div><font color="#333333" face="arial, sans-serif">import java.io.*;</font></div><div><font color="#333333" face="arial, sans-serif">import javax.swing.Box.Filler;</font></div>

<div><font color="#333333" face="arial, sans-serif"><br></font></div><div><font color="#333333" face="arial, sans-serif">import org.apache.commons.io.FileUtils;</font></div>
<div><font color="#333333" face="arial, sans-serif">import org.drools.RuleBase;</font></div><div><font color="#333333" face="arial, sans-serif">import org.drools.RuleBaseFactory;</font></div>
<div><font color="#333333" face="arial, sans-serif">import org.drools.WorkingMemory;</font></div><div><font color="#333333" face="arial, sans-serif">import org.drools.brms.server.util.BRDRLPersistence;</font></div>
<div><font color="#333333" face="arial, sans-serif">import org.drools.brms.server.util.BRXMLPersistence;</font></div><div><font color="#333333" face="arial, sans-serif">import org.drools.compiler.PackageBuilder;</font></div>

<div><font color="#333333" face="arial, sans-serif">import org.drools.event.DebugWorkingMemoryEventListener;</font></div><div><font color="#333333" face="arial, sans-serif">import org.drools.rule.Package;</font></div>
<div><font color="#333333" face="arial, sans-serif"><br></font></div><div><font color="#333333" face="arial, sans-serif">/**</font></div><div><font color="#333333" face="arial, sans-serif"> * @author mazzaz</font></div>
<div><font color="#333333" face="arial, sans-serif"> * </font></div><div><font color="#333333" face="arial, sans-serif"> */</font></div><div><font color="#333333" face="arial, sans-serif">public class RulesEngine {</font></div>

<div><font color="#333333" face="arial, sans-serif"><br></font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">        </span>private RuleBase rules;</font></div>
<div><font color="#333333" face="arial, sans-serif">    private Reader source;</font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">        </span>private boolean debug = false;</font></div>

<div><font color="#333333" face="arial, sans-serif"><br></font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">        </span>public RulesEngine(String rulesFile) throws RulesEngineException {</font></div>

<div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                </span>super();</font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                </span>try {</font></div>

<div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                                </span>try</font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                                </span>{</font></div>

<div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                                        </span>File file = null;</font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                                        </span>String brl =null;</font></div>

<div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                                        </span>file = new File(rulesFile);</font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                                        </span>BRXMLPersistence read = (BRXMLPersistence) BRXMLPersistence.getInstance();</font></div>

<div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                </span>            BRDRLPersistence write = (BRDRLPersistence) BRDRLPersistence.getInstance();</font></div>
<div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                                        </span>System.out.println(&quot;read &amp;&amp; write instance ok \n&quot;);</font></div>
<div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                                        </span>brl = FileUtils.readFileToString(file,&quot;UTF-8&quot;);</font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                                        </span>System.out.println(&quot;le fichier contient&quot;+ brl);</font></div>

<div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                                        </span>String outputDRL = write.marshal(read.unmarshal(brl));// code blocked here</font></div>
<div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                                        </span></font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                                        </span>String drlFilePath = &quot;src/main/rules/Test_brl_to_drl.drl&quot;;</font></div>

<div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                                </span></font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                                        </span>File drlFile = new File(drlFilePath);</font></div>

<div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                                        </span></font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                                        </span>FileUtils.writeStringToFile(drlFile,outputDRL,&quot;&quot;);</font></div>

</span></span><span style="color:rgb(51, 51, 51);font-family:arial, sans-serif;background-color:rgb(245, 245, 245)"><span style="white-space:pre-wrap">        </span>                         source = new InputStreamReader(RulesEngine.class</span><span style="background-color:rgb(245, 245, 245)"><span><div>

<font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                        </span></font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                                                </span>.getResourceAsStream(drlFilePath));</font></div>

<div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                                </span>}catch (IOException ie){</font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                                        </span>System.out.println(&quot;ie.getCause(): &quot;+ie.getCause()</font></div>

<div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                                                        </span>+&quot;\n&quot;+&quot;ie.getMessage(): &quot;+ie.getMessage());</font></div><div>
<font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                                </span>}</font></div><div><font color="#333333" face="arial, sans-serif"><br>
</font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                        </span>PackageBuilder builder = new PackageBuilder();</font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                        </span>builder.addPackageFromDrl(source);</font></div>

<div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                        </span>Package pkg = builder.getPackage();</font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                        </span>rules = RuleBaseFactory.newRuleBase();</font></div>

<div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                        </span>rules.addPackage(pkg);</font></div><div><font color="#333333" face="arial, sans-serif"><br>
</font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                </span>} catch (Exception e) {</font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                        </span>throw new RulesEngineException(</font></div>

<div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                                        </span>&quot;Impossible de Compiler le fichier de regles : &quot;</font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                                                        </span>+ rulesFile, e);</font></div>

<div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                </span>}</font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">        </span>}</font></div>
<div><span style="white-space:pre-wrap"><font color="#333333" face="arial, sans-serif">        </font></span></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">        </span>public void executeRules(WorkingEnvironmentCallback callback) {</font></div>

<div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                </span>/*</font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                </span> * L’instanciation de la class workingMemory permet de determiner si</font></div>

<div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                </span> * toute si toute les conditions d’une regle sont remplies alors les</font></div><div>
<font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                </span> * consequences de cette regles sont executées</font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                </span> */</font></div>

<div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                </span>WorkingMemory workingMemory = rules.newStatefulSession();</font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                </span>if (debug) {</font></div>

<div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                        </span>workingMemory</font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                                        </span>.addEventListener(new DebugWorkingMemoryEventListener());</font></div>

<div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                </span>}</font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                </span>callback.initEnvironment(workingMemory);// initEnvironment methode de</font></div>

<div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                                                                                                </span>// l&#39;interface</font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                </span>/*</font></div>

<div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                </span> * L’execution des conséquences d’une regle se produit lorsqu’on invoque</font></div>
<div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                </span> * l’objet fireAllRules WorkingMemory</font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                </span> */</font></div>

<div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">                </span>workingMemory.fireAllRules();</font></div><div><font color="#333333" face="arial, sans-serif"><span style="white-space:pre-wrap">        </span>}</font></div>

<div><font color="#333333" face="arial, sans-serif"><br></font></div><div><font color="#333333" face="arial, sans-serif">}</font></div><div style="color:rgb(51, 51, 51);font-family:arial, sans-serif">
<br></div></span></span></div>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br>