Error in execution of monitored action {name:ExcelImporter.IVK_ImportTemplateDocument,type:Microflow} (execution id: c2114db2-2eeb-4bd6-8675-11e248a5bce3, execution type: CLIENT_ASYNC_MONITORED)

0
After having not used the excel importer for some time, it now stops with fatal error… I reinstalled modules,, removed double lib modules but it keeps reporting java.lang.NoSuchMethodError: org.apache.xmlbeans.XmlOptions.setEntityExpansionLimit(I)Lorg/apache/xmlbeans/XmlOptions;     at org.apache.poi.ooxml.POIXMLTypeLoader.<clinit>(POIXMLTypeLoader.java:43)     at org.apache.poi.xssf.model.StylesTable.readFrom(StylesTable.java:189)     at org.apache.poi.xssf.model.StylesTable.<init>(StylesTable.java:138)     at org.apache.poi.xssf.eventusermodel.XSSFReader.getStylesTable(XSSFReader.java:126) How to solve?
asked
1 answers
8

Hello!

I have been facing this problem myself and I hope I can help with the solution.

The problem arises because a library you have on the classpath is old and doesn’t have the method setEntityExpansionLimit.

This took me ages to find the problem as it wasn’t very obvious in my case. If you check the userlib folder of your project, you will find POI/POI-OOXML/POI-SCHEMAS and xbeans.jar files (they likely will have version numbers appended to them).

When you import an app store module, it will add those libraries to userlib. You need to make sure you don’t have any conflicts, that is, multiple versions of those files.

The method in question should be contained as per the error message in a jar file called xmlbeans. This method is only available in a certain versions of xmlbean and up. I don’t remember the cut off. What you can do to check is download Java decompiler. Open the jar file and search for a method with that name. You’ll either find it in the xmlbeans jar file if it is there, or if it is an older version, it won’t exist.

To resolve the issue I did a few things.

Make sure that the POI files are all the same version. For reference I am using POI 4.1.1/Schemas 4.1.1 and OOXML 4.1.1 with version 8 of Excel Importer.
Use a newer version of xbeans if you don’t have the method in question. I am using  version 3.1.0 which is the latest.

You can check maven for the those libraries btw to see which is the newest version of each.

You need to check that your .classpath file only has a single reference to each of those jar files. If you have conflicting versions of POI, you’ll see it appear more than once. Just open the .classpath file in the project directory and search for each of the above jar files to ensure they are there and up to date.
Also check that each of the RequiredLib files in the userlib folder for POI/POI-OOXML/POI-SCHEMAS have the correct version number inside of them.

Once those are up to date, you may still get the message. This tells you/us that something else is pointing to the wrong location and it is trying to execute a method in a class that doesn’t have it. There is a very handy piece of code you can run to identify what class this is.

Export your project to Eclipse, create a new class under javasource (don’t worry about it being in default package you can remove it afterwards). Copy and paste the following code into a class called POI.

 

public class POI {
    public static void main(String[] args) {

        ClassLoader classloader = org.apache.xmlbeans.XmlOptions.class.getClassLoader();
        java.net.URL res = classloader.getResource("org/apache/xmlbeans/XmlOptions.class");
        String path = res.getPath();
        System.out.println("XmlOptions came from " + path);
    }
}

Right click this class and in the project explorer and hit run as java application. In the console window you will see which jar file is being used and what is causing the problem. In my case it was this:

userlib/xbean.jar

Checking Maven, this seems to be an old jar file and has been replaced with xmlbeans. That xbean jar file will not have the method and will cause the exceptions. I deleted this jar file, did a clean and build and wala, xslx now works.

answered