关于#eclipse#的问题,如何解决?

eclipse已在构建路径导入poi包:方法是在项目下建立一个"lib"目录,将下载的jar复制进去,然后“构建路径”。
然后尝试打开一个excel07版的文件,读入内容打印到屏幕上。运行时却出现问题。

代码如下:

package excelFile;
import java.io.IOException;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

public class MyExcelTest
{
    public static void main(String[] args) throws IOException
    {
        // TODO 自动生成的方法存根
        XSSFWorkbook workbook = new XSSFWorkbook("C:\\temp\\POIDemo.xlsx");
        XSSFSheet sheet = workbook.getSheetAt(0);
        //读取excel文件,打印屏幕。
        int lastRowNum= sheet.getLastRowNum();
        for (int i = 0; i < lastRowNum; i++)
        {
            XSSFRow row=sheet.getRow(i);
            if(row != null)
            {
                short cellNum=row.getLastCellNum();
                for (int j = 0; j < cellNum; j++)
                {
                    XSSFCell cell=row.getCell(j);
                    if(cell != null)
                    {
                        String  stringCellValue= cell.getStringCellValue();
                        System.out.println(stringCellValue);
                    }
                }
            }
        }
        workbook.close();
    }
}


错误如下;

Exception in thread "main" java.lang.NoSuchMethodError: 'java.lang.ClassLoader[] org.apache.logging.log4j.util.LoaderUtil.getClassLoaders()'
    at org.apache.logging.log4j.core.impl.ThreadContextDataInjector.getServiceProviders(ThreadContextDataInjector.java:83)
    at org.apache.logging.log4j.core.impl.ThreadContextDataInjector.initServiceProviders(ThreadContextDataInjector.java:73)
    at org.apache.logging.log4j.core.impl.ThreadContextDataInjector.getProviders(ThreadContextDataInjector.java:285)
    at org.apache.logging.log4j.core.impl.ThreadContextDataInjector.access$000(ThreadContextDataInjector.java:55)
    at org.apache.logging.log4j.core.impl.ThreadContextDataInjector$ForCopyOnWriteThreadContextMap.(ThreadContextDataInjector.java:226)
    at org.apache.logging.log4j.core.impl.ContextDataInjectorFactory.createDefaultInjector(ContextDataInjectorFactory.java:94)
    at org.apache.logging.log4j.core.impl.ContextDataInjectorFactory.createInjector(ContextDataInjectorFactory.java:71)
    at org.apache.logging.log4j.core.impl.ReusableLogEventFactory.(ReusableLogEventFactory.java:42)
    at org.apache.logging.log4j.core.config.LoggerConfig.(LoggerConfig.java:96)
    at org.apache.logging.log4j.core.config.AbstractConfiguration.(AbstractConfiguration.java:136)
    at org.apache.logging.log4j.core.config.NullConfiguration.(NullConfiguration.java:32)
    at org.apache.logging.log4j.core.LoggerContext.(LoggerContext.java:85)
    at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.createContext(ClassLoaderContextSelector.java:254)
    at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.locateContext(ClassLoaderContextSelector.java:218)
    at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:136)
    at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:123)
    at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:117)
    at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:150)
    at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47)
    at org.apache.logging.log4j.LogManager.getContext(LogManager.java:196)
    at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:599)
    at org.apache.poi.POIDocument.(POIDocument.java:65)
    at excelFile.ExcelTest.main(ExcelTest.java:17)

截图如下:
(鼠标放在"XSSFWorkbook"上面,出现“此元素既未附加源代码也未附加 Javadoc,因此无法找到 Javadoc。”)

img

你的log4j api和core怎么不是同一个版本?