I just started working with POI. . I am just writing out an Excel document. I 
pulled down the project using Maven for 5.2.3 .

In eclipse everything compiled fine. When I deployed the software to Tomcat I 
got this error message:

Exception in thread "Thread-6" java.lang.NoSuchMethodError: 
org.apache.logging.log4j.util.LoaderUtil.getClassLoaders()[Ljava/lang/ClassLoader;

The line it was failing on is the last line listed below "new XSSFWorkbook()":

XSSFWorkbook workbook = null;
//
ClassLoader classloader = 
org.apache.poi.poifs.filesystem.POIFSFileSystem.class.getClassLoader();
URL res = 
classloader.getResource("org/apache/poi/xssf/usermodel/XSSFWorkbook.class");
String path = res.getPath();
System.out.println("POI Core came from " + path);
                     //
// line with error is below
workbook = new XSSFWorkbook();


After reading some documentation I put in the code directly above the line that 
was failing. The display showed that the code was found.
POI Core came from 
file:/folder1/folder2/folder3/application/webapps/ROOT/WEB-INF/lib/poi-ooxml-5.2.2.jar!/org/apache/poi/xssf/usermodel/XSSFWorkbook.class

I tried rebuilding the project in Eclipse and also updating Maven. After 
redeploying I kept getting the same error message.

I then changed the version to 5.2.2 and everything worked fine. I am wondering 
if there might be an issue with 5.2.3 .

MAVEN that did NOT work:

  <dependencies>
       <dependency>
              <groupId>webserviceslib</groupId>
              <artifactId>webserviceslib</artifactId>
              <version>0.0.1-SNAPSHOT</version>
       </dependency>
       <dependency>
           <groupId>org.apache.poi</groupId>
           <artifactId>poi</artifactId>
           <version>5.2.3</version>
       </dependency>
       <dependency>
       <groupId>org.apache.poi</groupId>
       <artifactId>poi-ooxml</artifactId>
       <version>5.2.3</version>
       </dependency>
  </dependencies>

MAVEN that does work:

  <dependencies>
       <dependency>
              <groupId>webserviceslib</groupId>
              <artifactId>webserviceslib</artifactId>
              <version>0.0.1-SNAPSHOT</version>
       </dependency>
       <dependency>
           <groupId>org.apache.poi</groupId>
           <artifactId>poi</artifactId>
           <version>5.2.2</version>
       </dependency>
       <dependency>
       <groupId>org.apache.poi</groupId>
       <artifactId>poi-ooxml</artifactId>
       <version>5.2.2</version>
       </dependency>
  </dependencies>

Thanks,
Lance Campbell
Web Services @ Public Affairs @ University of Illinois


Reply via email to