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
  • 4363 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.

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

This is what I would try: 

1. Restart the instance, if you have a local instance to test this out, the better.

2. Try using the depfinder to identify which bundle was exporting the class in 6.2 and which is exporting in 6.5. Then make sure the bundle version is actually the one being used in your project, hopefully, this can give more clues.

 

If the error is saying that the class was not found, means the Class is not available at runtime, so either AEM is wonky and restart may help, or indeed you are not referencing the correct bundle. 

Esteban Bustamante
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.