0
votes

running jmeter 2.13 on java 1.7

I have a test case that consists of simple groovy script sampler that takes one parameter specified as ${__P(var,foo)} and printlns args[0]. I can download apache jmeter 2.13 and run the test case and as expected it prints out "foo". However if I build jmeter using the maven artifacts the same .jmx test case outputs " ${__P(var,foo)}". So it seems it is not recognizing the parameter as a variable. My pom file follows:

<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">
<parent>
    <artifactId>jicd-4.2-tools-onboarding</artifactId>
    <groupId>com.ticomgeo.jicd42</groupId>
    <version>0.2.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>onboarding-tests</artifactId>
<packaging>jar</packaging>

<name>validation-tests</name>
<url>http://maven.apache.org</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <jmeter-version>2.13</jmeter-version>
</properties>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.jmeter</groupId>
        <artifactId>ApacheJMeter_core</artifactId>
        <version>${jmeter-version}</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.apache.jmeter</groupId>
        <artifactId>ApacheJMeter_components</artifactId>
        <version>${jmeter-version}</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.apache.jmeter</groupId>
        <artifactId>ApacheJMeter_java</artifactId>
        <version>${jmeter-version}</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.apache.jmeter</groupId>
        <artifactId>ApacheJMeter</artifactId>
        <version>${jmeter-version}</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.apache.jmeter</groupId>
        <artifactId>ApacheJMeter_config</artifactId>
        <version>${jmeter-version}</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.apache.jmeter</groupId>
        <artifactId>ApacheJMeter_report</artifactId>
        <!-- <version>${jmeter-version}</version> -->
        <version>2.12</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.apache.jmeter</groupId>
        <artifactId>ApacheJMeter_functions</artifactId>
        <version>${jmeter-version}</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.apache.jmeter</groupId>
        <artifactId>ApacheJMeter_monitors</artifactId>
        <version>${jmeter-version}</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.apache.jmeter</groupId>
        <artifactId>ApacheJMeter_mail</artifactId>
        <version>${jmeter-version}</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.apache.jmeter</groupId>
        <artifactId>ApacheJMeter_junit</artifactId>
        <version>${jmeter-version}</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.apache.jmeter</groupId>
        <artifactId>jorphan</artifactId>
        <version>${jmeter-version}</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.apache.jmeter</groupId>
        <artifactId>ApacheJMeter</artifactId>
        <version>${jmeter-version}</version>
        <exclusions>
            <exclusion>
                <artifactId>commons-math3</artifactId>
                <groupId>commons-math3</groupId>
            </exclusion>
            <exclusion>
                <artifactId>commons-pool2</artifactId>
                <groupId>commons-pool2</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <!-- fix jmeter build bug -->
    <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>

    <!-- groovy -->
    <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-all</artifactId>
        <version>2.4.6</version>
    </dependency>
    <!-- appgeo -->
    <dependency>
        <groupId>com.ticomgeo.jicd42</groupId>
        <artifactId>appgeo-jaxb</artifactId>
    </dependency>

    <dependency>
        <groupId>com.techma.nxm</groupId>
        <artifactId>nextmidas</artifactId>
        <classifier>sys</classifier>
        <version>3.0.1</version>
    </dependency>

    <dependency>
        <groupId>gov.oio.jicd42</groupId>
        <artifactId>app-geo-api</artifactId>
        <version>2.0.3</version>
    </dependency>

    <!-- <dependency> <groupId>org.apache.jmeter</groupId> <artifactId>ApacheJMeter_parent</artifactId> 
        <version>${jmeter-version}</version> </dependency> -->
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>appassembler-maven-plugin</artifactId>
            <version>1.4</version>
            <configuration>
                <configurationDirectory>config</configurationDirectory>
                <!-- Copy the contents from "/src/main/config" to the 
                    target configuration directory in the assembled application -->
                 <copyConfigurationDirectory>true</copyConfigurationDirectory>
                <includeConfigurationDirectoryInClasspath>true</includeConfigurationDirectoryInClasspath>
                <repositoryLayout>flat</repositoryLayout>
                <repositoryName>lib</repositoryName>
                <programs>
                    <program>
                         <mainClass>org.apache.jmeter.NewDriver</mainClass>
                        <name>validationTest</name>
                    </program>
                </programs>
            </configuration>
            <executions>
                <execution>
                    <configuration>
                        <extraJvmArguments />
                    </configuration>
                    <id>create-executables</id>
                    <phase>package</phase>
                    <goals>
                        <goal>assemble</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <descriptors>
                    <descriptor>src/main/assembly/bin.xml</descriptor>
                </descriptors>
            </configuration>
            <executions>
                <execution>
                    <id>bin</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

2

2 Answers

0
votes

Most likely you have some packaging issue, it is not something which is connected with JMeter or Maven as I cannot reproduce your issue using JMeter Maven Plugin

Sample 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>org.jmeter.test</groupId>
    <artifactId>onboarding-tests</artifactId>
    <version>1.0-SNAPSHOT</version>
    <build>
        <plugins>
            <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>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-all</artifactId>
                        <version>2.4.6</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>
</project>

Sample output:

[INFO] -------------------------------------------------------
[INFO]  P E R F O R M A N C E    T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO]
[info]
[debug] JMeter is called with the following command line arguments: -n -t /private/tmp/jmeter-maven/src/test/jmeter/example.jmx -l /private/tmp/jmeter-maven/target/jmeter/results/20160413-example.jtl -d /private/tmp/jmeter-maven/target/jmeter -j /private/tmp/jmeter-maven/target/jmeter/logs/example.jmx.log
[info] Executing test: example.jmx
[debug] Creating summariser <summary>
[debug] Created the tree successfully using /private/tmp/jmeter-maven/src/test/jmeter/example.jmx
[debug] Starting the test @ Wed Apr 13 06:39:54 CEST 2016 (1460522394158)
[debug] Waiting for possible shutdown message on port 4445
[debug] foo
[debug] summary =      1 in   0.3s =    2.9/s Avg:   282 Min:   282 Max:   282 Err:     0 (0.00%)
[debug] Tidying up ...    @ Wed Apr 13 06:39:55 CEST 2016 (1460522395204)
[debug] ... end of run
[info] Completed Test: example.jmx
[INFO]
[INFO] Test Results:
[INFO]
[INFO] Tests Run: 1, Failures: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

So maybe it worth considering switching to that plugin instead of triggering a JMeter test manually as you may miss an important configuration step.

References:

0
votes

Ok, found the answer. I was using the appassembler plugin. That places all the jars into the classpath. I was relying on that for jmeter to find its plugins. I moved the plugins to a separate directory and set the search_paths jmeter property to that directory i.e

search_paths=../apache

This not only fixed the problem with the properties not resolving but also with the GUI not running.

An error occurred: No action handlers found - check JMeterHome and libraries

Note just adding the appassembler generated lib directory did not work. The following error occured in that case:

An error occurred: class "org.bouncycastle.cms.BaseDigestCalculator"'s signer information does not match signer information of other classes in the same package