Tomasz Misiewicz created SLING-13143:
----------------------------------------

             Summary: 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


h2. Description

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. 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)

Reply via email to