簡體   English   中英

java.lang.NoSuchMethodError用於在jmeter-maven-pugin中創建儀表板

[英]java.lang.NoSuchMethodError for dashboard creation in jmeter-maven-pugin

我正在為Jmeter運行生成儀表板。 通過jmeter-maven-plugin執行。

我的POM中的關鍵插件如下。

<plugin>
    <groupId>com.lazerycode.jmeter</groupId>
    <artifactId>jmeter-maven-plugin</artifactId>
    <version>2.0.3</version>
    <configuration>
        <testFilesDirectory>src/test/jmeter/TestPlans</testFilesDirectory>
        <!-- <postTestPauseInSeconds>10</postTestPauseInSeconds> -->
        <testResultsTimestamp>false</testResultsTimestamp>
        <overrideRootLogLevel>DEBUG</overrideRootLogLevel>
        <suppressJMeterOutput>false</suppressJMeterOutput>
        <ignoreResultFailures>true</ignoreResultFailures>
        <resultsFileFormat>xml</resultsFileFormat>
        <propertiesJMeter>
            <jmeter.save.saveservice.thread_counts>true</jmeter.save.saveservice.thread_counts>
        </propertiesJMeter>
        <jmeterPlugins>
            <plugin>
                <groupId>kg.apc</groupId>
                <artifactId>jmeter-plugins</artifactId>
            </plugin>
        </jmeterPlugins>
        <jmeterExtensions>

            <artifact>kg.apc:jmeter-plugins-standard:jar:1.4.0</artifact>
            <artifact>kg.apc:jmeter-plugins-extras:jar:1.3.0</artifact>
            <artifact>kg.apc:jmeter-plugins-redis:jar:0.1</artifact>
        </jmeterExtensions>
    </configuration>
    <executions>
        <execution>
            <id>execute-jmeter-tests</id>
            <goals>
                <goal>jmeter</goal>
            </goals>
            <phase>integration-test</phase>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>kg.apc</groupId>
            <artifactId>jmeter-plugins</artifactId>
            <version>1.0.0</version>
            <exclusions>
                <exclusion>
                    <groupId>kg.apc</groupId>
                    <artifactId>perfmon</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.hadoop</groupId>
                    <artifactId>hadoop-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.hbase</groupId>
                    <artifactId>hbase</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.jmeter</groupId>
                    <artifactId>jorphan</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.bsf</groupId>
                    <artifactId>bsf-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.bouncycastle</groupId>
                    <artifactId>bcmail-jdk15</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.bouncycastle</groupId>
                    <artifactId>bcprov-jdk15</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.activation</groupId>
                    <artifactId>activation</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>
</plugin>


<plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
        <execution>
            <phase>verify</phase>
            <configuration>
                <tasks>
                    <mkdir dir="${basedir}/target/jmeter/results/dashboard" />
                    <copy file="${basedir}/src/test/resources/reportgenerator.properties"    tofile="${basedir}/target/jmeter/bin/reportgenerator.properties" />
                    <copy todir="${basedir}/target/jmeter/bin/report-template">
                         <fileset dir="${basedir}/src/test/resources/report-template" />
                    </copy>
                    <java jar="${basedir}/target/jmeter/bin/ApacheJMeter-3.0.jar" fork="true">
                        <arg value="-g" />
                        <arg value="${basedir}/target/jmeter/results/*.jtl" />
                        <arg value="-o" />
                        <arg value="${basedir}/target/jmeter/results/dashboard/" />
                    </java>
                        </tasks>
            </configuration>
            <goals>
                        <goal>run</goal>
            </goals>
        </execution>
    </executions>
</plugin>

執行失敗,出現以下錯誤。

嘗試手動執行命令時,看到以下日志。

C:\Program Files\Java>  jdk1.8.0_112\bin\java -jar C:\Users\testing\automation\jmeter_regression\target\jmeter\bin\ApacheJMeter-3.0.jar -g C:\Users\testing\automation\jmeter_regression/target/jmeter/results/CSS_Regression.jtl -o C:\Users\testing\automation\jmeter_regression/target/jmeter/results/dashboard/
log_file=jmeter.log java.io.FileNotFoundException: jmeter.log (Access is denied)
[log_file-> System.out]
2017/02/28 16:49:51 INFO  - jmeter.util.JMeterUtils: Setting Locale to en_AU
2017/02/28 16:49:51 INFO  - jmeter.JMeter: Loading system properties from: C:\Users\testing\automation\jmeter_regression\target\jmeter\bin\system.properties
2017/02/28 16:49:51 INFO  - jmeter.JMeter: Copyright (c) 1998-2016 The Apache Software Foundation
2017/02/28 16:49:51 INFO  - jmeter.JMeter: Version 3.0 r1743807
2017/02/28 16:49:51 INFO  - jmeter.JMeter: java.version=1.8.0_112
2017/02/28 16:49:51 INFO  - jmeter.JMeter: java.vm.name=Java HotSpot(TM) 64-Bit Server VM
2017/02/28 16:49:51 INFO  - jmeter.JMeter: os.name=Windows 7
2017/02/28 16:49:51 INFO  - jmeter.JMeter: os.arch=amd64
2017/02/28 16:49:51 INFO  - jmeter.JMeter: os.version=6.1
2017/02/28 16:49:51 INFO  - jmeter.JMeter: file.encoding=Cp1252
2017/02/28 16:49:51 INFO  - jmeter.JMeter: Max memory     =2835349504
2017/02/28 16:49:51 INFO  - jmeter.JMeter: Available Processors =4
2017/02/28 16:49:51 INFO  - jmeter.JMeter: Default Locale=English (Australia)
2017/02/28 16:49:51 INFO  - jmeter.JMeter: JMeter  Locale=English (Australia)
2017/02/28 16:49:51 INFO  - jmeter.JMeter: JMeterHome=C:\Users\testing\automation\jmeter_regression\target\jmeter
2017/02/28 16:49:51 INFO  - jmeter.JMeter: user.dir  =C:\Program Files\Java
2017/02/28 16:49:51 INFO  - jmeter.JMeter: PWD       =C:\Program Files\Java
2017/02/28 16:49:51 FATAL - jmeter.JMeter: An error occurred:  java.lang.NoSuchMethodError: org.apache.jorphan.util.JOrphanUtils.canSafelyWriteToFolder(Ljava/io/File;)V
        at org.apache.jmeter.JMeter.extractAndSetReportOutputFolder(JMeter.java:530)
        at org.apache.jmeter.JMeter.start(JMeter.java:476)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.jmeter.NewDriver.main(NewDriver.java:259)

An error occurred: org.apache.jorphan.util.JOrphanUtils.canSafelyWriteToFolder(Ljava/io/File;)V

C:\Program Files\Java>

我嘗試使用maven無法解決Apache Jmter 2.13的jars中的解決方案。 但是似乎沒有用。 我認為我沒有正確配置pom。

我應該在這里做什么?

原因是以下擴展之一的版本。

     <artifact>kg.apc:jmeter-plugins-standard:jar:1.4.0</artifact>
     <artifact>kg.apc:jmeter-plugins-extras:jar:1.3.0</artifact>
     <artifact>kg.apc:jmeter-plugins-redis:jar:0.1</artifact>

其中之一復制了jorphan.jar的2.x版本,其中未引入canSafelyWriteToFolder(Ljava / io / File)方法。

我將它們更新為以下最新版本

      <artifact>kg.apc:jmeter-plugins-standard:jar:1.4.0</artifact>
      <artifact>kg.apc:jmeter-plugins-extras:jar:1.4.0</artifact>
      <artifact>kg.apc:jmeter-plugins-redis:jar:0.2</artifact>

將jorphan-3.0.jar復制到jemeter lib中。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM