javaspringspring-bootxlsxxmlbeans

XML-BEANS compiled schema: Could not locate compiled schema resource org/apache/poi/schemas/ooxml/system/ooxml/ctstring4cdatype.xsb


SpringBoot, trying to generate a xlsx file containing pivots, but every time it crash with this stacktrace.

Using xmlbeans 5.0.3

XML-BEANS compiled schema: Could not locate compiled schema resource org/apache/poi/schemas/ooxml/system/ooxml/ctstring4cdatype.xsb (org.apache.poi.schemas.ooxml.system.ooxml.ctstring4cdatype)

The line of code is e.addNewS();

XSSFPivotCacheDefinition a = pivotTable.getPivotCacheDefinition();
   CTPivotCacheDefinition b = a.getCTPivotCacheDefinition();
   CTCacheFields c = b.getCacheFields();
   CTCacheField d = c.getCacheFieldArray(index);
   CTSharedItems e = d.getSharedItems();
   CTString f = e.addNewS();
   f.setV(value);

I divided using chars from a to f because i didn't know which line was.

I noticed that it's trying to connect to this url http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument

I do not know what to do, Im going crazy...


Solution

  • With the @kiwiwings's hint, I managed to get this working by checking all dependencies. Solved this by using: (at 28/01/2022)

    <dependencies>
       <dependency>
          <groupId>org.apache.xmlbeans</groupId>
          <artifactId>xmlbeans</artifactId>
          <version>5.0.3</version>
       </dependency>
       <dependency>
          <groupId>org.apache.poi</groupId>
          <artifactId>poi</artifactId>
          <version>5.2.0</version>
       </dependency>
       <dependency>
          <groupId>org.apache.poi</groupId>
          <artifactId>poi-ooxml-full</artifactId>
          <version>5.2.0</version>
       </dependency>
       <dependency>
          <groupId>org.apache.poi</groupId>
          <artifactId>poi-ooxml</artifactId>
          <version>5.2.0</version>
       </dependency>
       <dependency>
          <groupId>org.apache.poi</groupId>
          <artifactId>ooxml-schemas</artifactId>
          <version>1.4</version>
       </dependency>
       <dependency>
          <groupId>org.apache.poi</groupId>
          <artifactId>poi-ooxml-schemas</artifactId>
          <version>4.1.2</version>
       </dependency>
    </dependencies>