0

I have build a jar with this following build.gradle.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.4'
    }
}

apply plugin: 'com.github.johnrengelman.plugin-shadow'
apply plugin: 'java'
apply plugin: 'application'

group 'Main'
version '1.0'

sourceCompatibility = 1.8

repositories {
    jcenter()
}

dependencies {
    testCompile 'junit:junit:4.12'
}
mainClassName = "Indexer"

dependencies {
    compile 'org.apache.lucene:lucene-core:7.4.0'
    compile 'org.apache.lucene:lucene-queryparser:7.4.0'
    compile 'org.apache.lucene:lucene-analyzers-common:7.4.0'
    compile 'org.apache.lucene:lucene-backward-codecs:7.4.0'
    compile 'org.apache.poi:poi:3.9'
    compile 'org.apache.poi:poi-ooxml:3.9'

}

shadowJar {
    manifest {
        attributes 'Main-Class': 'Indexer'
    }
    mergeServiceFiles()
}

Running from the IDE works fine (IntelliJ). After generating the jar with command shadowJar, it shows this error:

Warning: Caught exception attempting to use SAX to load a SAX XMLReader 
Warning: Exception was: shadow.org.xml.sax.SAXException: Can't create default XMLReader;
 is system property org.xml.sax.driver set?
Warning: I will print the stack trace then carry on using the default SAX parser
shadow.org.xml.sax.SAXException: Can't create default XMLReader; 
 is system property org.xml.sax.driver set?

Any help will be appreciated. Thanks.

aran
  • 10,978
  • 5
  • 39
  • 69
Ashik
  • 1,204
  • 12
  • 22
  • 1
    See related question https://stackoverflow.com/questions/33165863/sax2-driver-class-not-found – Mihai8 May 14 '19 at 22:27
  • Why are you using such an old version of Apache POI? What happens if you upgrade to the latest stable release? – Gagravarr May 15 '19 at 11:07
  • I've added the recent version and also `xerces`. Thanks @Gagravarr , the error is gone. But problem still exists. Initialising `XSSFWorkbook` takes forever. I mean it doesn't show any exception but halts the jar literally forever. meaning the execution doesn't go to next line. – Ashik May 19 '19 at 18:28
  • Do a thread dump, and see where it has blocked? – Gagravarr May 19 '19 at 19:16

0 Answers0