0

I wrote a working Groovy script in eclipse but when called from commandline it throws the error message: Provider for javax.xml.parsers.DocumentBuilderFactory cannot be found

The error is thrown by Fillo, a library to parse xlsx files. The problem still seems to be general because I found a lot of pages containing the error message:

but was not able to solve the issue or addapt the suggested solution.

I tried to exclude dependencies:

@GrabExclude('xml-apis:xml-apis')

Import other jars and checked my lib folders, both {groovyinstallation}/lib and {usrhome}/.groovy

import groovy.util.logging.Log
import com.codoid.products.fillo.Connection
import com.codoid.products.fillo.Fillo
import com.codoid.products.fillo.Recordset
import groovy.transform.Field
import java.net.Proxy
import java.text.SimpleDateFormat
import java.util.logging.Logger
import groovy.xml.XmlUtil

@GrabExclude('xml-apis:xml-apis')
...
//Code Snippet where Error is thrown
Connection connection=fillo.getConnection(Path+"\\"+Filename.xlsx)

The Error message is get is the following:

Caught: javax.xml.parsers.FactoryConfigurationError: Provider for javax.xml.parsers.DocumentBuilderFactory cannot be found
javax.xml.parsers.FactoryConfigurationError: Provider for javax.xml.parsers.DocumentBuilderFactory cannot be found
        at org.apache.poi.ooxml.util.DocumentHelper.<clinit>(DocumentHelper.java:100)
        at org.apache.poi.openxml4j.opc.internal.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:395)
        at org.apache.poi.openxml4j.opc.internal.ContentTypeManager.<init>(ContentTypeManager.java:104)
        at org.apache.poi.openxml4j.opc.internal.ZipContentTypeManager.<init>(ZipContentTypeManager.java:54)
        at org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:260)
        at org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:726)
        at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:304)
        at org.apache.poi.ooxml.util.PackageHelper.open(PackageHelper.java:37)
        at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:303)
        at com.codoid.products.fillo.Fillo.getWorkbook(Fillo.java:57)
        at com.codoid.products.fillo.Fillo.getConnection(Fillo.java:41)
        at com.codoid.products.fillo.Fillo$getConnection.call(Unknown Source)
        at xlsxParser.loadXLSX(ResultsAutomation.groovy:406)
        at xlsxParser$loadXLSX.call(Unknown Source)
        at ResultsAutomation.run(ResultsAutomation.groovy:624)
Sined24
  • 25
  • 1
  • 8

1 Answers1

0

Found the issue after some frustrating hours in the Jar Hell. Fillo is building their jar including standard libraries from javax but also some other sources like apache and w3.

This caused some problems with different instances. After deleting these libraries in the fillo.jar, I was able to run my script properly from command line.

Sined24
  • 25
  • 1
  • 8