Hi Jen,<br><br>I am not sure why do you get the nullpointer exception.<br>As far as I know you shouldn&#39;t serialize the Marshaller. Just re-create it. The serializableMarshaller is stateless.<br><br>Regards,<br>Michal<br>
<br><br><div class="gmail_quote">On Sun, Jul 12, 2009 at 5:00 PM, LadyCode <span dir="ltr">&lt;<a href="mailto:j_whittlesea@hotmail.com">j_whittlesea@hotmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Hi Michal,<br>
<br>
With regard to point 2, the StackOverflowException was thrown based on<br>
standard Java stack size and not from within the DroolsObject stream as I<br>
thought. Increasing the stack size allowed me to serialise the full<br>
KnowledgeBase with noticable speed results.<br>
<br>
I am keen to do things &#39;properly&#39; though so on to point 3....<br>
<br>
The method &#39;createSerializableMarshaller&#39; in MarshallingTest.java takes a<br>
KnowledgeBase as parameter. So I create a Marshaller and .marshall the<br>
StatefulKnowledgeSession. No problems.<br>
<br>
Then to unmarshall I create a new Marshaller? but I no longer have the same<br>
knowledgeBase and a null pointer exception is thrown when I use<br>
marshaller.unmarshall.<br>
<br>
java.lang.NullPointerException<br>
        at<br>
org.drools.common.ConcurrentNodeMemories.getNodeMemory(ConcurrentNodeMemories.java:69)<br>
        at<br>
org.drools.common.AbstractWorkingMemory.getNodeMemory(AbstractWorkingMemory.java:1534)<br>
        at<br>
org.drools.marshalling.impl.InputMarshaller.readFactHandles(InputMarshaller.java:334)<br>
        at<br>
org.drools.marshalling.impl.InputMarshaller.readSession(InputMarshaller.java:207)<br>
        at<br>
org.drools.marshalling.impl.DefaultMarshaller.unmarshall(DefaultMarshaller.java:75)<br>
        at<br>
org.drools.marshalling.impl.DefaultMarshaller.unmarshall(DefaultMarshaller.java:47)<br>
<br>
<br>
Or am I misunderstanding... should I be able to serialise the Marshaller<br>
created in createSerializableMarshaller? This would make sense by the name!!<br>
How do I serialise it? DroolsObjectOutputStream?<br>
<br>
Regards,<br>
<br>
Jen<br>
<div><div></div><div class="h5"><br>
<br>
<br>
Michal Bali-2 wrote:<br>
&gt;<br>
&gt; Hi Jen,<br>
&gt;<br>
&gt; To answer your 3. point. You can create a serializable marshaller like<br>
&gt; this:<br>
&gt;<br>
&gt; MarshallerFactory.newSerializeMarshallingStrategy( acceptor );<br>
&gt;<br>
&gt; You can find complete examples here:<br>
&gt; <a href="http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/MarshallingTest.java" target="_blank">http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/MarshallingTest.java</a><br>

&gt;<br>
&gt; Best regards,<br>
&gt; Michal<br>
&gt;<br>
&gt;<br>
&gt; On Sat, Jul 11, 2009 at 11:55 PM, LadyCode &lt;<a href="mailto:j_whittlesea@hotmail.com">j_whittlesea@hotmail.com</a>&gt;<br>
&gt; wrote:<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt; Hi,<br>
&gt;&gt;<br>
&gt;&gt; I have written a Java application that reads in approximately 6000 .dslr<br>
&gt;&gt; rules at runtime. This takes around 6minutes, however I have installed<br>
&gt;&gt; the<br>
&gt;&gt; application on the target (rather old!) machine and load time is in<br>
&gt;&gt; excess<br>
&gt;&gt; of 20minutes. I have been trying without success to find a way to speed<br>
&gt;&gt; up<br>
&gt;&gt; loading:<br>
&gt;&gt;<br>
&gt;&gt; I have tried:<br>
&gt;&gt;<br>
&gt;&gt; 1. Serialising the KnowledgePackages themselves. This works well but has<br>
&gt;&gt; limited effect on load time.<br>
&gt;&gt; 2. Serialising the KnowledgeBase, this does not seem to work on large<br>
&gt;&gt; rule<br>
&gt;&gt; bases and fails with StackOverflowException when I load more than about<br>
&gt;&gt; 200<br>
&gt;&gt; rules.<br>
&gt;&gt; 3. Serialising the StatefulKnowledgeSession using<br>
&gt;&gt;<br>
&gt;&gt; Marshaller marshaller = MarshallerFactory.newMarshaller(knowledgeBase);<br>
&gt;&gt; marshaller.marshall(out, session);<br>
&gt;&gt;<br>
&gt;&gt; This works well for the life of the marshaller but does not solve my<br>
&gt;&gt; problem<br>
&gt;&gt; as I need to restart the application and therefore cannot use the same<br>
&gt;&gt; instance of marshaller later on. Marshaller is not serialisable.<br>
&gt;&gt;<br>
&gt;&gt; I know some of these points are discussed in other posts. But is there<br>
&gt;&gt; anything I can do or have I missed the point?<br>
&gt;&gt;<br>
&gt;&gt; Any help or comments very much appreciated,<br>
&gt;&gt;<br>
&gt;&gt; Regards,<br>
&gt;&gt; Jen<br>
&gt;&gt; --<br>
&gt;&gt; View this message in context:<br>
&gt;&gt; <a href="http://www.nabble.com/Failing-serialisation-of-large-rule-base-tp24444231p24444231.html" target="_blank">http://www.nabble.com/Failing-serialisation-of-large-rule-base-tp24444231p24444231.html</a><br>
&gt;&gt; Sent from the drools - user mailing list archive at Nabble.com.<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; rules-users mailing list<br>
&gt;&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt;<br>
&gt;<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>
&gt;<br>
<br>
</div></div><font color="#888888">--<br>
View this message in context: <a href="http://www.nabble.com/Failing-serialisation-of-large-rule-base-tp24444231p24449888.html" target="_blank">http://www.nabble.com/Failing-serialisation-of-large-rule-base-tp24444231p24449888.html</a><br>

</font><div><div></div><div class="h5">Sent from the drools - user mailing list archive at Nabble.com.<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>