Java -jar main-jar.jar thr"线程中的异常" main" java.lang.NoClassDefFoundError:org / apache / log4j / Logger"

时间:2017-09-20 14:29:06

标签: maven logging pom.xml

当我尝试执行时,它会抛出不同的错误,例如" java -jar main-jar.jar UAT"它会抛出错误记录器错误(线程中的异常" main" java。 lang.NoClassDefFoundError:org / apache / log4j / Logger)。 并且还可以找到记录器java文件的行号。

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logg
er
        at com.middleoffice.webservices.DriverScript.<clinit>(DriverScript.java:
47)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 1 more

<project xmlns="http://maven.apache.org/POM/4.0.0"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
   http://maven.apache.org/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <groupId>com.MOAPITestAutomation1.com</groupId>
  <artifactId>ODHESTestAutomation</artifactId>
  <version>0.0.1-SNAPSHOT</version>

  <properties>
    <jar_path>${basedir}\lib\</jar_path>    
     <exec_dir>C:\Users\XBBNK9F\MO-Automation-APITest-V1-Execution\</exec_dir>
    <output_dir>${basedir}\BUILD\</output_dir>
    </properties>

  <build>       
    <sourceDirectory>src</sourceDirectory>  
    <plugins>

    <plugin>     
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-jar-plugin</artifactId>
      <version>3.0.2</version>
      <configuration>
        <archive>
          <manifest>  
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>          
         <addClasspath>true</addClasspath>
      <classpathPrefix>ODHESTestAutomation_lib/</classpathPrefix>
           <mainClass>com.middleoffice.webservices.DriverScript</mainClass>
         </manifest>
        </archive>
      </configuration>
    </plugin>
    <plugin>
      <artifactId>maven-clean-plugin</artifactId>
           <version>3.0.0</version>
           <executions>
                <execution>
                    <id>auto-clean</id>
                    <phase>clean</phase>
                    <goals>
                        <goal>clean</goal>
                    </goals>
                   <configuration>
                   <filesets>
                        <fileset>
                            <directory>BUILD</directory>
                                <includes>
                                <include>**/*</include>
                            </includes>
                            <followSymlinks>false</followSymlinks>
                        </fileset>
                    </filesets>
                    </configuration>
                </execution>
            </executions>
        </plugin>       
        <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <version>3.0.2</version>
            <executions>
            <execution>
                <id>copy-resources</id>
                <!--here the phase you need-->
            <phase>initialize</phase>
                <goals>
                <goal>copy-resources</goal>
                </goals>
                <configuration>
                <outputDirectory>${output_dir}</outputDirectory>
                <resources>                 
                    <resource>
                        <directory>${exec_dir}ext</directory>
                        <targetPath>${output_dir}ext</targetPath>
                        <filtering>true</filtering>    
                        </resource>
                        <resource>
                        <directory>${exec_dir}InputData</directory>
                        <targetPath>${output_dir}InputData</targetPath>
                        <filtering>true</filtering>    
                        </resource> 

                        <resource>                                              
                        <directory>${basedir}\target</directory>                        
                        <targetPath>${output_dir}TestOutputFiles</targetPath>                       
                        <includes>
                        <include>*.jar</include>
                        <filtering>true</filtering>    
                        </includes>                     
                        </resource> 


                    <resource>
                        <directory>${basedir}</directory>
                        <targetPath>${output_dir}</targetPath>
                        <includes>
                        <include>log4j.properties</include>
                        <filtering>true</filtering>    
                        </includes>
                    </resource>

                    <resource>
                        <directory>${exec_dir}</directory>
                        <targetPath>${output_dir}</targetPath>
                        <includes>
                        <include>Execute.Bat</include>
                        <filtering>true</filtering>    
                        </includes>
                    </resource>
                </resources>              
                </configuration>            
          </execution>
          <execution>
            <phase>generate-sources</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
                <outputDirectory>${output_dir}\ODHESTestAutomation_lib</outputDirectory>
            <resources>          
                <resource>
                  <directory>lib</directory>
                  <filtering>true</filtering>
                </resource>
              </resources>              
            </configuration>            
          </execution>
          </executions>
        </plugin>     
        <plugin>        
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>2.5.2</version>
          <executions>
               <execution>
                  <id>install:com.oracle:ojdbc6:11g</id>
                  <phase>test</phase>
                  <goals>
                     <goal>install-file</goal>
                  </goals>
                  <configuration>
                     <file>${jar_path}ojdbc14.jar</file>
                     <groupId>com.oracle</groupId>
                     <artifactId>ojdbc14</artifactId>
                     <version>14</version>
                     <packaging>jar</packaging>                                        
                  </configuration>
               </execution>
            </executions>         
        </plugin>                   
        <plugin>        
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
            <source>1.8</source>
            <target>1.8</target>            
            </configuration>
        </plugin>           
       </plugins>
       </build>
        <dependencies>

         <dependency>
         <groupId>aopalliance</groupId>
         <artifactId>aopalliance</artifactId>
         <version>1.0</version>      
         </dependency> 

         <dependency>
         <groupId>commons-net</groupId>
         <artifactId>commons-net</artifactId>
         <version>3.4</version>
         </dependency>

         <dependency>
         <groupId>org.apache.axis</groupId>
         <artifactId>axis</artifactId>
         <version>1.4</version>
         </dependency>

         <dependency>
         <groupId>cglib</groupId>
         <artifactId>cglib-nodep</artifactId>
         <version>3.2.4</version>
         </dependency>

         <dependency>
         <groupId>com.ibm</groupId>
         <artifactId>com.ibm.mq</artifactId>
         <version>5.3.07</version>
         </dependency>

         <dependency>
         <groupId>net.sourceforge.cssparser</groupId>
         <artifactId>cssparser</artifactId>
         <version>0.9.22</version>
         </dependency>

         <dependency>
         <groupId>dom4j</groupId>
         <artifactId>dom4j</artifactId>
         <version>1.6</version>
         </dependency>

         <dependency>
         <groupId>org.apache.httpcomponents</groupId>
         <artifactId>httpmime</artifactId>
         <version>4.5.3</version>
         </dependency>

         <dependency>
         <groupId>commons-lang</groupId>
         <artifactId>commons-lang</artifactId>
         <version>2.1</version>
         </dependency>

         <dependency>
         <groupId>org.apache.httpcomponents</groupId>
         <artifactId>httpclient</artifactId>
         <version>4.5.3</version>
         </dependency>

         <dependency>
         <groupId>com.jcraft</groupId>
         <artifactId>jsch</artifactId>
         <version>0.1.54</version>
         </dependency>  

         <dependency>
         <groupId>junit</groupId>
         <artifactId>junit</artifactId>
         <version>4.12</version>
         </dependency>

         <dependency>
         <groupId>org.python</groupId>
         <artifactId>jython</artifactId>
         <version>2.5.0</version>
         </dependency>

         <dependency>
         <groupId>org.apache.poi</groupId>
         <artifactId>ooxml-schemas</artifactId>
         <version>1.0</version>
         </dependency>

         <dependency>
         <groupId>com.opencsv</groupId>
         <artifactId>opencsv</artifactId>
         <version>3.9</version>
         </dependency>

         <dependency>
         <groupId>poi</groupId>
         <artifactId>poi</artifactId>
         <version>3.14</version>
         <scope>system</scope>
         <systemPath>${jar_path}poi-3.14.jar</systemPath>  
         </dependency>

         <dependency>
         <groupId>poi-3.8-sources</groupId>
         <artifactId>poi-3.8-sources</artifactId>
         <version>3.8</version>
         <scope>system</scope>
         <systemPath>${jar_path}poi-3.8-sources.jar</systemPath>
         </dependency>      

         <dependency>
         <groupId>poi-ooxml3.14</groupId>
         <artifactId>poi-ooxml3.14</artifactId>
         <version>3.14</version>
         <scope>system</scope>
         <systemPath>${jar_path}poi-ooxml-3.14.jar</systemPath>
         </dependency>           

         <dependency>
         <groupId>org.apache.poi</groupId>
         <artifactId>poi-ooxml</artifactId>
         <version>3.5-beta5</version>
         </dependency>

         <dependency>
         <groupId>org.apache.poi</groupId>
         <artifactId>poi-ooxml-schemas</artifactId>
         <version>3.14</version>
         </dependency>

         <dependency>
         <groupId>com.jayway.restassured</groupId>
         <artifactId>rest-assured</artifactId>
         <version>2.3.2</version>
         </dependency>

         <dependency>
         <groupId>org.seleniumhq.selenium</groupId>
         <artifactId>selenium-api</artifactId>
         <version>3.4.0</version>
         </dependency>

            <dependency>
            <groupId>selenium-java</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.4.0</version>
            <scope>system</scope>
            <systemPath>${jar_path}selenium-java-3.4.0.jar</systemPath>
            </dependency>

            <dependency>
            <groupId>selenium-ie-driver</groupId>
            <artifactId>selenium-ie-driver</artifactId>
            <version>3.4.0</version>
            <scope>system</scope>
            <systemPath>${jar_path}selenium-ie-driver-3.4.0.jar</systemPath>
            </dependency>

            <dependency>
            <groupId>selenium-support</groupId>
            <artifactId>selenium-support</artifactId>
            <version>3.4.0</version>
            <scope>system</scope>
            <systemPath>${jar_path}selenium-support-3.4.0.jar</systemPath>
            </dependency>

            <dependency>
            <groupId>selenium-chrome-driver</groupId>
            <artifactId>selenium-chrome-driver</artifactId>
            <version>3.4.0</version>
            <scope>system</scope>
            <systemPath>${jar_path}selenium-chrome-driver-3.4.0.jar</systemPath>
            </dependency>

            <dependency>
            <groupId>selenium-server-standalone</groupId>
            <artifactId>selenium-server-standalone</artifactId>
            <version>3.4.0</version>
            <scope>system</scope>
            <systemPath>${jar_path}selenium-server-standalone-3.4.0.jar</systemPath>
            </dependency>      

            <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc14</artifactId>
            <version>14</version>           
            </dependency>     

            <dependency>
            <groupId>commons-discovery</groupId>
            <artifactId>commons-discovery</artifactId>
            <version>0.4</version>
            <scope>system</scope>
            <systemPath>${jar_path}commons-discovery-0.4.jar</systemPath>
            </dependency> 

            <dependency>
            <groupId>rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <version>2.3.2</version>
            <scope>system</scope>
            <systemPath>${jar_path}rest-assured-2.3.2.jar</systemPath>
            </dependency> 
            <dependency>
            <groupId>jackson-databind</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.8.3</version>
            <scope>system</scope>
            <systemPath>${jar_path}jackson-databind-2.8.3.jar</systemPath>
            </dependency>

            <dependency>
            <groupId>javax.jms</groupId>
            <artifactId>javax.jms</artifactId>
            <version>1</version>
            <scope>system</scope>
            <systemPath>${jar_path}javax.jms.jar</systemPath>
            </dependency>                      

            <dependency>
            <groupId>opencsv</groupId>
            <artifactId>opencsv</artifactId>
            <version>3.9</version>
            <scope>system</scope>
            <systemPath>${jar_path}opencsv-3.9.jar</systemPath>
            </dependency>          

            <dependency>
            <groupId>jira-rest-java-client-core</groupId>
            <artifactId>jira-rest-java-client-core</artifactId>
            <version>4.0.0</version>
            <scope>system</scope>
            <systemPath>${jar_path}jira-rest-java-client-core-4.0.0.jar</systemPath>
            </dependency>  

            <dependency>
            <groupId>jython</groupId>
            <artifactId>jython</artifactId>
            <version>2.5.0</version>
            <scope>system</scope>
            <systemPath>${jar_path}jython-2.5.0.jar</systemPath>
            </dependency>  

            <dependency>
            <groupId>confluence</groupId>
            <artifactId>confluence</artifactId>
            <version>1.0.0</version>
            <scope>system</scope>
            <systemPath>${jar_path}confluence-1.0.0.jar</systemPath>
            </dependency>      

            <dependency>
            <groupId>confluence-api</groupId>
            <artifactId>confluence-api</artifactId>
            <version>1.0</version>
            <scope>system</scope>
            <systemPath>${jar_path}confluence-api-1.0.jar</systemPath>
            </dependency>           

            <dependency>
            <groupId>com.ibm</groupId>
            <artifactId>com.ibm.mqjms</artifactId>
            <version>1</version>
            <scope>system</scope>
            <systemPath>${jar_path}com.ibm.mqjms.jar</systemPath>
            </dependency> 

            <dependency>
            <groupId>xmlbeans-2.3.0</groupId>
            <artifactId>xmlbeans</artifactId>
            <version>2.3.0</version>
            <scope>system</scope>
            <systemPath>${jar_path}xmlbeans-2.3.0.jar</systemPath>
            </dependency>

            <dependency>
            <groupId>javax</groupId>
            <artifactId>javax</artifactId>
            <version>1</version>
            <scope>system</scope>
            <systemPath>${jar_path}javax.jar</systemPath>
            </dependency>  

            <dependency>
            <groupId>jaxrpc-api</groupId>
            <artifactId>jaxrpc-api</artifactId>
            <version>1</version>
            <scope>system</scope>
            <systemPath>${jar_path}jaxrpc-api.jar</systemPath>
            </dependency>  

            <dependency>
            <groupId>javax.resource</groupId>
            <artifactId>javax.resource</artifactId>
            <version>1</version>
            <scope>system</scope>
            <systemPath>${jar_path}javax.resource.jar</systemPath>
            </dependency>  

            <dependency>
            <groupId>javax.servlet-api</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>system</scope>
            <systemPath>${jar_path}javax.servlet-api-3.1.0.jar</systemPath>
            </dependency> 

            <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.5</version>
            <scope>system</scope>
            <systemPath>${jar_path}commons-io-2.5.jar</systemPath>  
            </dependency>

            <dependency>
            <groupId>websocket-common</groupId>
            <artifactId>websocket-common</artifactId>
            <version>9.4.3.v20170317</version>
            <scope>system</scope>
            <systemPath>${jar_path}websocket-common-9.4.3.v20170317.jar</systemPath>
            </dependency>

            <dependency>
            <groupId>jetty-http</groupId>
            <artifactId>jetty-http</artifactId>
            <version>9.4.3.v20170317</version>
            <scope>system</scope>
            <systemPath>${jar_path}jetty-http-9.4.3.v20170317.jar</systemPath>
            </dependency>

            <dependency>
            <groupId>wsdl4j</groupId>
            <artifactId>wsdl4j</artifactId>
            <version>1.5.1</version>
            <scope>system</scope>
            <systemPath>${jar_path}wsdl4j-1.5.1.jar</systemPath>
            </dependency>

<dependency>
    <groupId>jetty-io</groupId>
    <artifactId>jetty-io</artifactId>
    <version>9.4.1.v20170120</version>
    <scope>system</scope>
    <systemPath>${jar_path}jetty-io-9.4.1.v20170120.jar</systemPath>
</dependency>

<dependency>
    <groupId>neko-htmlunit</groupId>
    <artifactId>neko-htmlunit</artifactId>
    <version>2.25</version>
    <scope>system</scope>
    <systemPath>${jar_path}neko-htmlunit-2.25.jar</systemPath>
</dependency>

<dependency>
    <groupId>tagsoup</groupId>
    <artifactId>tagsoup</artifactId>
    <version>1.2.1</version>
    <scope>system</scope>
    <systemPath>${jar_path}tagsoup-1.2.1.jar</systemPath>
</dependency>

<dependency>
    <groupId>slf4j-api</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.7.6</version>
    <scope>system</scope>
    <systemPath>${jar_path}slf4j-api-1.7.6.jar</systemPath>
</dependency>

<dependency>
    <groupId>websocket-api</groupId>
    <artifactId>websocket-api</artifactId>
    <version>9.4.3.v20170317</version>
    <scope>system</scope>
    <systemPath>${jar_path}websocket-api-9.4.3.v20170317.jar</systemPath>
</dependency>

<dependency>
    <groupId>websocket-client</groupId>
    <artifactId>websocket-client</artifactId>
    <version>9.4.3.v20170317</version>
    <scope>system</scope>
    <systemPath>${jar_path}websocket-client-9.4.3.v20170317.jar</systemPath>
</dependency>

<dependency>
    <groupId>stax-api</groupId>
    <artifactId>stax-api</artifactId>
    <version>1.0.1</version>
    <scope>system</scope>
    <systemPath>${jar_path}stax-api-1.0.1.jar</systemPath>
</dependency>

<dependency>
    <groupId>sac</groupId>
    <artifactId>sac</artifactId>
    <version>1.3</version>
    <scope>system</scope>
    <systemPath>${jar_path}sac-1.3.jar</systemPath>
</dependency>

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-chrome-driver</artifactId>
    <version>3.4.0</version>
</dependency>

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-edge-driver</artifactId>
    <version>3.4.0</version>
</dependency>

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-firefox-driver</artifactId>
    <version>3.4.0</version>
</dependency>

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-ie-driver</artifactId>
    <version>3.4.0</version>
</dependency>

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>3.4.0</version>
</dependency>

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-opera-driver</artifactId>
    <version>3.4.0</version>
</dependency>

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-remote-driver</artifactId>
    <version>3.4.0</version>
</dependency>

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-safari-driver</artifactId>
    <version>3.4.0</version>
</dependency>

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-support</artifactId>
    <version>3.4.0</version>
</dependency>

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>1.6.4</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>xalan</groupId>
    <artifactId>xalan</artifactId>
    <version>2.7.2</version>
</dependency>

<dependency>
    <groupId>xerces</groupId>
    <artifactId>xercesImpl</artifactId>
    <version>2.11.0</version>
</dependency>

<dependency>
    <groupId>xml-apis</groupId>
    <artifactId>xml-apis</artifactId>
    <version>1.4.01</version>
</dependency>

<dependency>
    <groupId>com.atlassian.confluence.plugins</groupId>
    <artifactId>confluence-api</artifactId>
    <version>5.9.1-issue-CONF-38693-m2</version>
    <scope>provided</scope>
</dependency>

<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.14</version>
</dependency>

<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-api</artifactId>
    <version>2.3</version>
</dependency>

<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-core</artifactId>
    <version>2.9.0</version>
</dependency>           

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.8.3</version>
</dependency>                  

<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-core</artifactId>
    <version>0.9.29</version>
</dependency>

<dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>21.0</version>
</dependency>           

<dependency>
    <groupId>javax.inject</groupId>
    <artifactId>javax.inject</artifactId>
    <version>1</version>
</dependency>

<dependency>
    <groupId>javax.jms</groupId>
    <artifactId>jms</artifactId>
    <version>1.1</version>
</dependency>

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.1.0</version>
</dependency>

<dependency>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-http</artifactId>
    <version>9.4.3.v20170317</version>
</dependency>

<dependency>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-io</artifactId>
    <version>9.4.1.v20170120</version>
</dependency>

<dependency>
    <groupId>com.atlassian.jira</groupId>
    <artifactId>jira-rest-java-client-core</artifactId>
    <version>4.0.0</version>
</dependency>      

<dependency>
    <groupId>com.google.inject</groupId>
    <artifactId>guice</artifactId>
    <version>3.0</version>
</dependency>  

<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-lang3</artifactId>
    <version>3.5</version>
</dependency>

<dependency>
    <groupId>net.sourceforge.htmlunit</groupId>
    <artifactId>htmlunit-core-js</artifactId>
    <version>2.26</version>
</dependency>

<dependency>
    <groupId>org.codehaus.groovy</groupId>
    <artifactId>groovy-json</artifactId>
    <version>2.3.2</version>
</dependency>

<dependency>
    <groupId>org.codehaus.groovy</groupId>
    <artifactId>groovy-xml</artifactId>
    <version>2.4.4</version>
</dependency>

<dependency>
    <groupId>com.google.code.gson</groupId>
    <artifactId>gson</artifactId>
    <version>2.8.0</version>
</dependency>

<dependency>
    <groupId>net.sourceforge.htmlunit</groupId>
    <artifactId>htmlunit</artifactId>
    <version>2.26</version>
</dependency>

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>htmlunit-driver</artifactId>
    <version>2.26</version>
</dependency>

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-annotations</artifactId>
    <version>2.8.3</version>
</dependency>

<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-exec</artifactId>
    <version>1.3</version>
</dependency>

<dependency>
    <groupId>org.hamcrest</groupId>
    <artifactId>hamcrest-library</artifactId>
    <version>1.3</version>
   <!--  <scope>test</scope> -->
</dependency>

<dependency>
    <groupId>com.codeborne</groupId>
    <artifactId>phantomjsdriver</artifactId>
    <version>1.4.0</version>
</dependency>

<dependency>
    <groupId>javax.transaction</groupId>
    <artifactId>javax.transaction-api</artifactId>
    <version>1.2</version>
</dependency>
   </dependencies>
</project>

1 个答案:

答案 0 :(得分:0)

您有许多不同版本的log4j依赖项:

<dependency>
     <groupId>log4j</groupId>
     <artifactId>log4j</artifactId>
     <version>1.2.14</version>
</dependency>

<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-api</artifactId>
    <version>2.3</version>
</dependency>

<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-core</artifactId>
    <version>2.9.0</version>
</dependency> 

您只需要一个log4j。你只能留下apache log4j-api和log4j-core。

试试这个:

    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>${log4j2.version}</version>
    </dependency>

    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-1.2-api</artifactId>
        <version>${log4j2.version}</version>
    </dependency>

希望这有帮助!