Knowledge Base
Published Sep. 2, 2026

Conflicting Setter Definitions Error Prevents Custom REST API from Loading in Swagger UI

Written By

András Bakalár

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.

Issue

  • When deploying a custom REST application built with Liferay's REST Builder, the Swagger UI fails to load for the custom endpoint. The logs show an error similar to the following:

    java.lang.IllegalArgumentException: Conflicting setter definitions for property "..."
  • The exception details a conflict between two setter methods in a generated DTO class: one for the expected data type (e.g., java.lang.Integer) and another for com.liferay.petra.function.UnsafeSupplier.
  • This issue typically appears after upgrading to a newer version of Liferay DXP, as internal libraries like Jackson and Swagger are updated.

Environment

  • Liferay 2025.Q1+
  • Custom JAX-RS application built with Liferay REST Builder

Resolution

To resolve this, configure the module to import the Jackson annotation package from the DXP runtime instead of bundling it privately. This change forces the module to generate an Import-Package instruction for the Jackson annotations, ensuring it uses the same classes as the DXP runtime and resolving the conflict.

  1. In the -api module of your custom REST application, open the bnd.bnd file.
  2. Find the Private-Package instruction.
  3. Remove com.fasterxml.jackson.annotation from its list of packages.
  4. Rebuild and redeploy the application modules.

Additional Information

This error is caused by a classloading conflict with the Jackson annotation library. Newer versions of Liferay DXP include an updated version of Jackson that is stricter about how it processes annotations like @JsonIgnore. If the custom REST module's -api artifact bundles its own private copy of the com.fasterxml.jackson.annotation package, the DXP runtime will not recognize the annotations on the generated DTOs. As a result, Jackson detects two setters for the same property, which triggers the exception.

Did this article resolve your issue ?

Knowledge Base