Reputation: 49
I am developing simulation models in AnyLogic and need to read data from an external excel sheet. I created the project on Win11 OS and used Connectivity's Excel File module and successfully implemented the reading functionality.
But when I copy this project to run on a Macbook Pro with Apple M2 chip, the project reports an error: "error reading excel file java.lang.NoSuchMethodError: 'byte[] org.apache.commons.io.IOUtils.byteArray[int]'”.
I used anylogic-provided excelFile.getLastRowNum
, excelFile.getCellNumericValue
and excelFile.getCellStringValue
functions in my code of an Event's Action. The code is as follows:
int time = (int)time() - 15;
String airportName = checkAptName(this);
for (int rowIndex = 2; rowIndex < excelFile.getLastRowNum(airportName); rowIndex++) { // Start with 2, 1 is the head
int tstValue = (int) excelFile.getCellNumericValue(airportName, rowIndex, 1);
if (tstValue == time) {
String destinationValue = excelFile.getCellStringValue(airportName, rowIndex, 2);
destinationApts.add(main.airports.get(getApt(destinationValue)));
departingPed.inject(1);
}
}
I tried installing the latest JDK which didn't solve the problem. As can be seen, AnyLogic only requires me to complete functional code in some locations, so the underlying reading of Excel files is not accessible to me.
This looks like an incompatible commons-io library version issue causing this? How do I update or downgrade the commons-io library used in AnyLogic? Or does this problem require the use of other solutions? I'd appreciate any comments.
Upvotes: -1
Views: 237
Reputation: 49
I just emailed AnyLogic and got their response confirming that this is a bug in AnyLogic version 8.9.1 when we use both the GIS Map and the Excel File modules. We can either use AnyLogic version 8.9.0 to avoid this bug or wait for their upcoming AnyLogic version 8.9.2 to fix this bug.
Upvotes: 2