使用jmeter maven-analysis插件时遇到API不兼容和java.lang.ExceptionInInitializerError

时间:2016-02-04 10:55:35

标签: jmeter-plugins jmeter-maven-plugin

我正在用jmeter-maven插件和jmeter-maven-analysis插件运行我的仪表测试。测试成功执行,但使用后一个插件的分析报告给出了以下错误。

[ERROR] Failed to execute goal com.lazerycode.jmeter:jmeter-analysis-maven-plugin:1.0.6:analyze (jmeter) on project Jmeter_Maven: Execution jmeter of goal com.lazerycode.jmeter:jmeter-analysis-maven-plugin:1.0.6:analyze failed: An API incompatibility was encountered while executing com.lazerycode.jmeter:jmeter-analysis-maven-plugin:1.0.6:analyze: java.lang.ExceptionInInitializerError: null
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>com.lazerycode.jmeter:jmeter-analysis-maven-plugin:1.0.6
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/home/bhanu_prakash/.m2/repository/com/lazerycode/jmeter/jmeter-analysis-maven-plugin/1.0.6/jmeter-analysis-maven-plugin-1.0.6.jar
[ERROR] urls[1] = file:/home/bhanu_prakash/.m2/repository/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar
[ERROR] urls[2] = file:/home/bhanu_prakash/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar
[ERROR] urls[3] = file:/home/bhanu_prakash/.m2/repository/log4j/log4j/1.2.17/log4j-1.2.17.jar
[ERROR] urls[4] = file:/home/bhanu_prakash/.m2/repository/org/springframework/spring-core/3.2.3.RELEASE/spring-core-3.2.3.RELEASE.jar
[ERROR] urls[5] = file:/home/bhanu_prakash/.m2/repository/org/jfree/jfreechart/1.0.15/jfreechart-1.0.15.jar
[ERROR] urls[6] = file:/home/bhanu_prakash/.m2/repository/org/jfree/jcommon/1.0.17/jcommon-1.0.17.jar
[ERROR] urls[7] = file:/home/bhanu_prakash/.m2/repository/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.jar
[ERROR] urls[8] = file:/home/bhanu_prakash/.m2/repository/com/lowagie/itext/2.1.5/itext-2.1.5.jar
[ERROR] urls[9] = file:/home/bhanu_prakash/.m2/repository/bouncycastle/bcmail-jdk14/138/bcmail-jdk14-138.jar
[ERROR] urls[10] = file:/home/bhanu_prakash/.m2/repository/bouncycastle/bcprov-jdk14/138/bcprov-jdk14-138.jar
[ERROR] urls[11] = file:/home/bhanu_prakash/.m2/repository/com/googlecode/charts4j/charts4j/1.3/charts4j-1.3.jar
[ERROR] urls[12] = file:/home/bhanu_prakash/.m2/repository/org/freemarker/freemarker/2.3.20/freemarker-2.3.20.jar
[ERROR] urls[13] = file:/home/bhanu_prakash/.m2/repository/com/google/guava/guava/14.0.1/guava-14.0.1.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR] 
[ERROR] -----------------------------------------------------: User-specified log class 'org.apache.commons.logging.impl.LogKitLogger' cannot be found or is not useable.'

这是我的pom.xml文件:

 <?xml version="1.0" encoding="UTF-8"?>
  <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.prakash.jmeter</groupId>
    <artifactId>Jmeter_Maven</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>




<build>
        <plugins>
            <plugin>
                <groupId>com.lazerycode.jmeter</groupId>
                <artifactId>jmeter-maven-plugin</artifactId>
                <version>1.4.1</version>
                <executions>
                    <execution>
                        <id>jmeter-tests</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>jmeter</goal>

                        </goals>
                        <configuration>
                            <testFilesDirectories>
                                <testFilesDirectory>Assignment_flows</testFilesDirectory>
                                <testFilesDirectory>try</testFilesDirectory>
                            </testFilesDirectories>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                   <dependency>
                     <groupId>org.apache.jmeter</groupId>
                      <artifactId>ApacheJMeter_report</artifactId>
                      <version>2.7</version>
                   </dependency>

                  <dependency>
                    <groupId>kg.apc</groupId>
                    <artifactId>jmeter-plugins-extras-libs</artifactId>
                    <version>1.1.3</version>
                  </dependency>

                  <dependency>
                    <groupId>kg.apc</groupId>
                    <artifactId>jmeter-plugins-standard</artifactId>
                    <version>1.1.3</version>
                  </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>com.lazerycode.jmeter</groupId>
                <artifactId>jmeter-analysis-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>jmeter</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>analyze</goal>

                        </goals>
                        <configuration>
                             <source>${project.build.directory}/target/jmeter/report/*.jtl</source>
                             <targetDirectory>${project.build.directory}/target/jmeter/report</targetDirectory>
                             <processAllFilesFound>true</processAllFilesFound>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>commons-logging</groupId>
                        <artifactId>commons-logging</artifactId>
                        <version>1.1.3</version>
                    </dependency>
                    <dependency>
                        <groupId>org.codehaus.plexus</groupId>
                        <artifactId>plexus-utils</artifactId>
                        <version>3.0.22</version>
                    </dependency>

                    <dependency>
                        <groupId>log4j</groupId>
                        <artifactId>log4j</artifactId>
                        <version>1.2.17</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>
  </project>'

1 个答案:

答案 0 :(得分:0)

1.4.1版本已经过时,最新版本为2.8.3,这可以通过 jmeterExtensions 标签简化使用第三方插件的过程:

    <jmeterExtensions>
         <artifact>kg.apc:jmeter-plugins-casutg:2.6</artifact>
     </jmeterExtensions>

此博客使用jmeter-maven-plugin的最新版本2.8.3详细介绍了整个过程:

由于该插件现在生成了Apache JMeter HTML report,因此您不再需要分析插件。