简体   繁体   中英

com.thoughtworks.xstream.converters.ConversionException while running jmeter script using maven eclipse

I have integrated my jmeter script with maven. I have jmeter plugin manager also. While running it, i am getting java.lang.IllegalArgumentException which is resulting into above exception. I have added dependency for jmeter plugin manager and xstream but still i am getting same error.

exactly same kind of issue has been discussed here, but the content now has been removed. https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/issues/194

pom file -

            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>test_framework</groupId>
            <artifactId>api_test_plan</artifactId>
            <version>0.0.1-SNAPSHOT</version>
            <packaging>jar</packaging>

            <name>dkc_api_test_plan</name>
            <url>http://maven.apache.org</url>
            <properties>
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                <ThreadCount.thread1>10</ThreadCount.thread1>
            </properties>
            <build>

                <plugins>
                    <!-- jmeter plugin to run jmeter through maven build -->
                    <plugin>
                        <groupId>com.lazerycode.jmeter</groupId>
                        <artifactId>jmeter-maven-plugin</artifactId>
                        <version>2.7.0</version>
                        <executions>
                            <execution>
                                <id>jmeter-tests</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>jmeter</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <resultsFileFormat>xml</resultsFileFormat>
                            <generateReports>false</generateReports>
                            <testResultsTimestamp>false</testResultsTimestamp>
                            <jmeterExtensions>
                                <artifact>kg.apc:jmeter-plugins:pom:1.3.1</artifact>
                            </jmeterExtensions>
                            <!-- inputFile>${project.build.directory}/jmeter/results/CreateOrderLoadTest.jtl</inputFile -->
                        </configuration>

                    </plugin>
                    <!--surefire plugin to generate html reports -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>3.0.0-M3</version>
                        <configuration>
                            <outputFolder>${project.build.directory}/target/surefire-reports</outputFolder>
                            <printReport>true</printReport>
                            <exportAll>true</exportAll>
                        </configuration>
                    </plugin>
                    <!-- plugin> <groupId>com.lazerycode.jmeter</groupId> <artifactId>jmeter-analysis-maven-plugin</artifactId> 
                        <version>1.0.4</version> <configuration> <source>${project.build.directory}/jmeter/results/dkc_sales.jtl</source> 
                        </configuration> <executions> <execution> <id>create-html-report</id> <phase>verify</phase> 
                        <goals> <goal>analyze</goal> </goals> </execution> </executions> </plugin -->
                </plugins>
                <!-- https://mvnrepository.com/artifact/junit/junit -->


            </build>
            <dependencies>
                <dependency>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                    <version>4.9</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.apache.jmeter</groupId>
                    <artifactId>ApacheJMeter_java</artifactId>
                    <version>3.1</version>
                </dependency>
                <!-- https://mvnrepository.com/artifact/kg.apc/jmeter-plugins-manager       <dependency>
                    <groupId>kg.apc</groupId>
                    <artifactId>jmeter-plugins-manager</artifactId>
                    <version>0.1</version>
                </dependency>

            </dependencies>

        </project>    ```

-------------------------------------------------------
[INFO]  P E R F O R M A N C E    T E S T S
[INFO] -------------------------------------------------------
[INFO]  
[INFO]  
[INFO] Executing test: myFile.jmx
[INFO] Starting process with:[java, -Xms512M, -Xmx512M, -jar, ApacheJMeter-4.0.jar, -d, D:\Projects\....
[INFO] Error in NonGUIDriver java.lang.IllegalArgumentException: Problem loading XML from:'D:\Projects\\target\jmeter\testFiles\myFile.jmx', missing class com.thoughtworks.xstream.converters.ConversionException: 
[INFO] ---- Debugging information ----
[INFO] cause-exception     : com.thoughtworks.xstream.converters.ConversionException
[INFO] cause-message       : 
[INFO] first-jmeter-class  : org.apache.jmeter.save.converters.HashTreeConverter.unmarshal(HashTreeConverter.java:67)
[INFO] class               : org.apache.jmeter.save.ScriptWrapper
[INFO] required-type       : org.apache.jorphan.collections.ListedHashTree
[INFO] converter-type      : org.apache.jmeter.save.ScriptWrapperConverter
[INFO] path                : /jmeterTestPlan/hashTree/hashTree/hashTree[3]/hashTree[5]/hashTree[4]/hashTree[3]/com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor
[INFO] line number         : 3610
[INFO] version             : 4.0 r1823414
[INFO] -------------------------------
[INFO] Completed Test: D:\Projects\Project_Name\api_test_plan\target\jmeter\testFiles\myFile.jmx
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 29.003 s
[INFO] Finished at: 2019-04-19T12:53:28+05:30
[INFO] Final Memory: 38M/282M
[INFO] ------------------------------------------------------------------------
[INFO] Shutdown detected, destroying JMeter process...**strong text**

Don't use pom dependencies as you did in:

kg.apc:jmeter-plugins:pom:1.3.1

It should work

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM