Bug 56550 - Java error message showed when deploying to AIX environment.
Summary: Java error message showed when deploying to AIX environment.
Alias: None
Product: POI
Classification: Unclassified
Component: POI Overall (show other bugs)
Version: 3.9-FINAL
Hardware: Other AIX
: P2 blocker (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2014-05-21 09:47 UTC by henry.sze
Modified: 2018-11-01 13:03 UTC (History)
0 users

List of included JAR files ; Error prompt in WebLogic 12c (243.00 KB, application/msword)
2014-05-21 09:47 UTC, henry.sze
JVM version and vendor using in Windows and AIX (200.00 KB, application/msword)
2014-05-23 02:58 UTC, henry.sze

Note You need to log in before you can comment on or make changes to this bug.
Description henry.sze 2014-05-21 09:47:44 UTC
Created attachment 31644 [details]
List of included JAR files ; Error prompt in WebLogic 12c

Below steps will reproduce the problem :
1. Included the required XDocReport jar files (Including the "poi-ooxml-3.9.jar")in my JavaEE project and export to an EAR file.
2. Deployed the EAR file to WebLogic Server 12c on the AIX.
3. Update the EAR and start the project as an application on WebLogic Server 12c.

Expected: The project is started and state is "Active".
Actual: Java error showed "java.lang.NoSuchFieldException: classes"

- Seems there is no problem if the same EAR is deployed to WebLogic Server 12c in Windows environment.

- I further found the below error lines in WebLogic 12c's log files :

Caused By: java.lang.NoSuchFieldException: classes
	at java.lang.Class.getDeclaredFieldImpl(Native Method)
	at java.lang.Class.getDeclaredField(Class.java:599)
	at org.apache.poi.util.OOXMLLite.<clinit>(OOXMLLite.java:39)
	at java.lang.J9VMInternals.initializeImpl(Native Method)
	at java.lang.J9VMInternals.initialize(J9VMInternals.java:236)
	at java.lang.Class.forNameImpl(Native Method)
	at java.lang.Class.forName(Class.java:219)

Refer to line 4 >> at org.apache.poi.util.OOXMLLite.<clinit>(OOXMLLite.java:39)
I further found the "OOXMLLite.class" in "poi-ooxml-3.9.jar", and next I try to read the content with a decompiler and found some "classes" definition in the files which I guess maybe the cause of the error ?
Comment 1 Dominik Stadler 2014-05-21 11:48:22 UTC
Can you please describe which exact version of the JDK you are using on the two environments?

This might be related to IBM JDK being used on AIX by default. I have created and started a separate Jenkins run on IBM JDK to see if we can reproduce the problem with IBM JDK on Linux or really some AIX machine is needed to reproduce the problem.
Comment 2 henry.sze 2014-05-23 02:58:43 UTC
Created attachment 31651 [details]
JVM version and vendor using in Windows and AIX
Comment 3 henry.sze 2014-05-23 03:01:34 UTC
Please find attached the screen showing the JVM difference in both environment. 
Seems there is not exact matched JVM version provided by IBM.
Comment 4 Dominik Stadler 2014-12-22 12:21:30 UTC
See https://builds.apache.org/view/POI/job/POI-JDK-IBM/7/console for the same on the Apache Jenkins instance.
Comment 5 Dominik Stadler 2014-12-22 12:44:43 UTC
I have now adjust the code which fails to not try to access this field during static initialization of the class. This should prevent this case, however please note that compiling POI itself will still not work with IBM JDK as there we currently need this information for creating the Schema jars.

See https://builds.apache.org/view/POI/job/POI-JDK-IBM/ for the latest tries of compiling with IBM JDK which still fail.

I am closing this as the problem you reported should be fixed and full support for compiling POI with IBM JDK is not planned.

Please try with a nightly build that includes this fix to see if there are additional hurdles for running on IBM JDK, unfortunately we do not have good test environments for this available currently...
Comment 6 Tim Allison 2018-11-01 13:03:08 UTC
After I swapped out Oracle 1.8 for openjdk openj9 1.8, my build is failing from this problem.

openjdk version "1.8.0_192"
OpenJDK Runtime Environment (build 1.8.0_192-b12)
Eclipse OpenJ9 VM (build openj9-0.11.0, JRE 1.8.0 Windows 10 amd64-64-Bit Compressed References 20181019_105 (JIT enabled, AOT enabled)
OpenJ9   - 090ff9dc
OMR      - ea548a66
JCL      - 51609250b5 based on jdk8u192-b12)

Exception in thread "main" java.lang.RuntimeException: java.lang.NoSuchFieldException: classes
     [java]     at org.apache.poi.ooxml.util.OOXMLLite$2.run(OOXMLLite.java:340)OK (2473 tests)
     [java]     at org.apache.poi.ooxml.util.OOXMLLite$2.run(OOXMLLite.java:331)
     [java]     at java.security.AccessController.doPrivileged(AccessController.java:647)
     [java]     at org.apache.poi.ooxml.util.OOXMLLite.getLoadedClasses(OOXMLLite.java:331)Copying classes to poi-trunk2\build\ooxml-lite-classes
     [java]     at org.apache.poi.ooxml.util.OOXMLLite.build(OOXMLLite.java:196)
     [java]     at org.apache.poi.ooxml.util.OOXMLLite.main(OOXMLLite.java:107)
     [java] Caused by: java.lang.NoSuchFieldException: classes
     [java]     at java.lang.Class.getDeclaredField(Class.java:820)
     [java]     at org.apache.poi.ooxml.util.OOXMLLite$2.run(OOXMLLite.java:336)
     [java]     ... 5 more