简体   繁体   中英

Continuous Integration(CI):MonDB version is too low in the MAVEN project with Jmeter

I have a problem in my 'MAVEN project' when it tries to access mongodb with authentication:

500 - javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: static com.mongodb.MongoCredential.createScramSha1Credential() is applicable for argument types: (java.lang.String, java.lang.String, [C) values:...

The reason is the 'mongo-java-driver-2.11.3.jar' does not support 'SCRAM-SHA1',so i deleted it and in POM.XML joined the 'mongo-java-driver-2.13.3',but Jmeter Configuring automatically download the 'mongo-java-driver-2.11.3.jar' again:

在此处输入图片说明

在此处输入图片说明

How to solve the problem? Any help would be appreciated.

You need to:

  1. Exclude existing MongoDB Java Driver like:

     <excludedArtifacts> <artifact>org.mongodb:mongo-java-driver</artifact> </excludedArtifacts> 
  2. Include new version of the MongoDB Java Driver like:

     <testPlanLibraries> <artifact>org.mongodb:mongo-java-driver:2.13.3</artifact> </testPlanLibraries> 

Full pom.xml just in case:

<?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.blazemeter</groupId>
    <artifactId>com.blazemeter.jmeter.maven</artifactId>
    <version>1.0-SNAPSHOT</version>

    <build>
        <plugins>
            <plugin>
                <groupId>com.lazerycode.jmeter</groupId>
                <artifactId>jmeter-maven-plugin</artifactId>
                <version>2.7.0</version>
                <executions>
                    <!-- Run JMeter tests -->
                    <execution>
                        <id>jmeter-tests</id>
                        <goals>
                            <goal>jmeter</goal>
                        </goals>
                    </execution>
                    <!-- Fail build on errors in test -->
                    <execution>
                        <id>jmeter-check-results</id>
                        <goals>
                            <goal>results</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <testPlanLibraries>
                        <artifact>org.mongodb:mongo-java-driver:3.4.2</artifact>
                    </testPlanLibraries>
                    <excludedArtifacts>
                        <artifact>org.mongodb:mongo-java-driver</artifact>
                    </excludedArtifacts>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

References:

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