Sling Model issue | Community
Skip to main content
Level 2
November 26, 2022
Solved

Sling Model issue

  • November 26, 2022
  • 1 reply
  • 2240 views

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

Can you help, what might be wrong here?

Best answer by SantoshSai

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 

1 reply

SantoshSai
Community Advisor
SantoshSaiCommunity AdvisorAccepted solution
Community Advisor
November 26, 2022

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 

Santosh Sai
radhika_kAuthor
Level 2
November 26, 2022

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

SantoshSai
Community Advisor
Community Advisor
November 26, 2022

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

Santosh Sai