加特林负载测试期间的编译错误 [英] compilation error during gatling load test

查看:69
本文介绍了加特林负载测试期间的编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写模拟,并且希望能够运行模拟.尝试$ mvn gatling:execute时出现错误.

I'm trying to write a simulation and i want to be able to run the simulation. I get an error while trying to $mvn gatling:execute.

我的pom具有以下依赖性:

My pom has the following dependencies:

<dependency>
    <groupId>io.gatling</groupId>
    <artifactId>gatling-charts</artifactId>
    <version>2.2.5</version>
</dependency>
<dependency>
    <groupId>io.gatling</groupId>
    <artifactId>gatling-core</artifactId>
    <version>2.2.5</version>
</dependency>

和以下插件:

<build>
    <plugins>
        <plugin>
            <groupId>net.alchim31.maven</groupId>
            <artifactId>scala-maven-plugin</artifactId>
            <version>3.3.1</version>
            <configuration>
                <scalaVersion>2.12.3</scalaVersion>
            </configuration>
        </plugin>
        <plugin>
            <groupId>io.gatling</groupId>
            <artifactId>gatling-maven-plugin</artifactId>
            <version>2.2.4</version>
            <executions>
                <execution>
                    <id>performanceTests</id>
                    <goals>
                        <goal>execute</goal>
                    </goals>
                    <configuration>
                        <simulationClass>simulations.SimulationClass</simulationClass>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

这是我遇到的错误:

12:50:36.313 [main][WARN ][ZincCompiler.scala:141] i.g.c.ZincCompiler$ - 
Pruning sources from previous analysis, due to incompatible CompileSetup.
java.lang.ClassNotFoundException: io.gatling.app.Gatling
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at io.gatling.mojo.MainWithArgsInFile.runMain(MainWithArgsInFile.java:42)
    at io.gatling.mojo.MainWithArgsInFile.main(MainWithArgsInFile.java:33)

包含的依赖项:

<dependency>
    <groupId>io.gatling</groupId>
    <artifactId>gatling-app</artifactId>
    <version>2.2.5</version>
</dependency>

但是现在我收到一个新错误:

But now i get a new error:

java.lang.reflect.InvocationTargetException
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 io.gatling.mojo.MainWithArgsInFile.runMain(MainWithArgsInFile.java:50)
at io.gatling.mojo.MainWithArgsInFile.main(MainWithArgsInFile.java:33)
Caused by: java.lang.NoSuchMethodError: scala.Product.$init$(Lscala/Product;)V
at com.github.mnogu.gatling.mqtt.protocol.MqttProtocolOptionPart.<init>(MqttProtocol.scala:124)
at com.github.mnogu.gatling.mqtt.protocol.MqttProtocol$.apply(MqttProtocol.scala:24)
at com.github.mnogu.gatling.mqtt.protocol.MqttProtocolBuilder$.apply(MqttProtocolBuilder.scala:13)
at com.github.mnogu.gatling.mqtt.Predef$.mqtt(Predef.scala:9)
at simulations.SimulationClass.<init>(SimulationClass.scala:10)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at io.gatling.app.Runner.run0(Runner.scala:79)
at io.gatling.app.Runner.run(Runner.scala:64)
at io.gatling.app.Gatling$.start(Gatling.scala:59)
at io.gatling.app.Gatling$.fromArgs(Gatling.scala:43)
at io.gatling.app.Gatling$.main(Gatling.scala:35)
at io.gatling.app.Gatling.main(Gatling.scala)

...

任何有关此问题的线索都会有很大帮助.

Any leads regarding this problem would be of great help.

谢谢

推荐答案

您的错误表明您缺少依赖关系,

Your error says that you are missing following dependency,

<!-- https://mvnrepository.com/artifact/io.gatling/gatling-app -->
<dependency>
    <groupId>io.gatling</groupId>
    <artifactId>gatling-app</artifactId>
    <version>2.2.5</version>
</dependency>

已更新

您的第二个错误主要是因为代码在运行时引用的jar文件与编译时使用的jar文件不同.因此,请确保在编译和运行时使用相同的jar.

Your second error is mainly because the jar file that your code refers at runtime is not the same jar file that is used at compile time. So make sure that you are using the same jar while compiling and while running.

为此,您可以删除依赖的jar文件,用maven清理项目,然后重新编译并运行程序.

For that, you can delete the dependent jar files, maven clean your project and recompile and run the program.

这篇关于加特林负载测试期间的编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆