Got unexpected exception while analyzing:java.lang.NoClassDefFoundError in AEM version 6.4.0 | Community
Skip to main content
Level 3
October 8, 2020
Solved

Got unexpected exception while analyzing:java.lang.NoClassDefFoundError in AEM version 6.4.0

  • October 8, 2020
  • 6 replies
  • 5883 views

Hi,

I'm getting below error while installing command as "mvn clean install -PautoInstallAll" to integrate Magento with AEM.


[ERROR] Bundle com.acme.cif:acme-store.core:bundle:0.0.1-SNAPSHOT : Got unexpected exception while analyzing:java.lang.NoClassDefFoundError: com/day/cq/search/impl/util/InvalidDateException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethod(Class.java:2128)
at org.apache.felix.scrplugin.helper.Validator.getMethod(Validator.java:597)
at org.apache.felix.scrplugin.helper.Validator.getMethod(Validator.java:226)
at org.apache.felix.scrplugin.helper.Validator.findLifecycleMethod(Validator.java:246)
at org.apache.felix.scrplugin.SCRDescriptorGenerator.createComponent(SCRDescriptorGenerator.java:437)
at org.apache.felix.scrplugin.SCRDescriptorGenerator.execute(SCRDescriptorGenerator.java:161)
at org.apache.felix.scrplugin.bnd.SCRDescriptorBndPlugin.analyzeJar(SCRDescriptorBndPlugin.java:178)
at aQute.bnd.osgi.Analyzer.doPlugins(Analyzer.java:928)
at aQute.bnd.osgi.Analyzer.analyze(Analyzer.java:247)
at aQute.bnd.osgi.Builder.analyze(Builder.java:439)
at aQute.bnd.osgi.Analyzer.calcManifest(Analyzer.java:958)
at aQute.bnd.osgi.Builder.build(Builder.java:123)
at org.apache.felix.bundleplugin.BundlePlugin.buildOSGiBundle(BundlePlugin.java:948)
at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:450)
at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:371)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
Caused by: java.lang.ClassNotFoundException: com.day.cq.search.impl.util.InvalidDateException
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 39 more

[ERROR] Error(s) found in bundle configuration
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for acme-store 0.0.1-SNAPSHOT:
[INFO]
[INFO] acme-store ......................................... SUCCESS [ 1.774 s]
[INFO] Acme Store - Core .................................. FAILURE [ 37.638 s]
[INFO] Acme Store - UI apps ............................... SKIPPED
[INFO] Acme Store - UI content ............................ SKIPPED
[INFO] Acme Store - Sample Content ........................ SKIPPED
[INFO] Acme Store - All-in-one package .................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 46.067 s
[INFO] Finished at: 2020-10-08T16:12:20+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.felix:maven-bundle-plugin:5.1.1:bundle (default-bundle) on project acme-store.core: Error(s) found in bundle configuration -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :acme-store.core


Please suggest.

Thank you.

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

Hi @jadhavni3 

Try changing uber-jar version from 6.5 to 6.4

 

    <artifactId>uber-jar</artifactId>

    <version>6.4.0</version>

 

AG

6 replies

jadhavni3Author
Level 3
October 9, 2020
@arunpatidar, @joerghoh, @vanegi, @chitramadan, @briankasingli Could anyone please help me on above error ? Thank you.
Level 4
October 9, 2020

Hi @jadhavni3 ,

 

Try to build your project using "mvn clean install".

If build is success is using above command, no issue in your project.

You have to make ensure that the dependency com.day.cq.search is available in AEM.

Go to /system/console/depfinder and search for com.day.cq.search and see which bundle exports it. You can then update you dependency accordingly.

 

Please follow below link for more information.

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/noclassdeffounderror-in-aem/td-p/246691 

 

Regards,

Sandeep.

jadhavni3Author
Level 3
October 9, 2020

Hi @sandeep6,

I have tried it with command "mvn clean install" but getting same error. Also I have updated same dependency in parent POM.xml file which is got from /system/console/depfinder console.

 

If I comment below plugin code in parent POM.xml this command works fine(mvn clean install) but when I add this plugin I'm getting error.

<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-DocURL>
http://sling.apache.org/site/sling-api.html
</Bundle-DocURL>
<Export-Package>
org.apache.sling.api;version=2.1,
org.apache.sling.api.adapter;version=2.2,
org.apache.sling.api.auth;version=1.0,
org.apache.sling.api.request;version=2.1,
org.apache.sling.api.resource;version=2.1,
org.apache.sling.api.scripting;version=2.1,
org.apache.sling.api.servlets;version=2.1,
org.apache.sling.api.wrappers;version=2.1,
org.apache.sling.api.wrappers.impl;version=2.1,
com.adobe.granite.ui.components;version=1.19,
com.adobe.granite.ui.components.ds;version=1.3,
com.day.cq.search;version=1.3,
com.day.cq.search.impl.builder;version=1.3,
com.day.cq.search.impl.util;version=1.3,
com.adobe.granite.ui.components.impl;version=1.19,
com.day.cq.search.eval;version=1.3,
com.fasterxml.jackson.core;version=2.9,
com.fasterxml.jackson.core.type;version=2.9,
com.fasterxml.jackson.databind;version=2.9,
org.apache.commons.io;version=2.6,
org.apache.sling.api.resource;version=2.11,
org.eclipse.jetty.util;version=9.4,
org.apache.sling.spi.resource.provider;version=1.2

</Export-Package>
Require explicit version of the servlet API
<Import-Package>
javax.servlet.*;version=2.4,*
</Import-Package>com.day.cq.search.impl.util.*
<Private-Package>
</Private-Package>
</instructions>
</configuration>
</plugin>

 

Please suggest.

 

Thank you.

 

Level 4
October 9, 2020

Hi @jadhavni3 , 

 

I can see that in your pom.xml one org.apache.felix plugins is there. please explain me why you are adding another one.

jadhavni3Author
Level 3
October 9, 2020

Hi @sandeep6,
I have tried it once before(tried it many ways to resolve this) but it is commented now.

Please suggest.


Thank you.

Anudeep_Garnepudi
Community Advisor
Community Advisor
October 24, 2020

Hi @jadhavni3 

Check and make sure Adobe CQ Search QueryBuilder (com.day.cq.cq-search) version 5.11.2 bundle is available and active. NoClassDefFoundError is a run time error, as it mentioned scope as provided for cq-search bundle. Maven will ignore InvalidDateException class at compile time. We should make sure that the provided jar/bundle with version is available at runtime.

<dependency>
    <groupId>com.day.cq</groupId>
    <artifactId>cq-search</artifactId>
   <version>5.11.2</version>
    <scope>provided</scope>
</dependency>

AG

AG
Anudeep_Garnepudi
Community Advisor
Community Advisor
October 24, 2020

Hi @jadhavni3 

Check and make sure Adobe CQ Search QueryBuilder (com.day.cq.cq-search) version 5.11.2 bundle is available and active. NoClassDefFoundError is a run time error, as it mentioned scope as provided for cq-search bundle. Maven will ignore InvalidDateException class at compile time. We should make sure that the provided jar/bundle with version is available at runtime.

<dependency>
    <groupId>com.day.cq</groupId>
    <artifactId>cq-search</artifactId>
   <version>5.11.2</version>
    <scope>provided</scope>
</dependency>

AG

AG
Anudeep_Garnepudi
Community Advisor
Anudeep_GarnepudiCommunity AdvisorAccepted solution
Community Advisor
October 27, 2020

Hi @jadhavni3 

Try changing uber-jar version from 6.5 to 6.4

 

    <artifactId>uber-jar</artifactId>

    <version>6.4.0</version>

 

AG

AG