NoClassDefFoundError: org/apache/commons/compress/archivers/ArchiveException | Community
Skip to main content
Andras_Fejer
October 16, 2015
Solved

NoClassDefFoundError: org/apache/commons/compress/archivers/ArchiveException

  • October 16, 2015
  • 4 replies
  • 6368 views

Hi everyone,

I have a project in AEM 6.0 (SP2) where we want to extract content from files used on a page for a Solr search index with the help of the Apache Tika library. Now I'm getting (it seems random but rather often) the following exception:

24.09.2015 16:08:03.807 *ERROR* [172.31.19.108 [1443103681822] POST /bin/replicate.json HTTP/1.1] com.day.cq.replication.impl.servlets.CommandServlet Error during replication: org/apache/commons/compress/archivers/ArchiveException java.lang.NoClassDefFoundError: org/apache/commons/compress/archivers/ArchiveException at org.apache.tika.parser.pkg.ZipContainerDetector.detectArchiveFormat(ZipContainerDetector.java:112) at org.apache.tika.parser.pkg.ZipContainerDetector.detect(ZipContainerDetector.java:77) at org.apache.tika.detect.CompositeDetector.detect(CompositeDetector.java:61) at org.apache.tika.detect.CompositeDetector.detect(CompositeDetector.java:61) at org.apache.tika.parser.AutoDetectParser.parse(AutoDetectParser.java:113) at at.spar.portal.intranet.core.solr.utils.SolrContentUtils.getPlainTextFromFolioDocument(SolrContentUtils.java:307) at at.spar.portal.intranet.core.solr.utils.SolrContentUtils.updateOrIndexSolrFolioDocument(SolrContentUtils.java:247) ...

I don't quite understand why I get this error, since it worked before and nothing really changed there. Also I found the "missing" class with the OSGi dependency finder (http://localhost:4502/system/console/depfinder searching for org.apache.commons.compress.archivers.ArchiveException). I even downloaded the commons-compress-1.4.1-withoutxz.jar file and looked inside for the "ArchiveException.class".

I also added the maven dependency for the "commons-compress" lib (also tried a higher version like 1.10) and tried embedding the lib into my project's bundle. Still I get the NoClassDefFoundError.

Any ideas what might cause the issue?

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 Sham_HC

First & for most your request is "/bin/replicate.json" sounds strange it is using fallback Command Servlet. That means aem content management related bundle are missing or not satisfied. I would look more into bundles state & logs before the issue occured. Or blindly try with rebuilding launchpad. If you are not sure how to do such triubleshooting please engage with official support channel.

4 replies

Sham_HC
Sham_HCAccepted solution
October 16, 2015

First & for most your request is "/bin/replicate.json" sounds strange it is using fallback Command Servlet. That means aem content management related bundle are missing or not satisfied. I would look more into bundles state & logs before the issue occured. Or blindly try with rebuilding launchpad. If you are not sure how to do such triubleshooting please engage with official support channel.

Andras_Fejer
October 16, 2015

I made some progress, but I'm not quite satisfied.

I tried adding the "org.osgi.framework.system.packages.extra=org.apache.commons.compressorg.osgi.framework.system.packages.extra=org.apache.commons.compress" to the sling.properties file and had the Weblogic instance restarted since the AEM instance is running on Weblogic application server, but that didn't help.

I also tried uninstalling the "common-compress" bundle in die OSGi console and installing a newer version, with no success there.

 

Now I noticed that the Apache Tika library has several "bundles" to offer. I had "tika-bundle" in my project embedded while AEM has "tika-core" installed (out-of-the-box). If I replace the library in my project with "tika-core" then I don't get the error message anymore, but the content extraction of files is also not working anymore.

smacdonald2008
October 16, 2015

To get this straight - this works sometimes and you see this error other times? 

Andras_Fejer
October 16, 2015

Hey guys, thanks for the quick reply.

smacdonald2008 wrote...

To get this straight - this works sometimes and you see this error other times? 

 

It worked for the past months, then about a week ago I started getting the error on the customer's staging system. Now I also get it on the test-system. Yesterday I managed to get 1-2 occurences of "Page successfully activated" but then right afterwards it didn't work. It still works fine on my local instance. I thought that one of the hotfixes (cq-6.0.0-hotfix-5916-1.1.zip & cq-6.0.0-hotfix-7063-1.0.0.zip) which were installed on the test & staging system were causing the issue. I installed those hotfixes on my local instance expecting to get the NoClassDefFoundError, but it didn't happen.

Sham HC wrote...

First & for most your request is "/bin/replicate.json" sounds strange it is using fallback Command Servlet. That means aem content management related bundle are missing or not satisfied. I would look more into bundles state & logs before the issue occured. Or blindly try with rebuilding launchpad. If you are not sure how to do such triubleshooting please engage with official support channel.

 

According to the OSGi "Sling Servlet Resolver" (http://localhost:4502/system/console/servletresolver) "/bin/replicate.json" goes to the CommandServlet (com.day.cq.replication.impl.servlets.CommandServlet). Indeed some bundles which seem to be related to the cq-6.0.0-hotfix-7063 hotfix were inactive (status resolved) on the test-system. I activated these, but still it didn't solve the error.

I am implementing the Preprocessor interface (com.day.cq.replication.Preprocessor) to check pages on activation if they have any linked files so the content and meta attributes can be extracted for the Solr index documents. That's why the error is occuring during replication.

I don't get it why my application can't find the class, even though I embedded the "commons-compress" into my project bundle and the dependency finder in the OSGi console only shows the "commons-compress-1.4.1-withoutxz" bundle when looking for the "missing" class.