Not on Android: Provider com.bea.xml.stream.EventFactory not found

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Not on Android: Provider com.bea.xml.stream.EventFactory not found

Jörn Franke
Hi,

I get the following exception when I run my POI based application on a
certain platform (Apache Flink):

 javax.xml.stream.FactoryConfigurationError: Provider
com.bea.xml.stream.EventFactory not found

This is not on Android and it is POI 4.0.0 using JDK8. The same code runs
fine on other platforms (e.g. MR, Hive, Spark) (the only difference is that
different platforms of course have different jars in the classpath).

It is only when writing a file (reading is no problem!).

I suspect some strange dependency on the classpath (jaxb, xmlbeans 2.x
etc.).

Any idea on how I can find more easily the root cause?

MSExcelWriter:
https://github.com/ZuInnoTe/hadoopoffice/blob/master/fileformat/src/main/java/org/zuinnote/hadoop/office/format/common/writer/msexcel/MSExcelWriter.java

Full stack trace:
Caused by: javax.xml.stream.FactoryConfigurationError: Provider
com.bea.xml.stream.EventFactory not found

        at
javax.xml.stream.FactoryFinder.newInstance(FactoryFinder.java:72)


        at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:176)


        at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:92)


        at
javax.xml.stream.XMLEventFactory.newInstance(XMLEventFactory.java:30)


        at
org.apache.poi.openxml4j.opc.internal.marshallers.PackagePropertiesMarshaller.<clinit>(PackagePropertiesMarshaller.java:41)

        at
org.apache.poi.openxml4j.opc.OPCPackage.<init>(OPCPackage.java:140)


        at
org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:78)


        at
org.apache.poi.openxml4j.opc.OPCPackage.create(OPCPackage.java:365)


        at
org.apache.poi.xssf.usermodel.XSSFWorkbook.newPackage(XSSFWorkbook.java:495)


        at
org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:261)


        at
org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:257)


        at
org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:245)


        at
org.zuinnote.hadoop.office.format.common.writer.msexcel.MSExcelWriter.create(MSExcelWriter.java:177)


        at
org.zuinnote.hadoop.office.format.common.OfficeWriter.create(OfficeWriter.java:96)


        at
org.zuinnote.flink.office.AbstractSpreadSheetFlinkFileOutputFormat.open(AbstractSpreadSheetFlinkFileOutputFormat.java:94)

        at
org.apache.flink.runtime.operators.DataSinkTask.invoke(DataSinkTask.java:202)


        at org.apache.flink.runtime.taskmanager.Task.run(Task.java:703)


        at java.lang.Thread.run(Thread.java:748)


Caused by: java.lang.ClassNotFoundException:
com.bea.xml.stream.EventFactory


        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)


        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)


        at
org.apache.flink.runtime.execution.librarycache.FlinkUserCodeClassLoaders$ChildFirstClassLoader.loadClass(FlinkUserCodeClassLoaders.java:129)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)


        at
javax.xml.stream.FactoryFinder.newInstance(FactoryFinder.java:68)


        ... 17 more
Reply | Threaded
Open this post in threaded view
|

Re: Not on Android: Provider com.bea.xml.stream.EventFactory not found

pj.fanning
These parser settings are normally either set using java system properties
(eg using `-D
javax.xml.stream.XMLEventFactory=com.acme.MyClass`) or jars on your
classpath have META-INF/services (eg
https://github.com/FasterXML/woodstox/tree/master/src/main/resources/META-INF/services).

Adding woodstox to your classpath might help.

https://search.maven.org/artifact/com.fasterxml.woodstox/woodstox-core/5.1.0/jar



--
Sent from: http://apache-poi.1045710.n5.nabble.com/POI-User-f2280730.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Not on Android: Provider com.bea.xml.stream.EventFactory not found

Jörn Franke
In reply to this post by Jörn Franke
I should add that this used to work with Apache POI 3.17

On Sun, Sep 30, 2018 at 6:57 PM Jörn Franke <[hidden email]> wrote:

> Hi,
>
> I get the following exception when I run my POI based application on a
> certain platform (Apache Flink):
>
>  javax.xml.stream.FactoryConfigurationError: Provider
> com.bea.xml.stream.EventFactory not found
>
> This is not on Android and it is POI 4.0.0 using JDK8. The same code runs
> fine on other platforms (e.g. MR, Hive, Spark) (the only difference is that
> different platforms of course have different jars in the classpath).
>
> It is only when writing a file (reading is no problem!).
>
> I suspect some strange dependency on the classpath (jaxb, xmlbeans 2.x
> etc.).
>
> Any idea on how I can find more easily the root cause?
>
> MSExcelWriter:
> https://github.com/ZuInnoTe/hadoopoffice/blob/master/fileformat/src/main/java/org/zuinnote/hadoop/office/format/common/writer/msexcel/MSExcelWriter.java
>
> Full stack trace:
> Caused by: javax.xml.stream.FactoryConfigurationError: Provider
> com.bea.xml.stream.EventFactory not found
>
>         at
> javax.xml.stream.FactoryFinder.newInstance(FactoryFinder.java:72)
>
>
>         at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:176)
>
>
>         at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:92)
>
>
>         at
> javax.xml.stream.XMLEventFactory.newInstance(XMLEventFactory.java:30)
>
>
>         at
> org.apache.poi.openxml4j.opc.internal.marshallers.PackagePropertiesMarshaller.<clinit>(PackagePropertiesMarshaller.java:41)
>
>         at
> org.apache.poi.openxml4j.opc.OPCPackage.<init>(OPCPackage.java:140)
>
>
>         at
> org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:78)
>
>
>         at
> org.apache.poi.openxml4j.opc.OPCPackage.create(OPCPackage.java:365)
>
>
>         at
> org.apache.poi.xssf.usermodel.XSSFWorkbook.newPackage(XSSFWorkbook.java:495)
>
>
>         at
> org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:261)
>
>
>         at
> org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:257)
>
>
>         at
> org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:245)
>
>
>         at
> org.zuinnote.hadoop.office.format.common.writer.msexcel.MSExcelWriter.create(MSExcelWriter.java:177)
>
>
>         at
> org.zuinnote.hadoop.office.format.common.OfficeWriter.create(OfficeWriter.java:96)
>
>
>         at
> org.zuinnote.flink.office.AbstractSpreadSheetFlinkFileOutputFormat.open(AbstractSpreadSheetFlinkFileOutputFormat.java:94)
>
>         at
> org.apache.flink.runtime.operators.DataSinkTask.invoke(DataSinkTask.java:202)
>
>
>         at org.apache.flink.runtime.taskmanager.Task.run(Task.java:703)
>
>
>         at java.lang.Thread.run(Thread.java:748)
>
>
> Caused by: java.lang.ClassNotFoundException:
> com.bea.xml.stream.EventFactory
>
>
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>
>
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>
>
>         at
> org.apache.flink.runtime.execution.librarycache.FlinkUserCodeClassLoaders$ChildFirstClassLoader.loadClass(FlinkUserCodeClassLoaders.java:129)
>
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>
>
>         at
> javax.xml.stream.FactoryFinder.newInstance(FactoryFinder.java:68)
>
>
>         ... 17 more
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Not on Android: Provider com.bea.xml.stream.EventFactory not found

Jörn Franke
small correction, it happens alsol while reading

On Sun, Sep 30, 2018 at 8:53 PM Jörn Franke <[hidden email]> wrote:

> I should add that this used to work with Apache POI 3.17
>
> On Sun, Sep 30, 2018 at 6:57 PM Jörn Franke <[hidden email]> wrote:
>
>> Hi,
>>
>> I get the following exception when I run my POI based application on a
>> certain platform (Apache Flink):
>>
>>  javax.xml.stream.FactoryConfigurationError: Provider
>> com.bea.xml.stream.EventFactory not found
>>
>> This is not on Android and it is POI 4.0.0 using JDK8. The same code runs
>> fine on other platforms (e.g. MR, Hive, Spark) (the only difference is that
>> different platforms of course have different jars in the classpath).
>>
>> It is only when writing a file (reading is no problem!).
>>
>> I suspect some strange dependency on the classpath (jaxb, xmlbeans 2.x
>> etc.).
>>
>> Any idea on how I can find more easily the root cause?
>>
>> MSExcelWriter:
>> https://github.com/ZuInnoTe/hadoopoffice/blob/master/fileformat/src/main/java/org/zuinnote/hadoop/office/format/common/writer/msexcel/MSExcelWriter.java
>>
>> Full stack trace:
>> Caused by: javax.xml.stream.FactoryConfigurationError: Provider
>> com.bea.xml.stream.EventFactory not found
>>
>>         at
>> javax.xml.stream.FactoryFinder.newInstance(FactoryFinder.java:72)
>>
>>
>>         at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:176)
>>
>>
>>         at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:92)
>>
>>
>>         at
>> javax.xml.stream.XMLEventFactory.newInstance(XMLEventFactory.java:30)
>>
>>
>>         at
>> org.apache.poi.openxml4j.opc.internal.marshallers.PackagePropertiesMarshaller.<clinit>(PackagePropertiesMarshaller.java:41)
>>
>>         at
>> org.apache.poi.openxml4j.opc.OPCPackage.<init>(OPCPackage.java:140)
>>
>>
>>         at
>> org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:78)
>>
>>
>>         at
>> org.apache.poi.openxml4j.opc.OPCPackage.create(OPCPackage.java:365)
>>
>>
>>         at
>> org.apache.poi.xssf.usermodel.XSSFWorkbook.newPackage(XSSFWorkbook.java:495)
>>
>>
>>         at
>> org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:261)
>>
>>
>>         at
>> org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:257)
>>
>>
>>         at
>> org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:245)
>>
>>
>>         at
>> org.zuinnote.hadoop.office.format.common.writer.msexcel.MSExcelWriter.create(MSExcelWriter.java:177)
>>
>>
>>         at
>> org.zuinnote.hadoop.office.format.common.OfficeWriter.create(OfficeWriter.java:96)
>>
>>
>>         at
>> org.zuinnote.flink.office.AbstractSpreadSheetFlinkFileOutputFormat.open(AbstractSpreadSheetFlinkFileOutputFormat.java:94)
>>
>>         at
>> org.apache.flink.runtime.operators.DataSinkTask.invoke(DataSinkTask.java:202)
>>
>>
>>         at org.apache.flink.runtime.taskmanager.Task.run(Task.java:703)
>>
>>
>>         at java.lang.Thread.run(Thread.java:748)
>>
>>
>> Caused by: java.lang.ClassNotFoundException:
>> com.bea.xml.stream.EventFactory
>>
>>
>>         at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>>
>>
>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>>
>>
>>         at
>> org.apache.flink.runtime.execution.librarycache.FlinkUserCodeClassLoaders$ChildFirstClassLoader.loadClass(FlinkUserCodeClassLoaders.java:129)
>>
>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>>
>>
>>         at
>> javax.xml.stream.FactoryFinder.newInstance(FactoryFinder.java:68)
>>
>>
>>         ... 17 more
>>
>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Not on Android: Provider com.bea.xml.stream.EventFactory not found

Jörn Franke
it is solved. I used a wrong merge strategy when building the fatjar and
discarded all MANI-FEST ...

On Sun, Sep 30, 2018 at 9:27 PM Jörn Franke <[hidden email]> wrote:

> small correction, it happens alsol while reading
>
> On Sun, Sep 30, 2018 at 8:53 PM Jörn Franke <[hidden email]> wrote:
>
>> I should add that this used to work with Apache POI 3.17
>>
>> On Sun, Sep 30, 2018 at 6:57 PM Jörn Franke <[hidden email]> wrote:
>>
>>> Hi,
>>>
>>> I get the following exception when I run my POI based application on a
>>> certain platform (Apache Flink):
>>>
>>>  javax.xml.stream.FactoryConfigurationError: Provider
>>> com.bea.xml.stream.EventFactory not found
>>>
>>> This is not on Android and it is POI 4.0.0 using JDK8. The same code
>>> runs fine on other platforms (e.g. MR, Hive, Spark) (the only difference is
>>> that different platforms of course have different jars in the classpath).
>>>
>>> It is only when writing a file (reading is no problem!).
>>>
>>> I suspect some strange dependency on the classpath (jaxb, xmlbeans 2.x
>>> etc.).
>>>
>>> Any idea on how I can find more easily the root cause?
>>>
>>> MSExcelWriter:
>>> https://github.com/ZuInnoTe/hadoopoffice/blob/master/fileformat/src/main/java/org/zuinnote/hadoop/office/format/common/writer/msexcel/MSExcelWriter.java
>>>
>>> Full stack trace:
>>> Caused by: javax.xml.stream.FactoryConfigurationError: Provider
>>> com.bea.xml.stream.EventFactory not found
>>>
>>>         at
>>> javax.xml.stream.FactoryFinder.newInstance(FactoryFinder.java:72)
>>>
>>>
>>>         at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:176)
>>>
>>>
>>>         at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:92)
>>>
>>>
>>>         at
>>> javax.xml.stream.XMLEventFactory.newInstance(XMLEventFactory.java:30)
>>>
>>>
>>>         at
>>> org.apache.poi.openxml4j.opc.internal.marshallers.PackagePropertiesMarshaller.<clinit>(PackagePropertiesMarshaller.java:41)
>>>
>>>         at
>>> org.apache.poi.openxml4j.opc.OPCPackage.<init>(OPCPackage.java:140)
>>>
>>>
>>>         at
>>> org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:78)
>>>
>>>
>>>         at
>>> org.apache.poi.openxml4j.opc.OPCPackage.create(OPCPackage.java:365)
>>>
>>>
>>>         at
>>> org.apache.poi.xssf.usermodel.XSSFWorkbook.newPackage(XSSFWorkbook.java:495)
>>>
>>>
>>>         at
>>> org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:261)
>>>
>>>
>>>         at
>>> org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:257)
>>>
>>>
>>>         at
>>> org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:245)
>>>
>>>
>>>         at
>>> org.zuinnote.hadoop.office.format.common.writer.msexcel.MSExcelWriter.create(MSExcelWriter.java:177)
>>>
>>>
>>>         at
>>> org.zuinnote.hadoop.office.format.common.OfficeWriter.create(OfficeWriter.java:96)
>>>
>>>
>>>         at
>>> org.zuinnote.flink.office.AbstractSpreadSheetFlinkFileOutputFormat.open(AbstractSpreadSheetFlinkFileOutputFormat.java:94)
>>>
>>>         at
>>> org.apache.flink.runtime.operators.DataSinkTask.invoke(DataSinkTask.java:202)
>>>
>>>
>>>         at org.apache.flink.runtime.taskmanager.Task.run(Task.java:703)
>>>
>>>
>>>         at java.lang.Thread.run(Thread.java:748)
>>>
>>>
>>> Caused by: java.lang.ClassNotFoundException:
>>> com.bea.xml.stream.EventFactory
>>>
>>>
>>>         at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>>>
>>>
>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>>>
>>>
>>>         at
>>> org.apache.flink.runtime.execution.librarycache.FlinkUserCodeClassLoaders$ChildFirstClassLoader.loadClass(FlinkUserCodeClassLoaders.java:129)
>>>
>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>>>
>>>
>>>         at
>>> javax.xml.stream.FactoryFinder.newInstance(FactoryFinder.java:68)
>>>
>>>
>>>         ... 17 more
>>>
>>>
>>>
>>