Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

java.lang.NoClassDefFoundError: com/day/cq/commons/Filter ?

Malarvizhi_Sara
Level 2
Level 2

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?

0 Replies
abhishekagg19
Employee
Employee

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.

Malarvizhi_Sara
Level 2
Level 2

I used the Uber-jar in aem6.2 only now able to get the build success but throws the runtime error.

Veena_Vikram
Community Advisor
Community Advisor

Hi Malarvizhi

   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

Veena

Malarvizhi_Sara
Level 2
Level 2

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)

<dependency>

                <groupId>com.adobe.aem</groupId>

                <artifactId>uber-jar</artifactId>

                <version>6.2.0</version>

                <classifier>obfuscated-apis</classifier>

                <scope>provided</scope>

            </dependency>

also find the attached screenshot for the error that has been thrownScreen Shot 2017-12-26 at 6.31.38 PM.png

Veena_Vikram
Community Advisor
Community Advisor

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.

1380854_pastedImage_0.png

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

abhishekagg19
Employee
Employee

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:

        <dependency>

            <groupId>com.day.cq</groupId>

            <artifactId>cq-commons</artifactId>

            <version>x.x.x</version>

            <scope>provided</scope>

        </dependency>

<artifactId>cq-search</artifactId>

<artifactId>cq-tagging</artifactId>