KB Article #182111

XML parsing causing memory errors on Interchange side

Problem

-- getting out of memory / java heap space errors in the trading engine logs when processing large XML files

Resolution

* The XML parsing can be done using DOM or SAX. DOM is the default and it will load the entire XML file in memory, in a structure that will actually take more heap memory that the raw XML file, due to having to store additional objects related to the XML elements. SAX is much more memory efficient, as it will only load part of the XML content, as it is used.

* The default B2Bi XML parsing is DOM, but this can be changed using a property:

  • login to the B2Bi UI
  • enter by hand in the browser URL this link https://<B2B_HOST>:<UI_PORT>/ui/core/SystemProperties/
  • click on the Show default system properties at the bottom of the page
  • search for xmlParsing.useSaxParser and click on its Add property button
  • set the Value to true and click on Add

* Restart the TE node. SAX should now be used instead of DOM and the memory issue should no longer appear.