[
https://issues.apache.org/jira/browse/SLING-13143?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Stefan Seifert resolved SLING-13143.
------------------------------------
Fix Version/s: Models Implementation 2.0.4
Assignee: Stefan Seifert
Resolution: Fixed
https://github.com/apache/sling-org-apache-sling-models-impl/commit/c7506f3fed9e99144e96f3066ad867f9dbad177f
> Missing optional interface dependency causes NoClassDefFoundError in Sling
> Models
> ---------------------------------------------------------------------------------
>
> Key: SLING-13143
> URL: https://issues.apache.org/jira/browse/SLING-13143
> Project: Sling
> Issue Type: Bug
> Components: Sling Models
> Affects Versions: Sling Models Impl 1.4.0
> Reporter: Tomasz Misiewicz
> Assignee: Stefan Seifert
> Priority: Major
> Fix For: Models Implementation 2.0.4
>
>
> The issue is nearly identical to SLING-6764, but specifically triggered by a
> {{NoClassDefFoundError}} when an implementation class is present, but an
> interface it implements is missing at runtime.
> *Context:* This scenario occurs when dependencies are marked as {{optional}}
> (present during compilation but missing in specific runtime environments).
> While the absence of the model itself is expected in these environments, it
> currently prevents other valid models from being initialized.
> *Steps to reproduce:*
> # Define a Sling Model that implements an interface from an optional
> dependency.
> # Deploy the bundle to an environment where the optional dependency (the
> interface) is missing.
> # Observe that {{NoClassDefFoundError}} is thrown during the
> scanning/registration process.
> *Observed Behavior:* The {{NoClassDefFoundError}} is not caught by the
> injector/registrar, causing a failure that halts the initialization of other
> models.
> *Expected Behavior:* Similar to the fix in SLING-6764,
> {{NoClassDefFoundError}} should be caught and logged as a warning/error. The
> failure to load one model due to missing optional dependencies should not
> impact the availability of other models in the system.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)