Legacy Knowledge Base
Published Sep. 10, 2025

The restClient object throws error in Freemarker templates on JBOSS EAP

Written By

Daniel Carrillo Broeder

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

  • The "restClient" object throws an error in a Freemarker template within a Web Content Template, Application Display Template, a Fragment or any other kind.
  • The error message displayed on the HTML page is something similar to:
    Java method "com.liferay.portal.vulcan.internal.template.RESTClientTemplateContextContributor$RESTClient.get(String)" threw an exception when invoked on com.liferay.portal.vulcan.internal.template.RESTClientTemplateContextContributor$RESTClient object "…"; see cause exception in the Java stack trace.
  • No errors are logged in the server logs or browser console.

Environment

  • Liferay DXP 7.4 and Quarterly Releases
  • JBoss EAP

Resolution

  1. Add the allow-non-standard-wrappers="true" attribute to the <servlet-container> tag in your standalone.xml file:
    <servlet-container name="default" allow-non-standard-wrappers="true">
        ...
    </servlet-container>
    • This is needed because Liferay's RESTClient uses a dynamic proxy approach (ProxyUtil.newDelegateProxyInstance()) that doesn't comply with JBOSS's strict servlet specification enforcement, and will be eventually documented in the future: Installing on JBoss EAP.
  2. You also need to verify if your Liferay patch level includes the fix for LPD-42480 (Fixed in 2024.Q3.11+ and 2025.Q1.0+), and request a hotfix if needed.

Additional Information

 

Did this article resolve your issue ?

Legacy Knowledge Base