2

I am getting an exception while indexing excel sheet of xslx extension through Solr4.7.2 Search API.

org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [default] in context with path [/solr] threw exception [Filter execution threw an exception] with root cause
java.lang.NoClassDefFoundError: Could not initialize class org.apache.poi.openxml4j.opc.internal.unmarshallers.PackagePropertiesUnmarshaller
    at org.apache.poi.openxml4j.opc.OPCPackage.init(OPCPackage.java:154)
    at org.apache.poi.openxml4j.opc.OPCPackage.<init>(OPCPackage.java:141)
    at org.apache.poi.openxml4j.opc.Package.<init>(Package.java:54)
    at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:99)
    at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:221)
    at org.apache.tika.parser.pkg.ZipContainerDetector.detectOfficeOpenXML(ZipContainerDetector.java:194)
    at org.apache.tika.parser.pkg.ZipContainerDetector.detectZipFormat(ZipContainerDetector.java:134)
    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.parser.AutoDetectParser.parse(AutoDetectParser.java:113)
    at org.apache.solr.handler.extraction.ExtractingDocumentLoader.load(ExtractingDocumentLoader.java:219)
    at org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:74)
    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
    at org.apache.solr.core.RequestHandlers$LazyRequestHandlerWrapper.handleRequest(RequestHandlers.java:241)
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:1916)
    at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:768)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:415)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:205)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)

I have 4 Apache POI Jars in my tomcat lib related to this Excel sheet, those are: poi-3.9-20121203.jar, poi-ooxml-3.9-20121203.jar, poi-ooxml-schemas-3.9-20121203.jar, poi-scratchpad-3.9-20121203.jar

I have checked and found the usage of different versions of POI Jars that support extensions in different way.

Please suggest some way to resolve this issue.

f_puras
  • 2,521
  • 4
  • 33
  • 38
Raichu
  • 237
  • 1
  • 7
  • 20
  • The PackagePropertiesUnmarshaller class is found in poi-ooxml-3.9-20121203.jar – Raichu Jul 15 '15 at 12:30
  • Why are you using such an old version of Apache POI? – Gagravarr Jul 15 '15 at 12:44
  • I have upgraded my Apache POI jar with the latest 3.12 version, but the issue still exists. and also checked with 3.10 and 3.11 version final releases. – Raichu Jul 15 '15 at 13:18
  • 1
    Did you make sure you also installed the [POI dependencies](http://poi.apache.org/overview.html#components) as well as just the jars? – Gagravarr Jul 15 '15 at 13:30
  • yes I checked and all dependencies of the jars are installed, but the error remains there. – Raichu Jul 16 '15 at 07:09
  • What's the full stacktrace? You've posted a bit that tells us what class couldn't be loaded, but not the bit that explains why... – Gagravarr Jul 16 '15 at 07:59
  • Figured out: Its just my dom4j-1.6 jar was not compatible as it is not able to parse the rich text such as microsoft office documents. – Raichu Jul 17 '15 at 07:09
  • But here is another problem with LibreOffice .ODS and .ODP format files. Solr is successfully able to Index these documents but is not fetching content from the Indexing also there is no exception in this case. – Raichu Jul 17 '15 at 07:12

1 Answers1

0

I had the same problem, it was caused by two dom4j jars, one was in tomcat/lib and the other in webapps/basic-services/WEB-INF/lib The solution was to exclude dom4j from my app dependencies using maven

<dependency>
    <groupId>dom4j</groupId>
    <artifactId>dom4j</artifactId>
    <version>1.6.1</version>
    <scope>provided</scope>
</dependency>

I was able to pinpoint this problem by inestigating the stack trace of the first occurrence of this exception, I found the following:

Caused by: java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory
    at org.dom4j.DocumentFactory.getInstance(DocumentFactory.java:97)
    at org.dom4j.tree.AbstractNode.<clinit>(AbstractNode.java:39)
Ahmed Qasid
  • 293
  • 2
  • 9