AEM Page Start-up issue: com.adobe.aem.spa.project.core.models.Page cannot be resolved to a type

Hey there, you may have landed on this blog page because you were getting a blank AEM page after your initial setup of AEM and the sample archetype installation. In the page error logs or when you do view it as published, you might be seeing the following error:

org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: Compilation errors in org/apache/sling/scripting/sightly/apps/spa__002d__project__002d__core/components/page/page_html.java:
Line 45, column 2590 : com.adobe.aem.spa.project.core.models.Page cannot be resolved to a type
Line 46, column 2698 : com.adobe.cq.wcm.core.components.models.PWA cannot be resolved to a type

What is this error?

If you read the error stack trace carefully, This is the error log that is caused because the corresponding Page model that your HTML file is looking for while rendering is not available. If you check out the error.log file in your localhost, you may find that the WCM core bundle which is needed for this Page class was not able to start properly.

How to fix this error?

Well, don’t stress about it. After long hours of troubleshooting it myself, I learned that, if I start trying to fix it based on the error logs and all, it is a long process and it may or may not resolve the issue. So, If this is your new setup and have started to do the initial build and deployment, just do the following:

  • Shut down the AEM server and wait for 30 -60 seconds for the shutdown process to finish in the background
  • Go to the installation folder and permanently delete the crx-quickstart folder or rename the existing crx-quickstart folder to some different name
  • Then double-click the aem jar so that it starts the server by creating a new crx-quickstart folder again
  • Once the server is started, again wait for 30-60 seconds and install the latest service pack via the package manager. the latest service pack as of today is 6.5.20
  • One more thing you should do is – check for the bundle WCM Projects - Core Bundlecom.adobe.cq.com.adobe.cq.projects.wcm.core and make sure it is in the active state before and after the service pack installation.

Be alert that, This can happen right after your service pack installation as well, so, in that case, the service pack would be the culprit. Try installing the latest service pack for AEM 6.5 Also, it would be a better idea to leave it for maybe 5 minutes idle after the service pack installation as it may keep running some background processes. Do a restart of AEM once or twice and check the health of the bundles, sort by status and you should see only 4-5 bundles in non-active status and that is okay!

aem page issues but healthy bundles

Why did this error happen?

During my troubleshooting, I learned that apparently sometimes the first start-up (when you executed the AEM jar) did not happen properly, and it basically missed out on some of the exports, packages, or jars that are internal to AEM and mandatory for the manual code to work smoothly.

What if it has started coming up on my existing AEM setup?

That again could be the same issue. It should not be a problem with your code base because it is happening only on your machine and working well on other colleague’s machines. Your AEM may have corrupted or crashed in your local, so, the best way is to do a fresh crx setup and it will save you lots of time.

However, it can not be denied that it has happened due to some bugs in your code base, and in that case, this particular problem will start popping up every developer’s machine.

Further Reading

Hope this was helpful 👍😀👍. Stay tuned for other such blog posts.

Feel free to share your thoughts on this topic in the comments section below 👇 We would be happy to hear and discuss the same 🙂

Spread the word!
0Shares

Leave a comment

Your email address will not be published. Required fields are marked *