Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Facing issues with sightly

Avatar

Community Advisor

Hi Team, 

 

I am working on AEM 6.5.0, I made a model after copying an existing core component titled V1, But When I tried to use that model, with my sightly it threw an error attaching a screenshot, 

 

Html Template: https://prnt.sc/raGquoWXKlK2

 

Model(Java File)  : https://prnt.sc/sRe-G82Ty13t

 

Error Logs: https://prnt.sc/buLk8q6q6vRt

 

I really appreciate any help you can provide. 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @partyush 

 

You should check following in order to see if you model is even available to use:

1. Go to http://localhost:4502/system/console/bundles and check if your bundle is active or not. If not open bundle details and resolve the issues or paste issues here.

2. If bundle is active, open your bundle details and check if you are exporting the package where you have created this sling model in "Exported Packages" section or not like this:

Screenshot from 2023-01-28 13-46-33.png

 

If it is not present, you need to add package-info.java file in that package which should be something like :

@Version("1.0")
package com.mysite.core.filters;

import org.osgi.annotation.versioning.Version;

 

Change Pacakge and Deploy and check.

 

3. If your package is in now in export packages section and still the error exists, check if you class present in http://localhost:4502/system/console/adapters where there is a list of all models. If not, check if the your package in in sling model packages in pom.xml of core. You can get more information in https://sling.apache.org/documentation/bundles/models.html

4. If you still see the error, Please paste the full error log. 

 

Hope it helps!

Thanks,

Nupur

 

 

View solution in original post

8 Replies

Avatar

Level 7

The error message does appear when the cms is not able is to create an instance of java object in memory.

I wonder about your html code. When you use follwong code:

 

<sly data-sly-use.model="com.adobe.core.models.ArticleListModel"/>
<h1>This is article list component</h1>

 instead of yours, will the same error message appear?

 

Avatar

Community Advisor

No need to wonder, This piece of code is added for testing.

 

Avatar

Employee Advisor

Could you please check the OSGi bundle status whether it is in Active state associated with com.adobe.core.models.ArticleListModel via /system/console/bundle 

Avatar

Community Advisor

Can you try to move your model to some other package other than adobe one?

Hope this helps

Umesh Thakur

Avatar

Community Advisor

Hi, can you suggest to me the best way to add this, 

Like I want to  know, whether this dependency will goes under my project POM or my CORE pom, and where it should get added in the code.

Avatar

Community Advisor

Hi @partyush 

 

You are facing this issue with all the model classes you have written on the same project or only with this specific one? If it's with all, then definitely it's with the package definition.

 

Avatar

Correct answer by
Community Advisor

Hi @partyush 

 

You should check following in order to see if you model is even available to use:

1. Go to http://localhost:4502/system/console/bundles and check if your bundle is active or not. If not open bundle details and resolve the issues or paste issues here.

2. If bundle is active, open your bundle details and check if you are exporting the package where you have created this sling model in "Exported Packages" section or not like this:

Screenshot from 2023-01-28 13-46-33.png

 

If it is not present, you need to add package-info.java file in that package which should be something like :

@Version("1.0")
package com.mysite.core.filters;

import org.osgi.annotation.versioning.Version;

 

Change Pacakge and Deploy and check.

 

3. If your package is in now in export packages section and still the error exists, check if you class present in http://localhost:4502/system/console/adapters where there is a list of all models. If not, check if the your package in in sling model packages in pom.xml of core. You can get more information in https://sling.apache.org/documentation/bundles/models.html

4. If you still see the error, Please paste the full error log. 

 

Hope it helps!

Thanks,

Nupur