I am getting this exception in runtime while my project is built on aem6.1 and deployed in aem6.2 server.I tried using the aem6.2-uber.jar but it results in some other issues.Can anyone help on how to resolve the issue?
Only solution is to rebuild the package/bundle with 6.2 uber.jar.
If you are facing some issues while building your code with 6.2 uber jar, then it needs to be analyzed and fixed. Feel free to share more info related to your build issues.
Can you create a fresh 6.2 Maven project from bundle , build it , install and test is all bunldes are active before adding your code. Once that is success , just add your code and modify the POM for the dependencies you might be missing. If not, as abhishek said , we might have to check further what the issue is
Thanks!! but the thing is that I need to run the project developed using AEM6.1 in the AEM6.2 server so what i did is that i changed the uber jar in the parent pom.xml to aem 6.2 so its getting build success without any compile time issues and the my bundles are active in the felix console while loading the component in the page it throws the same java.lang.NoClassDefFoundError: com/day/cq/commons/Filter error.
The following is the changes i made in parent pom to make the project run in aem6.2 (actually it got developed in aem6.1)
also find the attached screenshot for the error that has been thrown
I understand that. The thing is there might be some dependency variation in the POM.xml . To avoid any further issues
1. Create a fresh maven bundle with archetype 10
2. build the bundle and make sure it is working fine
3. Once verified add your apps and classes to this newly created bundle
4. build , check and modify pom.xml accordingly.
Class no found exception occurs when the bundle is not available in the console. Is this any import referred in a JSP file ? If so , either you might have to convert it to an HTL component or you might have to add this particular bundle to your felix console.
Why you got error at runtime and not during compile time ?
While you build your bundles, maven will download the dependencies mentioned in the POM.xml to the local maven repo under c:/<users>/.m2/repository and will build your bundles successfully. But when you install the same to your AEM , these dependencies/bundles are expected to be available in the felix console. If in case any of the bundle is not available it will throw you a No Class def found exception
If the classes are imported in JSP, they will still be built successfully as those are not mentioned in your pom.xml and your maven compile command will not worry about any dependencies not mentioned in the POM.xml and go ahead assuming it is available in the console.
Let me know if you need any more information
As Veena has mentioned, creating a fresh project structure using archetype for AEM 6.2, will surely resolve your issue.
Otherwise, cleaning your pom file manually, is a very cumbersome task. If you still want to manually fix jar dependencies issue in your pom file, you can start with removing entries like: