com.adobe.aem.spa.project.core.models.Page cannot be resolved to a type | Community
Skip to main content
August 17, 2021
Solved

com.adobe.aem.spa.project.core.models.Page cannot be resolved to a type

  • August 17, 2021
  • 3 replies
  • 10474 views
Failed executing script /libs/cq/Page/Page.jsp: Cannot get DefaultSlingScript: org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: Compilation errors in org/apache/sling/scripting/sightly/apps/projectx/components/structure/react__002d__page/customheaderlibs__002e__html.java: Line 61, column 2865 : com.adobe.aem.spa.project.core.models.Page cannot be resolved to a type

When I 'view as published' my page it's giving me that issue:

Added this to my pom.xml

<!-- SPA Project Core (includes hierarchy page model) --> <dependency> <groupId>com.adobe.aem</groupId> <artifactId>spa.project.core.ui.apps</artifactId> <type>zip</type> <version>${spa.project.core.version}</version> </dependency> <dependency> <groupId>com.adobe.aem</groupId> <artifactId>spa.project.core.core</artifactId> <version>${spa.project.core.version}</version> </dependency>

 

<aem.sdk.api>2021.7.5662.20210726T181801Z-210700</aem.sdk.api>
<spa.project.core.version>1.3.0</spa.project.core.version>

 Can you anyone to point me to direction on how can resolve this?

Thank you!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Asutosh_Jena_

Hi @iambongbox 

 

Please check in system console and ensure all the bundles are in active state.

http://localhost:4502/system/console/bundles

 

If you are using core component ensure the latest version of core component is included on the POM file and the same has been installed on AEM instance.

 

If the project is running on AEM 6.5.X instance ensure the required version of uber jar i.e., same as AEM version is added as a dependency and is installed on AEM.

 

Thanks!

3 replies

Kishore_Kumar_
August 18, 2021

hi @iambongbox ,

 

Can you please check if your bundles all are active.

 

host:port/system/console/bundles

Asutosh_Jena_
Community Advisor
Asutosh_Jena_Community AdvisorAccepted solution
Community Advisor
August 18, 2021

Hi @iambongbox 

 

Please check in system console and ensure all the bundles are in active state.

http://localhost:4502/system/console/bundles

 

If you are using core component ensure the latest version of core component is included on the POM file and the same has been installed on AEM instance.

 

If the project is running on AEM 6.5.X instance ensure the required version of uber jar i.e., same as AEM version is added as a dependency and is installed on AEM.

 

Thanks!

Som_Architect
February 26, 2022

Hi,

 

I am facing similar problem. I need to extend the SPA Page Model and form the project specific Page model and add more properties to it such as analyticsUrl (which I will pick up from OSGi Config from this Model).

I created my page model by extending com.adobe.aem.spa.project.core.internal.impl.PageImpl and implementing Page. WCM Core Components, spa.project.core and uber-jar are all there as dependencies on my core pom.xml.

The bundle looks to be in Installed state now due to unresolved imported packages -
com.adobe.aem.spa.project.core.internal.impl -- Cannot be resolved
If I do not extend the PageImpl and just implement Page, then bundle is Active but my custom Page Model does not get resolved and page doesn't load.

<sly data-sly-use.mypage="com.sample.core.models.BasePageModel" />
${mypage.analyticsUrl}

Then the error.log would throw error -

Caused by: org.apache.sling.scripting.sightly.SightlyException: Compilation errors in org/apache/sling/scripting/sightly/apps/sample/components/page/customheaderlibs_html.java:
Line 54, column 2863 : com.sample.core.models.BasePageModel cannot be resolved to a type 

 

Som_Architect
February 28, 2022

I could find the issue in my case - wanted to put it down for sharing.

I needed to export models on core/pom.xml.

 

<plugin>
    <groupId>biz.aQute.bnd</groupId>
    <artifactId>bnd-maven-plugin</artifactId>
    <executions>
          <execution>
          <id>bnd-process</id>
          <goals>
             <goal>bnd-process</goal>
          </goals>
      <configuration>
           <bnd><![CDATA[
             Sling-Model-Packages: com.sample.core.models
             Import-Package: javax.annotation;version=0.0.0,*
             Export-Package: com.sample.core.models
             Embed-Dependency: *;scope=compile|runtime
             Embed-StripGroup: true
             Embed-Transitive: true
             ]]></bnd>
       </configuration>
     </execution>
   </executions>
</plugin>

Adobe Employee
February 1, 2023

Hi @iambongbox / @asutosh_jena_ ,

 

I didn't see a solution for this issue in this discussion. Is it resolved, Kindly share the steps to resolve this issue. Let me explain our problem below.

 

We are performing AEM to AEM as a cloud service upgrade and found in the BPA report "spa-project-core:spa.project.core.all:1.3.16" is not compatible because it contains both mutable and immutable content which will cause problems during deployment. We could not find its AEM as a cloud service version, so what is needed or alternate option to fix this.

March 30, 2023

I am also facing the same issue. any solution ??