poi-tl报错 org.apache.logging.log4j.Logger.atDebug()Lorg/apache/logging/log4j/LogBuilder、poi-ooxml-5.2

在使用poi-tl的时候报错

java.lang.NoSuchMethodError: org.apache.logging.log4j.Logger.atDebug()Lorg/apache/logging/log4j/LogBuilder;
	at org.apache.poi.openxml4j.opc.PackageRelationshipCollection.parseRelationshipsPart(PackageRelationshipCollection.java:309) ~[poi-ooxml-5.2.2.jar:5.2.2]

我使用的springboot版本是 2.2.2.RELEASE、poi-tl版本是1.12.1

解决方案:
pom.xml文件里直接引入log4j新版本,poi内排出引用的log4j旧版。
即加入下面两个依赖:

 		<dependency>
            <groupId>org.apache.logging.log4jgroupId>
            <artifactId>log4j-apiartifactId>
            <version>2.17.1version>
        dependency>

        <dependency>
            <groupId>org.apache.poigroupId>
            <artifactId>poiartifactId>
            <version>5.2.2version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.logging.log4jgroupId>
                    <artifactId>log4j-apiartifactId>
                exclusion>
            exclusions>
        dependency>

你可能感兴趣的:(POI,EasyExcel,EasyPOI,apache,log4j)