Hi Jen,

I am not sure why do you get the nullpointer exception.
As far as I know you shouldn't serialize the Marshaller. Just re-create it. The serializableMarshaller is stateless.

Regards,
Michal


On Sun, Jul 12, 2009 at 5:00 PM, LadyCode <j_whittlesea@hotmail.com> wrote:

Hi Michal,

With regard to point 2, the StackOverflowException was thrown based on
standard Java stack size and not from within the DroolsObject stream as I
thought. Increasing the stack size allowed me to serialise the full
KnowledgeBase with noticable speed results.

I am keen to do things 'properly' though so on to point 3....

The method 'createSerializableMarshaller' in MarshallingTest.java takes a
KnowledgeBase as parameter. So I create a Marshaller and .marshall the
StatefulKnowledgeSession. No problems.

Then to unmarshall I create a new Marshaller? but I no longer have the same
knowledgeBase and a null pointer exception is thrown when I use
marshaller.unmarshall.

java.lang.NullPointerException
       at
org.drools.common.ConcurrentNodeMemories.getNodeMemory(ConcurrentNodeMemories.java:69)
       at
org.drools.common.AbstractWorkingMemory.getNodeMemory(AbstractWorkingMemory.java:1534)
       at
org.drools.marshalling.impl.InputMarshaller.readFactHandles(InputMarshaller.java:334)
       at
org.drools.marshalling.impl.InputMarshaller.readSession(InputMarshaller.java:207)
       at
org.drools.marshalling.impl.DefaultMarshaller.unmarshall(DefaultMarshaller.java:75)
       at
org.drools.marshalling.impl.DefaultMarshaller.unmarshall(DefaultMarshaller.java:47)


Or am I misunderstanding... should I be able to serialise the Marshaller
created in createSerializableMarshaller? This would make sense by the name!!
How do I serialise it? DroolsObjectOutputStream?

Regards,

Jen



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

--
View this message in context: http://www.nabble.com/Failing-serialisation-of-large-rule-base-tp24444231p24449888.html
Sent from the drools - user mailing list archive at Nabble.com.

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users