Native XML API on Liferay 7

Hi all, Liferay 7.0 DXP SP7 by default uses the legacy XML libraries known as xml-api, xerces and xalan. Since many years they are included inside the JRE.

This legacy libraries included in tomcat 8 are cause of bugs inside Liferay. I share the steps how remove them, so you can use directly the native XML libraries inside the JRE.

1- Open the file inside ${home.liferay}/tomcat-8.0.32/bin and add the following properties in the CATALINA_OPTS:


2- Liferay 7.0 DXP SP7 has a bad error because it wires the old xerces libraries in the services code. So you need a patch to add in the ${home.liferay}/tomcat-8.0.32/webapps/ROOT/WEB-INF/lib folder. The patch can be can be found here

3- Build the patch through the command: mvn install and copy in the lib tomcat folder

4- XML libraries need the org.w3c.dom package working as system library. To add it and avoid unespected ClassNotFound exceptions put this property in the of Liferay:,__redirected, com.sun.jna,com.sun.ccpp,com.liferay.portal.servlet.delegate, com.sun.syndication,org.w3c.dom,sun.reflect

5- Restart Liferay

You are ready to work with the native XML libraries. Good work!