Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

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

Avatar

Level 2
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!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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!

View solution in original post

11 Replies

Avatar

Community Advisor

hi @iambongbox ,

 

Can you please check if your bundles all are active.

 

host:port/system/console/bundles

Avatar

Correct answer by
Community Advisor

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!

Avatar

Level 2

@Asutosh_Jena_ how can I can check what version of core component is installed to my AEM instance?

Thank you for your help.

Avatar

Community Advisor

Hi @iambongbox 

 

You can check in system/console using the below name:

Adobe Experience Manager Core WCM Components Core Bundle

(com.adobe.cq.core.wcm.components.core)

Avatar

Level 2

I also notice that I don't have this on my root pom.xml

<!-- https://mvnrepository.com/artifact/com.adobe.aem/uber-jar -->
<dependency>
    <groupId>com.adobe.aem</groupId>
    <artifactId>uber-jar</artifactId>
    <version>6.5.9-1.0</version>
    <scope>provided</scope>
</dependency>

Avatar

Level 2

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 

 

Avatar

Level 2

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>

Avatar

Level 2

This doesn't resolve the issue, I am using latest spa core version 1.3.16 and Uber jar 6.5.13. and instance also exactly same version. but still getting this error

Avatar

Employee

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.