Closed KhanAkuma closed 5 months ago
Have you checked the solution provided here?
If that solves, the issue is not directly with JMeter DSL, but on how spring boot plugin packages the application.
Regards
Thank you, that really works for me!
My coworkers and I searched the web but unfortunately none of us found that solution.
Best regards!
Greetings.
I found a problem with the JMeter Java DSL library. I implemented a Spring Boot 3.3.0 Application in Java 17 (also tested Java 21) as command line application. I implemented several testplans and everythings works fine if I execute the testplans within IntelliJ. But when I build a JAR and run the spring boot application and the testplans, I get following error:
java.lang.IllegalArgumentException: URI is not hierarchical at java.base/java.io.File.<init>(File.java:420) ~[na:na] at us.abstracta.jmeter.javadsl.core.engines.JmeterEnvironment.getClassJarPath(JmeterEnvironment.java:96) ~[jmeter-java-dsl-1.28.1.jar!/:1.28.1] at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[na:na] at java.base/java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1715) ~[na:na] at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[na:na] at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[na:na] at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) ~[na:na] at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na] at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[na:na] at us.abstracta.jmeter.javadsl.core.engines.JmeterEnvironment.updateSearchPath(JmeterEnvironment.java:70) ~[jmeter-java-dsl-1.28.1.jar!/:1.28.1] at us.abstracta.jmeter.javadsl.core.engines.EmbeddedJmeterEngine.runInEnv(EmbeddedJmeterEngine.java:109) ~[jmeter-java-dsl-1.28.1.jar!/:1.28.1] at us.abstracta.jmeter.javadsl.core.engines.EmbeddedJmeterEngine.run(EmbeddedJmeterEngine.java:93) ~[jmeter-java-dsl-1.28.1.jar!/:1.28.1] at us.abstracta.jmeter.javadsl.core.DslTestPlan.run(DslTestPlan.java:138) ~[jmeter-java-dsl-1.28.1.jar!/:1.28.1] at org.springframework.boot.SpringApplication.lambda$callRunner$5(SpringApplication.java:790) ~[spring-boot-3.3.0.jar!/:3.3.0] at org.springframework.util.function.ThrowingConsumer$1.acceptWithException(ThrowingConsumer.java:83) ~[spring-core-6.1.8.jar!/:6.1.8] at org.springframework.util.function.ThrowingConsumer.accept(ThrowingConsumer.java:60) ~[spring-core-6.1.8.jar!/:6.1.8] at org.springframework.util.function.ThrowingConsumer$1.accept(ThrowingConsumer.java:88) ~[spring-core-6.1.8.jar!/:6.1.8] at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:798) ~[spring-boot-3.3.0.jar!/:3.3.0] at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:789) ~[spring-boot-3.3.0.jar!/:3.3.0] at org.springframework.boot.SpringApplication.lambda$callRunners$3(SpringApplication.java:774) ~[spring-boot-3.3.0.jar!/:3.3.0] at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) ~[na:na] at java.base/java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:357) ~[na:na] at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:510) ~[na:na] at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[na:na] at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) ~[na:na] at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) ~[na:na] at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na] at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) ~[na:na] at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:774) ~[spring-boot-3.3.0.jar!/:3.3.0] at org.springframework.boot.SpringApplication.run(SpringApplication.java:342) ~[spring-boot-3.3.0.jar!/:3.3.0] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363) ~[spring-boot-3.3.0.jar!/:3.3.0] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1352) ~[spring-boot-3.3.0.jar!/:3.3.0] at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na] at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:91) ~[dataSignTestSuite.jar:0.0.1-SNAPSHOT] at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:53) ~[dataSignTestSuite.jar:0.0.1-SNAPSHOT] at org.springframework.boot.loader.launch.JarLauncher.main(JarLauncher.java:58) ~[dataSignTestSuite.jar:0.0.1-SNAPSHOT]
(I removed the lines showing company insides)I use JMeter Java DSL version 1.28.1, Windows 10, Oracle JDK 17 and Spring Boot 3.3.0. I debugged a lot to understand the problem. As soon as the testplan().run() is executed, some classes will be searched in the Class "us.abstracta.jmeter.javadsl.core.engines.JmeterEnvironment". The error occures in line 96 in the method getClassJarPath(). Within IntelliJ the new File() constructor is called with the uri "file:/D:/Maven/org/apache/jmeter/ApacheJMeter_http/5.5/ApacheJMeter_http-5.5.jar" and works fine, but if I execute tests with the jar, the new File() constructor is called with the uri "jar:nested:/D:/Temp/TestSuite.jar/!BOOT-INF/lib/ApacheJMeter_http-5.5.jar!/" and produces the mentioned error. The new File() constructor checks if the uri is opaque (beginning with "/") and in case of "jar:nested", it doesn't start with "/" and "throw new IllegalArgumentException("URI is not hierarchical")" is called. In debug mode I tried calling the new File() constructor with the uri as String and that works fine. So maybe a possible fix could be calling new File() with the path as String instead of an uri.
It would be nice if this could be fixed or maybe there is at least a workaround or something else I can do.
Many thanks in advance!