java.lang.ClassNotFoundException: com.day.cq.wcm.api.Page when executing the JSP for the page. | Community
Skip to main content
Level 4
August 2, 2023

java.lang.ClassNotFoundException: com.day.cq.wcm.api.Page when executing the JSP for the page.

  • August 2, 2023
  • 2 replies
  • 4377 views

I'm working on an upgrade from 6.2 to 6.5. We will not be switching to Touch UI any time soon because they have not budgeted for it. We are only working to get the old Classic UI and JSP pages to run in 6.5.

I am also trying to update the project to the latest Adobe archetype. I have everything building and deploying now but when the JSP runs, I am getting a ClassNotFoundException for the com.day.cq.wcm.api.Page class.

What do I need to do so that the class can be found by the JSP?

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

2 replies

EstebanBustamante
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
August 2, 2023

Hey @robertharperfs 

 

First, the warning you don't want to hear but you will keep reading everywhere, yeah, you should not do this and instead use TouchUI, problems like this can't and won't be addressed by Adobe. 

 

Now, a couple of things to check, did you by any chance bounce the instance after the SP was installed? I don't recall on top of my head if you must do it in such an upgrade, but usually, it is a good idea once everything is calm and stable. Second, did you check all the bundles are active? Can you also make sure the package you are referring can be resolved by the depfinder http://localhost:4502/system/console/depfinder  in the console?

Esteban Bustamante
Level 4
August 2, 2023

I knew the Touch UI thing would be the first go to. As I said, I've been told they have no plans for that migration, though the users would prefer there were.

 

My packages are active, the com.day.cq.wcm.api.Page is core to AEM so I don't see why it wouldn't be found.

We actually have the code running but it is a different archetype that it is built with. Same one used to build the bundles for the 6.2 instance but with pom settings to export old libraries.

The issue is that I'm probably missing something in the new archetype.

Level 4
August 30, 2023

Did the upgrade of the AEM instance go well? The uber-jar is marked as "provided," which means it should be available at runtime. However, that seems to be the exact issue you're facing – it's not available. As far as I know[1], this jar is part of the OSGI container, which should be updated during the AEM upgrade.

 

I believe you can experiment with two approaches to narrow down the issue:

  1. Attempt to embed and manually upload the uber-jar. This should ensure that the classes are exposed at runtime.

  2. Try changing the version of the uber-jar to the previous one you had. If it runs without any issues, it might indicate that the OSGI context retained the old version of the uber-jar (which is unusual).


[1] https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/uber-jar/m-p/141763


Oddly, the com.day.cq.wcm.api.Page class is not in the uber-jar.6.5.0.jar. I've checked. I've added it to the exported libraries in my bundles and when I check those bundles, I see the class file there. It seems odd to me that I don't see the com.day.cq.wcm.api.Page class in the uber-jar. I would have thought that was core.

Level 4
September 28, 2023

This just keeps getting stranger. I still haven't found a resolution to this. I added code to get the class object of the currentPage attribute in the JspContext..

From the logs:

The class is com.day.cq.wcm.core.impl.page.PageImpl

Interface0 = com.day.cq.wcm.api.Page

Super Class = org.apache.sling.adapter.SlingAdaptable

I don't understand why in the next couple lines I try to cast the PageImpl object to the Page object that it generates a ClassCastExeption when the com.day.cq.wcm.api.Page interface is the object's interface that it is implementing. Why would this be? I've never seen this before.