Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

Sling Model issue

Avatar

Level 2

I'm facing very strange behaviour - I have created new bundle in existing project and implemented new Sling Model, bundle is deployed successfully and it is in Active state too but when I drag and drop component it is not resolving

Screen Shot 2022-11-26 at 4.38.25 PM.png

Can you help, what might be wrong here?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @radhika_k,

While creating new bundle you might missed specifying Sling Model Package in your newly created bundle(pom.xml).

"To start using Sling Model you need to create a separate bundle for Sling Models, is not required but recommended & specify Sling-Model-Packages, a header in the bundle manifest."

If you navigate to your core bundle's pom.xml, you may see header called "Sling-Model-Packages": Please specify the exact package of your newly created bundle.

eg.

For maven-bundle-plugin

<Sling-Model-Packages>
    org.apache.sling.models.it.models,
    org.apache.sling.other.models
</Sling-Model-Packages>

For bnd-maven-plugin

Sling-Model-Packages:org.apache.sling.other.models

Hope that helps!

Regards,

Santosh 

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

Hi @radhika_k,

While creating new bundle you might missed specifying Sling Model Package in your newly created bundle(pom.xml).

"To start using Sling Model you need to create a separate bundle for Sling Models, is not required but recommended & specify Sling-Model-Packages, a header in the bundle manifest."

If you navigate to your core bundle's pom.xml, you may see header called "Sling-Model-Packages": Please specify the exact package of your newly created bundle.

eg.

For maven-bundle-plugin

<Sling-Model-Packages>
    org.apache.sling.models.it.models,
    org.apache.sling.other.models
</Sling-Model-Packages>

For bnd-maven-plugin

Sling-Model-Packages:org.apache.sling.other.models

Hope that helps!

Regards,

Santosh 

Avatar

Level 2

@SantoshSai Thanks for your prompt reply! But I have simply copied existing core bundle and renamed packages didn't changed anything and both the bundles are in Active state. 

Avatar

Community Advisor

@radhika_k Well! You renamed packages but forgot to specify (renamed package) header in

Sling-Model-Packages

pom.xml as I stated above, please check and specify it in core - pom.xml that should solve your problem.

Avatar

Level 2

Thank you! It works, i can now see in Sling Model Adapter and solved.