Legacy Knowledge Base
Published Jul. 2, 2025

Connection Timeout Caused by 'org.dom4j.DocumentException' When Deploying Portlet, Hook, Etc.

Written By

Gustavo Vasconcelos

How To articles are not official guidelines or officially supporteddocumentation. They are community-contributed content and may not alwaysreflect the latest updates to Liferay DXP. We welcome your feedback toimprove How to articles!

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

Legacy Article

You are viewing an article from our legacy "FastTrack"publication program, made available for informational purposes. Articlesin this program were published without a requirement for independentediting or verification and are provided "as is" withoutguarantee.

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

Liferay Support does not recommend or endorse specific third-party products over others. Liferay is not responsible for any instructions herein or referenced regarding these products. Any implementation of these principles is the responsibility of the subscriber.

Some environments fail repeatedly to deploy some kinds of plugins, be it a hook, a portlet, a theme or other types. In those cases, an stack trace similar to the one below is displayed on the logs.

13:33:06,568 ERROR [localhost-startStop-1][HotDeployImpl:111] com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering hook for calendar-language-fix-hook
com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering hook for calendar-language-fix-hook
	at com.liferay.portal.kernel.deploy.hot.BaseHotDeployListener.throwHotDeployException(BaseHotDeployListener.java:46)
	at com.liferay.portal.deploy.hot.HookHotDeployListener.invokeDeploy(HookHotDeployListener.java:280)

(...)

	at java.lang.Thread.run(Thread.java:745)
Caused by: com.liferay.portal.kernel.xml.DocumentException: Connection timed out Nested exception: Connection timed out
	at com.liferay.portal.xml.SAXReaderImpl.read(SAXReaderImpl.java:428)
	at com.liferay.portal.xml.SAXReaderImpl.read(SAXReaderImpl.java:446)
	at sun.reflect.GeneratedMethodAccessor245.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at com.liferay.portal.security.lang.DoPrivilegedHandler.doInvoke(DoPrivilegedHandler.java:88)
	at com.liferay.portal.security.lang.DoPrivilegedHandler.invoke(DoPrivilegedHandler.java:56)
	at com.sun.proxy.$Proxy76.read(Unknown Source)
	at com.liferay.portal.kernel.xml.SAXReaderUtil.read(SAXReaderUtil.java:187)
	at com.liferay.portal.deploy.hot.HookHotDeployListener.doInvokeDeploy(HookHotDeployListener.java:592)
	at com.liferay.portal.deploy.hot.HookHotDeployListener.invokeDeploy(HookHotDeployListener.java:277)
	... 30 more
Caused by: org.dom4j.DocumentException: Connection timed out Nested exception: Connection timed out
	at org.dom4j.io.SAXReader.read(SAXReader.java:484)
	at org.dom4j.io.SAXReader.read(SAXReader.java:365)
	at com.liferay.portal.xml.SAXReaderImpl.read(SAXReaderImpl.java:425)
	... 40 more

The key item is the line containing the string org.dom4j.DocumentException: Connection timed out. In such cases the likely cause if that the server where the portal is running does not have internet access, this access is faulty or the server where the DTD (Document Type Definition) for the liferay-*.xml files are stored are somehow inaccessible. This causes Liferay Portal to fail the document validation, aborting the deploy process.

Resolution

If the connectivity error is transitory, reattempting to deploy the WAR may eventually work. However, on the common scenario where the server has no Internet access, you may want to proceed in one of those ways:

  1. Disable XML validation on portal-ext.properties changing the value for xml.validation.enabled to false
    1. xml.validation.enabled=false
  2. Remove the <!DOCTYPE> element line from all liferay-*.xml files in your plugin:
    1. liferay-look-and-feel.xml
    2. liferay-hook
    3. liferay-display.xml
    4. liferay-portlet.xml, etc. 
  3. This should only be done if you want to make sure the plugins are deployable in offline portals.
Did this article resolve your issue ?

Legacy Knowledge Base