Don't give up yet. Paste your full stack trace to get a solution.
org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted.
at org.apache.xerces.dom.ParentNode.internalInsertBefore(Unknown Source)
You have a different solution? A short tip here would help you and many other users who saw this issue last week.