4

I am trying to run jmeter script using java code. I already made one jmx. Iam using jmeter 2.13 when I tried to run the code it is showing me this error.

Failed to execute goal on project JmeterJson: Could not resolve dependencies for project JmeterJson:JmeterJson:war:0.0.1-SNAPSHOT: The following artifacts could not be resolved: commons-math3:commons-math3:jar:3.4.1, commons-pool2:commons-pool2:jar:2.3: Could not find artifact commons-math3:commons-math3:jar:3.4.1 in central (https://repo.maven.apache.org/maven2) -> [Help 1] [ERROR]

My pom.xml

<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>JmeterJson</groupId>
  <artifactId>JmeterJson</artifactId>  
  <version>0.0.1-SNAPSHOT</version>   
  <packaging>war</packaging>  
  <properties>    
    <spring.version>4.0.0.RELEASE</spring.version>     
    <jdk.version>1.8</jdk.version> 
    <jackson.version>1.9.10</jackson.version>   
  </properties>  

  <dependencies>    
    <dependency>    
      <groupId>org.apache.jmeter</groupId> 
      <artifactId>ApacheJMeter_core</artifactId> 
      <version>2.13</version>   
    </dependency>
    <dependency>      
      <groupId>org.springframework</groupId>     
      <artifactId>spring-core</artifactId>     
      <version>${spring.version}</version>   
    </dependency>   
    <dependency> 
      <groupId>org.apache.jmeter</groupId>  
      <artifactId>ApacheJMeter_http</artifactId>
      <version>2.13</version>   
        <exclusions>
          <exclusion>
            <artifactId>commons-math3</artifactId>
            <groupId>commons-math3</groupId>
          </exclusion>
          <exclusion>
                  <artifactId>commons-pool2</artifactId>
                  <groupId>commons-pool2</groupId>
                </exclusion>   
             </exclusions> 
              </dependency>

                 <dependency>      
            <groupId>org.springframework</groupId>     
             <artifactId>spring-web</artifactId>      
             <version>${spring.version}</version>    
             </dependency>  
                 <dependency>     
              <groupId>org.springframework</groupId>    
                <artifactId>spring-webmvc</artifactId>      
               <version>${spring.version}</version>    
              </dependency>  
                 <!-- Jackson JSON Mapper -->    
              <dependency>      
             <groupId>org.codehaus.jackson</groupId>    
          <artifactId>jackson-mapper-asl</artifactId>     
         <version>1.9.10</version>    
           </dependency>  

            <dependency>
           <groupId>com.fasterxml.jackson.core</groupId>
           <artifactId>jackson-databind</artifactId>
            <version>2.4.4</version>  
           </dependency>  
            </dependencies>   

                 <build>
                <sourceDirectory>src</sourceDirectory>
                <plugins>
                  <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.3</version>
                    <configuration>
                      <source>1.8</source>
                      <target>1.8</target>
                    </configuration>
                  </plugin>
                   <plugin>
                                <groupId>com.lazerycode.jmeter</groupId>
                                <artifactId>jmeter-maven-plugin</artifactId>
                                <version>1.10.1</version>
                                <executions>
                                    <execution>
                                        <id>jmeter-tests</id>
                                        <phase>verify</phase>
                                        <goals>
                                            <goal>jmeter</goal>
                                        </goals>
                                    </execution>
                                </executions>
                            </plugin>
                  <plugin>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.6</version>
                    <configuration>
                      <warSourceDirectory>WebContent</warSourceDirectory>
                      <failOnMissingWebXml>false</failOnMissingWebXml>
                    </configuration>
                  </plugin>
                </plugins>   
  </build> 
</project>

Before, when I didn't add jmeter jar, it was working fine.

Franta
  • 986
  • 10
  • 17
vihang shah
  • 588
  • 1
  • 10
  • 30

1 Answers1

5

Edit November 2017:

  • Last version 2.5.1 of JMeter Maven Plugin is now compatible with JMeter 3.3, so the most viable fix is to upgrade.

This is due to an issue in JMeter 2.13 pom which is fixed in nightly build:

Add this into JMeter dependency:

<exclusions>
  <exclusion>
    <artifactId>commons-math3</artifactId>
    <groupId>commons-math3</groupId>
  </exclusion>
  <exclusion>
    <artifactId>commons-pool2</artifactId>
    <groupId>commons-pool2</groupId>
  </exclusion>
</exclusions>

And add:

<dependency>
   <groupId>org.apache.commons</groupId>
   <artifactId>commons-math3</artifactId>
   <version>3.4.1</version>
</dependency>
<dependency>
   <groupId>org.apache.commons</groupId>
   <artifactId>commons-pool2</artifactId>
   <version>2.3</version>
</dependency>
UBIK LOAD PACK
  • 33,980
  • 5
  • 71
  • 116
  • hey,it worked for me..thank you..:)..is it kind of bug??UBIK LOAD PACK – vihang shah Feb 14 '16 at 05:54
  • hi , yes it was a bug in pom, fixed in next jmeter version. If answer is ok you should accept it and upvote si that users know it's tte correct anwser – UBIK LOAD PACK Feb 14 '16 at 09:16
  • Hi @UBIKLOADPACK I made its a question. Please help http://stackoverflow.com/questions/42663577/how-to-resolve-could-not-find-artifact-commons-math3commons-math3jar3-4-1 – Asanke Mar 08 '17 at 05:23