Legacy Knowledge Base
Published Sep. 10, 2025

DocumentException: Premature end of file

Written By

Thanga Meena

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

  • When deploying Spring MVC custom portlet, an exception is thrown "DocumentException: Error on line -1 of document: Premature end of the file. "
  • Issue reproduced With 7.1 GA1 release as below when deployed the Spring MVC custom portlet, 
2019-06-25 06:14:08.705 ERROR [fileinstall-C:/Users/admin/Downloads/Deploynment-issue/New folder/GA1/liferay-dxp-7.1.10-ga1/osgi/war][PortletLocalServiceImpl:881] com.liferay.portal.kernel.xml.DocumentException: Error on line -1 of document  : Premature end of file. Nested exception: Premature end of file.
com.liferay.portal.kernel.xml.DocumentException: Error on line -1 of document  : Premature end of file. Nested exception: Premature end of file.
        at com.liferay.portal.xml.SAXReaderImpl.read(SAXReaderImpl.java:408)
        at com.liferay.portal.xml.SAXReaderImpl.read(SAXReaderImpl.java:426)
        at com.liferay.portal.kernel.xml.UnsecureSAXReaderUtil.read(UnsecureSAXReaderUtil.java:74)
        at com.liferay.portal.service.impl.PortletLocalServiceImpl.readPortletXML(PortletLocalServiceImpl.java:2501)
        at com.liferay.portal.service.impl.PortletLocalServiceImpl.initWAR(PortletLocalServiceImpl.java:857)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)       
2019-06-25 06:14:08.720 INFO  [fileinstall-C:/Users/admin/Downloads/Deploynment-issue/New folder/GA1/liferay-dxp-7.1.10-ga1/osgi/war][PortletHotDeployListener:303] 0 portlets for testnew are available for use

Environment

  • Liferay portal DXP 7.1 GA1 [by default no fix pack available with this GA release]

Resolution

  • The above error gets resolved by updating with fix pack dxp-11 which is Latest fix pack currently when tested the issue.

Additional Information

Did this article resolve your issue ?

Legacy Knowledge Base