IncompatibleClassChangeError: class org.apache.poi.util.NullLogger can not implement org.apache.poi.util.POILogger, because it is not an interface

0
Hi All, Any help appreciated in solving the error. I have just updated from Ver 7.23.19 up to 8.17.1 and for the most part the update has worked. I’ve followed the suggested guidelines and the code is functioning as expected (for the most part) but when trying to use the GenerateExcelDoc within the XLSReport (Excel exporter 6.1.3) app store module. I get the above error. From checking previous questions on the forum. I believe that this is due to “The org.apache.poi.util.POILogger was an abstract class until apache poi 4.0.1. Now in apache poi 4.1.0 it is an interface. ”. I’ve brought in the latest version of the ExcelImporter and Exceltemplate manager, initially clearing down the old Jars (all I think) and allowing the apps to update the Jars as required.  I can see that the NullLogger class exists within both org.apache.poi.poi-4.1.2.jar and org.apache.xmlbeans.xmlbeans-3.1.0.jar both of which have been brought in with the latest ExcelImporter and XLSReport. Through various attempts of excluding Jars, I have altered the error but not been able to get rid of it. Below is the error message and the user lib file.  (I’m aware of the old JARs against the SFTP module which I wanted to update but have found the domain module quite far removed from ancient version we have currently) ---UPDATE –  I have noticed on the initial run, the error generated is the one attached here but on a second attempt of the same code run we get a different error ..   NoClassDefFoundError occurred for class 'Could not initialize class org.apache.poi.hssf.usermodel.HSSFWorkbook'. Please make sure the userlib folder of  your project includes the correct library which contains this class. ---UPDATE – replaced UserLibs screenshot with an updated (latest version) which shows all the EXCLUDED libs. --Stack Trace -- java.lang.IncompatibleClassChangeError: class org.apache.poi.util.NullLogger can not implement org.apache.poi.util.POILogger, because it is not an interface (org.apache.poi.util.POILogger is in unnamed module of loader com.mendix.container.deployment.internal.Interpreters$ClassLoaders$$anon$1 @     at java.base/java.lang.ClassLoader.defineClass1(Native Method)     at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)     at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)     at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:550)     at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458)     at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)     at java.base/java.security.AccessController.doPrivileged(Native Method)     at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)     at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)     at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)     at org.apache.poi.POIDocument.<clinit>(POIDocument.java:63)     at xlsreport.report.export.ExportExcel.<init>(ExportExcel.java:68)     at xlsreport.actions.GenerateExcelDoc_OLD.createExport(GenerateExcelDoc_OLD.java:190)     at xlsreport.actions.GenerateExcelDoc_OLD.executeAction(GenerateExcelDoc_OLD.java:74)     at xlsreport.actions.GenerateExcelDoc_OLD.executeAction(GenerateExcelDoc_OLD.java:1)     at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:46)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.doCall(CoreActionHandlerImpl.scala:71)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:49)     at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:54)     at com.mendix.basis.actionmanagement.ActionManagerBase$1.execute(ActionManagerBase.java:147)     at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:26)     at com.mendix.basis.actionmanagement.ActionManagerBase.executeSync(ActionManagerBase.java:152)     at com.mendix.basis.actionmanagement.UserActionCallBuilderImpl.execute(UserActionCallBuilderImpl.scala:30)     at com.mendix.modules.microflowengine.actions.actioncall.JavaAction.execute(JavaAction.scala:56)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.$anonfun$execute$1(MicroflowObject.scala:32)     at scala.Option.flatMap(Option.scala:283)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.execute(MicroflowObject.scala:29)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.$anonfun$executeAfterBreakingIfNecessary$2(MicroflowImpl.scala:172)     at scala.Option.flatMap(Option.scala:283)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.scala:172)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.scala:119)     at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:46)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.doCall(CoreActionHandlerImpl.scala:71)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:49)     at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:54)     at com.mendix.basis.actionmanagement.ActionManagerBase$1.execute(ActionManagerBase.java:147)     at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:26)     at com.mendix.basis.actionmanagement.ActionManagerBase.executeSync(ActionManagerBase.java:152)     at com.mendix.basis.component.InternalCoreBase.executeSync(InternalCoreBase.java:377)     at com.mendix.modules.microflowengine.MicroflowExecuter$.executeSync(MicroflowExecuter.scala:18)     at com.mendix.modules.microflowengine.actions.SubMicroflowAction.execute(SubMicroflowAction.scala:34)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.$anonfun$execute$1(MicroflowObject.scala:32)     at scala.Option.flatMap(Option.scala:283)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.execute(MicroflowObject.scala:29)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.$anonfun$executeAfterBreakingIfNecessary$2(MicroflowImpl.scala:172)     at scala.Option.flatMap(Option.scala:283)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.scala:172)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.scala:119)     at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:46)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.doCall(CoreActionHandlerImpl.scala:71)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:49)     at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:54)     at com.mendix.basis.actionmanagement.ActionManagerBase$1.execute(ActionManagerBase.java:147)     at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:26)     at com.mendix.basis.actionmanagement.ActionManagerBase.executeSync(ActionManagerBase.java:152)     at com.mendix.basis.component.InternalCoreBase.executeSync(InternalCoreBase.java:377)     at com.mendix.modules.microflowengine.MicroflowExecuter$.executeSync(MicroflowExecuter.scala:18)     at com.mendix.modules.microflowengine.actions.SubMicroflowAction.execute(SubMicroflowAction.scala:34)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.$anonfun$execute$1(MicroflowObject.scala:32)     at scala.Option.flatMap(Option.scala:283)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.execute(MicroflowObject.scala:29)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.$anonfun$executeAfterBreakingIfNecessary$2(MicroflowImpl.scala:172)     at scala.Option.flatMap(Option.scala:283)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.scala:172)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.scala:119)     at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:46)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.doCall(CoreActionHandlerImpl.scala:71)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:49)     at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:54)     at com.mendix.basis.actionmanagement.ActionManagerBase$1.execute(ActionManagerBase.java:147)     at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:26)     at com.mendix.basis.actionmanagement.ActionManagerBase.executeSync(ActionManagerBase.java:152)     at com.mendix.basis.component.InternalCoreBase.executeSync(InternalCoreBase.java:377)     at com.mendix.modules.microflowengine.MicroflowExecuter$.executeSync(MicroflowExecuter.scala:18)     at com.mendix.modules.microflowengine.actions.SubMicroflowAction.execute(SubMicroflowAction.scala:34)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.$anonfun$execute$1(MicroflowObject.scala:32)     at scala.Option.flatMap(Option.scala:283)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.execute(MicroflowObject.scala:29)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.$anonfun$executeAfterBreakingIfNecessary$2(MicroflowImpl.scala:172)     at scala.Option.flatMap(Option.scala:283)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.scala:172)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.scala:119)     at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:46)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.doCall(CoreActionHandlerImpl.scala:71)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:49)     at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:54)     at com.mendix.basis.actionmanagement.DefaultActionMonitor$.$anonfun$run$1(CustomMonitoredAction.scala:18)     at com.mendix.basis.actionmanagement.IMonitoredAction$$anon$1.execute(IMonitoredAction.scala:47)     at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:26)     at com.mendix.basis.actionmanagement.IMonitoredAction.monitor(IMonitoredAction.scala:49)     at com.mendix.basis.actionmanagement.IMonitoredAction.monitor$(IMonitoredAction.scala:25)     at com.mendix.basis.actionmanagement.CustomMonitoredAction.monitor(CustomMonitoredAction.scala:22)     at com.mendix.basis.actionmanagement.DefaultActionMonitor$.run(CustomMonitoredAction.scala:18)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.runMonitoredAction(CoreActionHandlerImpl.scala:60)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:47)     at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:54)     at com.mendix.basis.actionmanagement.ActionManager.$anonfun$execute$1(ActionManager.scala:118)     at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:671)     at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:430)     at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)     at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)     at java.base/java.lang.Thread.run(Thread.java:834) -- UserLib folder --
asked
2 answers
0

Have you tried removing poi-4.0.1.jar from your userlib? 

Essentially you need to get rid of the older versions of the POI library. Hopefully the older modules will work with this, unless there is a major breaking change apart from the change to an interface from an abstract class.

Good luck

answered
0

So I’ve manage to eventually find the source of the issue. Which the error message was highlighting but we were unable to find.

There was a duplicate of the POILogger.class file within the Javasource folder which was conflicting with the UserLib required versions for the XLSReport and ExcelImporter modules.

--- Fix Steps –

  • Open Eclipse and install/add a plug-in for Decompiling (Enhanced Class Decompiler plugin).
  • Associate .class files to Class Decompiler Viewer (as below)
  • Clean and Deploy to eclipse.
  • Within Eclipse Debug as and add break points at nearest location where the error is happening.
    • Mine was within the ExportExcel.java for the call “this.book = new HSSFWorkbook(); “ showing as at xlsreport.report.export.ExportExcel.<init>(ExportExcel.java:68)
  • Once you have the decompiler you are able to step into this call. 
  • When you go into the .class file in this case HSSFWorkbook.class you can find the “import org.apache.poi.util.POILogger”.
  • Just by hovering over the import text you should be able to see that there are two references to the conflicting locations.
    • In our instance the correct one was within the Userlib as brought in by the app store modules whereas there was a “org.apache.poi.util.POILogger” sitting within the javasource folder.
  • I initially tried to exlclude from the build path but this didn’t stick, so I delete the lib from the javasource code.
  • after cleaning and deploying I no longer encountered the error.

 

 

Hopefully these steps will help someone else who encounters this error.

Colin

answered