Hi There,
I have been using AEM CaaS SDK locally since long, but recently it started showing blank sites pages. When logs were looked into, it was found to not be able to instantiate an old AEM model with following error
org.apache.sling.scripting.sightly.SightlyException: Identifier com.xyz.core.models.SEOModel cannot be correctly instantiated by the Use API
When I looked into stack trace it did not give any details on issue it is facing except
Caused by: java.lang.ClassNotFoundException: com.xyz.core.models.SEOModel at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) at org.apache.sling.commons.fsclassloader.impl.FSDynamicClassLoader.loadClass(FSDynamicClassLoader.java:58) [org.apache.sling.commons.fsclassloader:1.0.14] at org.apache.sling.scripting.sightly.impl.engine.extension.use.JavaUseProvider.provide(JavaUseProvider.java:129) [org.apache.sling.scripting.sightly:1.4.24.140] at org.apache.sling.scripting.sightly.impl.engine.extension.use.UseRuntimeExtension.call(UseRuntimeExtension.java:71) [org.apache.sling.scripting.sightly:1.4.24.140] ... 228 common frames omitted
It just says ClassNotFoundException, that's it. Class is there and its an old model, which was not changed recently and suddenly it has stopped being resolved. Here are snippet from model
```
```
File is com/xyz/core/models/ folder.
Help is appreciated
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
The ClassNotFoundException for SEOModel in your AEM CaaS SDK environment typically indicates deployment or class visibility issues.
Check /system/console/bundles to confirm:
Your core bundle (containing SEOModel) is Active.
No unresolved dependencies or import errors exist.
If inactive: Redeploy the bundle via Maven (mvn clean install -PautoInstallBundle) and monitor the OSGi console for errors
Inspect the compiled JAR/WAR file to ensure:
SEOModel.class exists in com/xyz/core/models/.
The package structure matches the Java file’s declared package.
Common causes:
Incorrect <Build-OutputDirectory> in Maven’s POM.
.gitignore/build filters excluding the class
Add debug logs to @PostConstruct methods in SEOModel to identify initialization failures (e.g., null injections or uncaught exceptions)419.
Review error.log for stack traces occurring before the ClassNotFoundException, which may point to:
Missing OSGi services (e.g., @OSGiService-annotated fields).
Invalid resource adaptations (e.g., Resource.adaptTo(SEOModel.class) failing)
4) Temporary Workaround
If the issue persists, use the ModelFactory directly for better error reporting:
try {
SEOModel model = modelFactory.createModel(request, SEOModel.class);
} catch (Exception e) {
logger.error("Model instantiation failed: ", e);
}
This bypasses the adaptTo() method’s silent failures
Views
Replies
Total Likes
Did you created this as a new Model, or was it working before but stopped working now?
In case it was working before then check the references, logic in sling model.
If it is a new model then check the project osgi bundle and see what is the status of the model?
Quick questions
1. Was this working previously and its not working now?
2. Is their any recent version updates in pom.xml file
3. Can you match or Increase your sdk version to the one version mentioned in the parent pom.xml file.
Ideally with out any recent changes to the code the model classes doesn't fail
Views
Replies
Total Likes
Views
Likes
Replies