Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-1211

Rules with accumulators cannot be serialized

    XMLWordPrintable

    Details

    • Estimated Difficulty:
      Low

      Description

      If a rulesbase includes a max accumulator then it cannot be serialized. The org.drools.base.accumulators.AccumulateFunction interface does not extend Serializable and none of its default implementations implement it either.

      When you try to serialize such a Package you get the following exception:
      java.io.NotSerializableException: org.drools.base.accumulators.MaxAccumulateFunction
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
      at java.util.HashMap.writeObject(HashMap.java:980)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:809)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1296)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
      at org.drools.rule.PackageCompilationData.writeExternal(PackageCompilationData.java:116)
      at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1267)
      ...

      Paragraph 7.1.4.4. of the documentation clearly states that packages should be serializable.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                mark.proctor Mark Proctor
                Reporter:
                mullerl Laszlo Muller
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: