legacy-knowledge-base
公開されました 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

learn-legacy-article-disclaimer-text

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