java.lang.NoSuchMethodError excel exporter

2
Hi Forum,   I was migrating my application from Mendix version 8.18.19 to 9.6.10 and am getting following error in the function  call that is using the Excel exporter modules java action “GenerateExcelDoc”. It is showing following error:   Error in execution of monitored action '{"name":"ACT_BonusAggregation_ExportExcel","type":"Microflow"}' (execution id: 270c3e96-ae25-4719-b5a9-c08edbdd88a0, execution type: CLIENT_ASYNC_MONITORED) -------- java.lang.NoSuchMethodError: org.apache.commons.io.IOUtils.byteArray(I)[B     at org.apache.commons.io.output.AbstractByteArrayOutputStream.needNewBuffer(AbstractByteArrayOutputStream.java:104)     at org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream.<init>(UnsynchronizedByteArrayOutputStream.java:51)     at org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream.<init>(UnsynchronizedByteArrayOutputStream.java:38)     at org.apache.poi.xssf.usermodel.XSSFWorkbook.newPackage(XSSFWorkbook.java:513)     at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:230)     at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:226)     at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:214)     at xlsreport.report.export.ExportExcel.<init>(ExportExcel.java:73)     at xlsreport.actions.GenerateExcelDoc.createExport(GenerateExcelDoc.java:193)     at xlsreport.actions.GenerateExcelDoc.executeAction(GenerateExcelDoc.java:77)     at xlsreport.actions.GenerateExcelDoc.executeAction(GenerateExcelDoc.java:34)     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:48)     at com.mendix.core.actionmanagement.internal.InternalCoreAction.call(InternalCoreAction.scala:25)     at com.mendix.basis.actionmanagement.ActionManager.$anonfun$executeSync$2(ActionManager.scala:80)     at com.mendix.util.classloading.Runner.withContextClassLoader(Runner.java:19)     at com.mendix.basis.actionmanagement.ActionManager.executeSync(ActionManager.scala:79)     at com.mendix.basis.actionmanagement.UserActionCallBuilderImpl.execute(UserActionCallBuilderImpl.scala:34)     at com.mendix.modules.microflowengine.actions.actioncall.ForegroundJavaAction.doExecute(ForegroundJavaAction.scala:35)     at com.mendix.modules.microflowengine.actions.actioncall.ForegroundJavaAction.doExecute(ForegroundJavaAction.scala:11)     at com.mendix.modules.microflowengine.actions.actioncall.JavaAction.execute(JavaAction.scala:38)     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:167)     at scala.Option.flatMap(Option.scala:283)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.scala:167)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.scala:114)     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:48)     at com.mendix.core.actionmanagement.internal.InternalCoreAction.call(InternalCoreAction.scala:25)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.$anonfun$runMonitoredAction$1(CoreActionHandlerImpl.scala:59)     at com.mendix.basis.actionmanagement.ActionMonitoring$.$anonfun$monitor$1(ActionMonitoring.scala:49)     at com.mendix.util.classloading.Runner.withContextClassLoader(Runner.java:19)     at com.mendix.basis.actionmanagement.ActionMonitoring$.monitor(ActionMonitoring.scala:49)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.runMonitoredAction(CoreActionHandlerImpl.scala:59)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:46)     at com.mendix.core.actionmanagement.internal.InternalCoreAction.call(InternalCoreAction.scala:25)     at com.mendix.basis.actionmanagement.ActionManager.$anonfun$executeAsync$3(ActionManager.scala:64)     at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:672)     at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:431)     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)     I tried keeping the latest jar files related to this module and removing the lower duplicate versions in my userlib folder, but it did not help as well.  Thanks for help in advance!
asked
7 answers
5

The issue is with the duplicate jar file. you can delete duplicat jar file.
Then clean your deployement directory.



https://forum.mendix.com/link/questions/117458

answered
3

We are using Mendix 8.18.19 and had exactly the same error message with the import of an .xlsx file. First we noticed that we could import an .xls file but this is not what we wanted. The solution for us was to delete all the poi-jar files version 5.5.2 in the user lib and downgrade the Excel importer to 9.2.0, the latest available version just before Mendix upgraded the poi jar-files to 5.5.2. Now it worked fine. The userlib then looks like this (among other jar-files of course):

 

answered
1

Import Excel Import Module and Excel Export Module(XLSImport) From Marketplace that have Apache poi library of version 4.xx

This will resolve your issue.

answered
1

In our app IOUtils also existed in org.apache.commons.io-2.3.0.jar. Removing that jar solved this issue. It came with the UnitTesting App.-po

How to discover  what jars contains the same class with the same package name?

  1. Retrieve jd-gui. This tool displays the content of a jar-file
  2. Open a command-prompt.
  3. Go to the userlib of your app.
  4. For this case run: for /R %G in (*.jar) do @"D:\Program Files\Java\jdk1.8.0_241\bin\jar" -tvf "%G" | find "IOUtils" > NUL && echo %G
  5. For each found jar open it in jd-gui and check if the found IOUtils is from package  org.apache.commons.io
  6. If it is in that package check if it has the methode byteArray(I) . If not it is an old version that must be deleted.

 

Hope this answer helps for other cases with NoSuchMethodError  or NoSuchMethodField

answered
0

There are already a couple of forum posts about this one:

https://forum.mendix.com/link/questions/117458
https://forum.mendix.com/link/questions/117655

Double check the org.apache.poi ones. They all should have the same number (currently 5.2.2.) I had a org.apache.poi.poi-ooxml-schemas-4.1.2 file lingering that was causing this error in my case.

You could also try this tool: https://github.com/cinaq/mendix-userlib-cleaner

For safety first make a backup of your userlib directory before using this tool.

Regards,

Ronald

 

answered
0

Make sure to clean the deployment directory of your project.

 

Project → Clean Deployment Directory.

answered
0

I'm facing the exact same problem. I don't have any duplicate files in the userlib, and only the newest version. Also the Userlib Cleaner didn't solve the problem. Does anyone have another suggestion how to solve this problem?

answered