Groovy scripts in Objects actions do not work in JBoss. System.out.println traces do not appear in the server logs.
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
- Objects actions using Groovy scripts to update web content after an entry is added or deleted in the object do not work as expected.
- This functionality works in Tomcat environments, but not in JBoss environments.
-
System.out.println traces do not appear in the server logs.
Environment
- Quarterly Releases
- DXP 2024.Q3
- DXP 7.4
- JBoss EAP 7.4
Resolution
-
Enable Groovy Scripting: Groovy scripting is disabled by default in DXP 2024.Q3 and above. Enable it in Control Panel → Configuration → System Settings → Script Management. For more details, see Enabling Scripting.
-
Use Log4j for Tracing:
System.out.println can be unreliable in JBoss. Use Log4j for tracing within Groovy scripts:
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
Log log = LogFactoryUtil.getLog("YOUR_CATEGORY");
log.info("Your message");
log.error("Error message", e);
Replace YOUR_CATEGORY with a descriptive name relevant to your application, such as your company name. Traces will appear in the Liferay log with the specified category.
Did this article resolve your issue ?