Discussion:
'XSSFWorkbook wb = new XSSFWorkbook();' cause Failed resolution of: Ljavax/xml/stream/XMLEventFactory;
ranzhang35
2018-09-27 01:28:02 UTC
Permalink
I removed 'stax-api-1.0.1.jars' from my class path, now I'm getting the
following errors when 'XSSFWorkbook wb = new XSSFWorkbook();' is called.

Following are the jar files in my class path:
poi-4.0.0.jar
activation-1.1.1.jar
commons-codec-1.11.jar'
commons-collections4-4.2.jar
commons-compress-1.18.jar
commons-compress-1.18-javadoc.jar
commons-logging-1.2.jar
commons-math3-3.6.1.jar
log4j-1.2.17.jar
curvesapi-1.05.jar
junit-4.12.jar
log4j-1.2.17.ja
ooxml-schemas-1.4.jar
poi-excelant-4.0.0.jar
poi-ooxml-4.0.0.jar
poi-scratchpad-4.0.0.jar
xmlbeans-3.0.1.jar

Process: com.example.mkproduct.myapplication2, PID: 12103
java.lang.NoClassDefFoundError: Failed resolution of:
Ljavax/xml/stream/XMLEventFactory;
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
com.example.mkproduct.myapplication2.MainActivity.onCreate(MainActivity.java:67)
at android.app.Activity.performCreate(Activity.java:6679)
at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.ClassNotFoundException: Didn't find class
"javax.xml.stream.XMLEventFactory" on path: DexPathList[[zip file
"/data/app/com.example.mkproduct.myapplication2-2/base.apk", zip file
"/data/app/com.example.mkproduct.myapplication2-2/split_lib_dependencies_apk.apk",
zip file
"/data/app/com.example.mkproduct.myapplication2-2/split_lib_slice_0_apk.apk",
zip file
"/data/app/com.example.mkproduct.myapplication2-2/split_lib_slice_1_apk.apk",
zip file
"/data/app/com.example.mkproduct.myapplication2-2/split_lib_slice_2_apk.apk",
zip file
"/data/app/com.example.mkproduct.myapplication2-2/split_lib_slice_3_apk.apk",
zip file
"/data/app/com.example.mkproduct.myapplication2-2/split_lib_slice_4_apk.apk",
zip file
"/data/app/com.example.mkproduct.myapplication2-2/split_lib_slice_5_apk.apk",
zip file
"/data/app/com.example.mkproduct.myapplication2-2/split_lib_slice_6_apk.apk",
zip file
"/data/app/com.example.mkproduct.myapplication2-2/split_lib_slice_7_apk.apk",
zip file
"/data/app/com.example.mkproduct.myapplication2-2/split_lib_slice_8_apk.apk",
zip file
"/data/app/com.example.mkproduct.myapplication2-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.mkproduct.myapplication2-2/lib/x86,
/system/lib, /vendor/lib]]
at
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
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
com.example.mkproduct.myapplication2.MainActivity.onCreate(MainActivity.java:67) 
at android.app.Activity.performCreate(Activity.java:6679) 
at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118) 
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618) 
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726) 
at android.app.ActivityThread.-wrap12(ActivityThread.java) 
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6119) 
at java.lang.reflect.Method.invoke(Native Method) 
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 
Suppressed: java.io.IOException: No original dex files found for dex
location
/data/app/com.example.mkproduct.myapplication2-2/split_lib_slice_0_apk.apk
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:367)
at dalvik.system.DexFile.<init>(DexFile.java:112)
at dalvik.system.DexFile.<init>(DexFile.java:77)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:359)
at dalvik.system.DexPathList.makeElements(DexPathList.java:323)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:263)
at dalvik.system.DexPathList.<init>(DexPathList.java:126)
at
dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:48)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
2018-09-26 18:10:56.740 12103-12103/com.example.mkproduct.myapplication2
E/AndroidRuntime: at
com.android.internal.os.PathClassLoaderFactory.createClassLoader(PathClassLoaderFactory.java:43)
at
android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:58)
at
android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:520)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:553)
at
android.app.ActivityThread.getTopLevelResources(ActivityThread.java:1866)
at android.app.LoadedApk.getResources(LoadedApk.java:766)
at android.app.ContextImpl.<init>(ContextImpl.java:2038)
at android.app.ContextImpl.createAppContext(ContextImpl.java:1983)
at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:5294)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
... 6 more
Suppressed: java.io.IOException: No original dex files found for dex
location
/data/app/com.example.mkproduct.myapplication2-2/split_lib_slice_7_apk.apk
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:367)
at dalvik.system.DexFile.<init>(DexFile.java:112)
at dalvik.system.DexFile.<init>(DexFile.java:77)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:359)
at dalvik.system.DexPathList.makeElements(DexPathList.java:323)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:263)
at dalvik.system.DexPathList.<init>(DexPathList.java:126)
at
dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:48)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
at
com.android.internal.os.PathClassLoaderFactory.createClassLoader(PathClassLoaderFactory.java:43)
at
android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:58)
at
android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:520)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:553)
at
android.app.ActivityThread.getTopLevelResources(ActivityThread.java:1866)
at android.app.LoadedApk.getResources(LoadedApk.java:766)
at android.app.ContextImpl.<init>(ContextImpl.java:2038)
at android.app.ContextImpl.createAppContext(ContextImpl.java:1983)
at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:5294)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)







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

---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@poi.apache.org
For additional commands, e-mail: user-***@poi.apache.org
Dominik Stadler
2018-09-27 19:12:31 UTC
Permalink
Hi,

Apache POI will not run out of the box on Android, there are a few things
that cause problems, you can try to use the shaded jar from the project at
https://github.com/centic9/poi-on-android/ which tries to avoid most of the
problems that you otherwise run into.

Dominik.
Post by ranzhang35
I removed 'stax-api-1.0.1.jars' from my class path, now I'm getting the
following errors when 'XSSFWorkbook wb = new XSSFWorkbook();' is called.
poi-4.0.0.jar
activation-1.1.1.jar
commons-codec-1.11.jar'
commons-collections4-4.2.jar
commons-compress-1.18.jar
commons-compress-1.18-javadoc.jar
commons-logging-1.2.jar
commons-math3-3.6.1.jar
log4j-1.2.17.jar
curvesapi-1.05.jar
junit-4.12.jar
log4j-1.2.17.ja
ooxml-schemas-1.4.jar
poi-excelant-4.0.0.jar
poi-ooxml-4.0.0.jar
poi-scratchpad-4.0.0.jar
xmlbeans-3.0.1.jar
Process: com.example.mkproduct.myapplication2, PID: 12103
Ljavax/xml/stream/XMLEventFactory;
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
com.example.mkproduct.myapplication2.MainActivity.onCreate(MainActivity.java:67)
at android.app.Activity.performCreate(Activity.java:6679)
at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.ClassNotFoundException: Didn't find class
"javax.xml.stream.XMLEventFactory" on path: DexPathList[[zip file
"/data/app/com.example.mkproduct.myapplication2-2/base.apk", zip file
"/data/app/com.example.mkproduct.myapplication2-2/split_lib_dependencies_apk.apk",
zip file
"/data/app/com.example.mkproduct.myapplication2-2/split_lib_slice_0_apk.apk",
zip file
"/data/app/com.example.mkproduct.myapplication2-2/split_lib_slice_1_apk.apk",
zip file
"/data/app/com.example.mkproduct.myapplication2-2/split_lib_slice_2_apk.apk",
zip file
"/data/app/com.example.mkproduct.myapplication2-2/split_lib_slice_3_apk.apk",
zip file
"/data/app/com.example.mkproduct.myapplication2-2/split_lib_slice_4_apk.apk",
zip file
"/data/app/com.example.mkproduct.myapplication2-2/split_lib_slice_5_apk.apk",
zip file
"/data/app/com.example.mkproduct.myapplication2-2/split_lib_slice_6_apk.apk",
zip file
"/data/app/com.example.mkproduct.myapplication2-2/split_lib_slice_7_apk.apk",
zip file
"/data/app/com.example.mkproduct.myapplication2-2/split_lib_slice_8_apk.apk",
zip file
"/data/app/com.example.mkproduct.myapplication2-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.mkproduct.myapplication2-2/lib/x86,
/system/lib, /vendor/lib]]
at
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
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
com.example.mkproduct.myapplication2.MainActivity.onCreate(MainActivity.java:67)
at android.app.Activity.performCreate(Activity.java:6679)
at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Suppressed: java.io.IOException: No original dex files found for dex
location
/data/app/com.example.mkproduct.myapplication2-2/split_lib_slice_0_apk.apk
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:367)
at dalvik.system.DexFile.<init>(DexFile.java:112)
at dalvik.system.DexFile.<init>(DexFile.java:77)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:359)
at dalvik.system.DexPathList.makeElements(DexPathList.java:323)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:263)
at dalvik.system.DexPathList.<init>(DexPathList.java:126)
at
dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:48)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
2018-09-26 18:10:56.740 12103-12103/com.example.mkproduct.myapplication2
E/AndroidRuntime: at
com.android.internal.os.PathClassLoaderFactory.createClassLoader(PathClassLoaderFactory.java:43)
at
android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:58)
at
android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:520)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:553)
at
android.app.ActivityThread.getTopLevelResources(ActivityThread.java:1866)
at android.app.LoadedApk.getResources(LoadedApk.java:766)
at android.app.ContextImpl.<init>(ContextImpl.java:2038)
at android.app.ContextImpl.createAppContext(ContextImpl.java:1983)
at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:5294)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
... 6 more
Suppressed: java.io.IOException: No original dex files found for dex
location
/data/app/com.example.mkproduct.myapplication2-2/split_lib_slice_7_apk.apk
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:367)
at dalvik.system.DexFile.<init>(DexFile.java:112)
at dalvik.system.DexFile.<init>(DexFile.java:77)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:359)
at dalvik.system.DexPathList.makeElements(DexPathList.java:323)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:263)
at dalvik.system.DexPathList.<init>(DexPathList.java:126)
at
dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:48)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
at
com.android.internal.os.PathClassLoaderFactory.createClassLoader(PathClassLoaderFactory.java:43)
at
android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:58)
at
android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:520)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:553)
at
android.app.ActivityThread.getTopLevelResources(ActivityThread.java:1866)
at android.app.LoadedApk.getResources(LoadedApk.java:766)
at android.app.ContextImpl.<init>(ContextImpl.java:2038)
at android.app.ContextImpl.createAppContext(ContextImpl.java:1983)
at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:5294)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
--
Sent from: http://apache-poi.1045710.n5.nabble.com/POI-User-f2280730.html
---------------------------------------------------------------------
ranzhang35
2018-09-28 20:20:28 UTC
Permalink
Dominik:
I tried your github project, it doesn't contain the pre-built
poishadow-all.jar file. I built the project and generated the
'poishadow-all.jar', but when I use it in my project, it still crashes at
XSSFWorkbook wb = new XSSFWorkbook();

Please send me the pre-built poishadow-all.jar file to me at
***@mkprod.com



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

---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@poi.apache.org
For additional commands, e-mail: user-***@poi.apache.org
ranzhang35
2018-09-28 20:45:48 UTC
Permalink
contact me rzhang at mkprod.com



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

---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@poi.apache.org
For additional commands, e-mail: user-***@poi.apache.org

Loading...