AEM 6.2 SP1 CFP9 Forms add-on breaks usage of Granite Apache POI bundle

Issue

Upgrading to AEM 6.2 SP1 CFP9, Granite Apache POI will fail after you install the Forms add-on.

More specifically, the methods from the SXSSFWorkbook class may will fail with exceptions similar to the following:

Exception : org.apache.xmlbeans.impl.schema.SchemaTypeImpl cannot be cast to org.apache.xmlbeans.impl.values.TypeStoreUserFactory java.lang.ClassCastException: org.apache.xmlbeans.impl.schema.SchemaTypeImpl cannot be cast to org.apache.xmlbeans.impl.values.TypeStoreUserFactory at org.apache.xmlbeans.impl.store.Xobj.setStableType(Xobj.java:1402) at org.apache.xmlbeans.impl.store.Cur.setType(Cur.java:2500) at org.apache.xmlbeans.impl.store.Cur.setType(Cur.java:2485) at org.apache.xmlbeans.impl.store.Locale.newInstance(Locale.java:636) at org.apache.xmlbeans.impl.store.Locale.newInstance(Locale.java:612) at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.newInstance(SchemaTypeLoaderBase.java:198) at org.apache.poi.POIXMLTypeLoader.newInstance(POIXMLTypeLoader.java:112) at org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook$Factory.newInstance(Unknown Source) at org.apache.poi.xssf.usermodel.XSSFWorkbook.onWorkbookCreate(XSSFWorkbook.java:446) at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:244) at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:235) at org.apache.poi.xssf.streaming.SXSSFWorkbook.<init>(SXSSFWorkbook.java:240) at org.apache.poi.xssf.streaming.SXSSFWorkbook.<init>(SXSSFWorkbook.java:210) at org.apache.poi.xssf.streaming.SXSSFWorkbook.<init>(SXSSFWorkbook.java:185) at org.apache.poi.xssf.streaming.SXSSFWorkbook.<init>(SXSSFWorkbook.java:271) at testpoi.servlets.TestPOIServlet.doGet(TestPOIServlet.java:28)

The above stack trace is thrown when you execute the following cast for example:

SXSSFWorkbook w = new SXSSFWorkbook(1000);

Environment

AEM 6.x with Forms Package installed

-> AEM 6.2 SP1 with CFP9 between CFP15 installed.

-> AEM 6.3

-> AEM 6.4

Cause

The issue occurs because Apache POI library (com.adobe.granite.poi) is importing some classes "org.apache.xmlbeans.impl.*" from a bundle added by Forms (Apache ServiceMix :: Bundles :: xmlbeans (org.apache.servicemix.bundles.xmlbeans) and some classes are being used from the POI bundle itself.

Both the bundles package different version of "org.apache.xmlbeans.impl.*" classes: Forms packages 2.4.0 version whereas granite.poi packages 2.0.6 version of the same.

Different versions of the class being picked result in the Cast Exception.

Resolution

The temporary solution is to uninstall the "Apache ServiceMix :: Bundles :: xmlbeansorg.apache.servicemix.bundles.xmlbeans Version 2.4.0.5".

This bundle is used in the J2EE Connector and therefore can safely be removed in case you are using an OSGi instance of AEM Forms.

 

In case you are using a J2EE instance of AEM Forms:

On AEM 6.2, the issue is adressed starting CFP16 , and it will be adressed as well in the next major release of AEM: 6.5.

For a fix in the 6.3 and 6.4 versions, please contact Adobe Technical Support , and request a fix for the bug reference CQ-4244778.

 Adobe

更快、更輕鬆地獲得協助

新的使用者?