Does that rule work before unmarshalling?<br><br>I assume &quot;productPricer&quot; is the global but it is undefined in the DRL fragment you paste.<br><br>You&#39;d need to include a &quot;variables&quot; entry in the RuleSet section. See section &quot;2.4.4.2. Rule Set Entries&quot; in <a href="http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html/ch02.html#d0e1157">http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html/ch02.html#d0e1157</a>.<br>
<br>If what you provided was incomplete and you already do this, the problem could be elsewhere.<br><br><div class="gmail_quote">On 7 January 2013 16:41, Ormond, Alex C. (GDLP) <span dir="ltr">&lt;<a href="mailto:ACOrmond@greatdanetrailers.com" target="_blank">ACOrmond@greatdanetrailers.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks for the response.  The first rule table in the spreadsheet<br>
(kinda) looks like this:<br>
<br>
RuleTable Constants<br>
NAME    CONDITION       ACTION  ACTION<br>
<br>
        eval(! productPricer.isConstantsSet($1) )<br>
productPricer.setConstant($1, $2);<br>
productPricer.setConstantsSet($1);<br>
Rule Name       Set?<br>
ProductName     TRUE    &quot;NAME&quot;, &quot;Champion CL&quot;<br>
DefaultCost     TRUE    &quot;COST&quot;, &quot;80000&quot;<br>
DefaultPrice    TRUE    &quot;PRICE&quot;, &quot;100000&quot;<br>
DefaultLength   TRUE    &quot;LENGTH&quot;, &quot;53&quot;<br>
Done    TRUE            TRUE<br>
<br>
<br>
The first rule generated looks like this:<br>
<br>
rule &quot;ProductName&quot;<br>
        when<br>
                eval(! productPricer.isConstantsSet() )<br>
        then<br>
                productPricer.setConstant(&quot;NAME&quot;, &quot;Champion CL&quot;);<br>
end<br>
<br>
<br>
Alex<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
-----Original Message-----<br>
From: <a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a><br>
[mailto:<a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a>] On Behalf Of Wolfgang Laun<br>
Sent: Monday, January 07, 2013 11:22 AM<br>
To: Rules Users List<br>
Subject: Re: [rules-users] unmarshal global variable<br>
<br>
The crucial info is: what is in the first table, how do you insert this<br>
data?<br>
Is it a DRL global? A fact? How does the (generated) rule look like?<br>
-W<br>
<br>
On 07/01/2013, acormond &lt;<a href="mailto:acormond@greatdanetrailers.com">acormond@greatdanetrailers.com</a>&gt; wrote:<br>
&gt; Gentlepeople,<br>
&gt;<br>
&gt; I am fairly new to Drools and have what I hope is a simple question.<br>
I am<br>
&gt; attempting to marshal (serialize) a Drools knowledge session and then<br>
&gt; unmarshall it.  The marshalling works but the unmarshalling fails with<br>
a<br>
&gt; null pointer exception.  The error is apparently with unmarshalling a<br>
&gt; global<br>
&gt; variable in the session.<br>
&gt;<br>
&gt; The session is created from a spreadsheet (decision table).  This<br>
&gt; spreadsheet<br>
&gt; has two RuleTables.  The first of these exists solely so that I can<br>
enter<br>
&gt; some<br>
&gt; constants into the session, specifically the name and price of the<br>
product<br>
&gt; the<br>
&gt; spreadsheet is dealing with.  The second ruletable is where the rules<br>
are<br>
&gt; specified.  The exception occurs when unmarshalling the first rule in<br>
the<br>
&gt; first<br>
&gt; rule table.  If, as a test, I eliminate the first rule table, then I<br>
can<br>
&gt; successfully marshal and unmarshall the session.<br>
&gt;<br>
&gt; The marshalling is done using the following, simplified, code:<br>
&gt;<br>
&gt;   Marshaller marshaller = MarshallerFactory.newMarshaller(kbase);<br>
&gt;   File droolsSessionFile = new File(MARSHAL_FILE);<br>
&gt;   foStream = new FileOutputStream(droolsSessionFile);<br>
&gt;   baos = new ByteArrayOutputStream();<br>
&gt;   marshaller.marshall(baos, ksession);<br>
&gt;   baos.writeTo(foStream);<br>
&gt;<br>
&gt; and the unmarshalling is done like this:<br>
&gt;<br>
&gt;   Marshaller marshaller =<br>
&gt; MarshallerFactory.newMarshaller(pricingProcessor.getKnowledgeBase());<br>
&gt;   FileInputStream fis = new FileInputStream(MARSHAL_FILE);<br>
&gt;   StatefulKnowledgeSession ksession = marshaller.unmarshall(fis);<br>
&gt;<br>
&gt;<br>
&gt; So, where did I go wrong?  Perhaps I need to deal with the global<br>
variable<br>
&gt; differently, perhaps by putting it in the knowledgeBase before I<br>
unmarshall<br>
&gt; the session?<br>
&gt;<br>
&gt; Thank you for any help.<br>
&gt;<br>
&gt; Alex Ormond<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; View this message in context:<br>
&gt;<br>
<a href="http://drools.46999.n3.nabble.com/unmarshal-global-variable-tp4021375.ht%0Aml" target="_blank">http://drools.46999.n3.nabble.com/unmarshal-global-variable-tp4021375.ht<br>
ml</a><br>
&gt; Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;<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>
<br>
<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>
</div></div></blockquote></div><br>