Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Sling models not resolving in osgi

Avatar

Level 2

Hey everyone, 

 

I have been running into an annoying issue with sling models in a project created from Archetype 32. The sling models I create are able to be referenced by aem components using htl and the manifest correctly has the classes in the "Sling-Model-Classes" definition, but I am not able to follow the @Deleted Account @Via pattern to use composition to reference the core components. When I try, the object is always null.

 

After digging into this some more, I noticed none of my sites sling models are registering in system/console/status-slingmodels

 

Any ideas? This is a CIF, AEM Cloud project

 

Thanks

1 Reply

Avatar

Community Advisor

Hi @davidb86179332 

Can you try this for referencing core component? eg. Image component in below case

@Self // Indicates that we are resolving the current resource
@Via(type = ResourceSuperType.class) // Resolve not as this model, but as the model of our supertype (ie: CC Image)
private Image delegate;
@Override
public String getTitle() {
return delegate.getTitle();
}
@Override
public String getUuid() {
return delegate.getUuid();
}
@Override
public String getLink() {
return delegate.getLink();
}

 

Regards,

Santosh

 

 

 

Avatar

Level 2

This did not work but it did help me get to the root of my issue. 

 

The problem was not defining "resourceType" in my @model annotation. This is listed as optional, so it is interesting that it is required for this functionality.

Avatar

Community Advisor

Hi @davidb86179332 

Could you please check whether your site specific bundle in active status. 

 

Regards,

Rajashankar