Closed joaolrpaulo closed 2 years ago
Hello, thank you for asking about this matter and providing the info!
That logic is trying to solve jmeter search path which is used by jmeter to then properly load classes while executing the testplan.
I have generated uber jars with assembly plugin as described here under uber jar section.
As a side note: when I tried to use shade plugin, faced some limitations.
Spring boot uses a different mechanism to build jars, and in fact, as much as I remember from my springboot experience, uses a custom ClassLoader that allows it to solve classes in such jars (jars containing jars inside). This JMeter DSL logic, and JMeter itself, does not have support for such logic, and we would need to run experimentation to properly provide a solution, which might take a non trivial effort if we need to implement a custom classloader or something like that.
Now some questions π :
Sounds like a really interesting problem.
Another workaround (instead of using maven assembly plugin) you may use is excluding such transitive dependencies from jmeter-java-dsl, copy them to a specific folder and add such folder to the classpath. That way the jar would not be inside another jar which is probably the reason for non hierarchical URI exception.
Hope to hear back soon π .
Hello ππΌ In first place thanks for the quick response π₯
Answering to your questions:
About the workaround, that might actually be feasible, I will give it a try whenever possible.
Great, looking forward to see how this can be solved :).
So, after a while without being able to follow-up on this, I was able to properly setup a sample repo that demonstrates the problem.
You can run the application in IJ IDE, via gradle bootRun
task, however if you compile using bootJar
and run the standalone JAR it fails with the error above.
Hello, thank you very much for the detailed example!
Just adding this to the build.gradle.kts
(and the proper import) I got it working:
tasks.named<BootJar>("bootJar") {
requiresUnpack("**/ApacheJMeter_*.jar", "**/jmeter-plugins-*.jar")
}
Here is spring-boot doc about it.
Let me know if that solves your issues as well.
Side notes:
.method("GET")
to do a GET request. By default httSampler does gets unless other method is specified.google.com
, and should provide full url. Eg: https://google.com
for request to be successful.Closing this as the above solution seems quite simple. If you see any issue with it please let us know.
Hey ππΌ
I would swear I have tested this before, but I think I might have forgotten to unpack with *
, and only tried a couple of the jars π€¦πΌ
Just tested your approach, and seems to be working, going to close the issue.
Much thanks for the help here ππΌ
EDIT: Didn't have refreshed the page, as we were testing this :D
Me and my team are trying to integrate this into a project that includes Spring Boot, and whenever we run our FatJar we encounter multiple problems in the app bootprocess.
This is the current problems that we are facing:
This first stacktrace we solved by extracting the
/bin/
folder in theorg.apache.jmeter:ApacheJMeter_config:5.5
package and manually adding it to our resources folder.However the second one seems to imply that there are code changes that need to be applied in order to properly get around it.
EDIT: I was able to gather the URL that seems to not be hierarchical,
jar:file:/Users/myuser/my_fancy.jar!/BOOT-INF/lib/ApacheJMeter_components-5.5.jar!/
Current code sample being used:
NOTE:
sampler
is a simpleHTTPSampler
to GET results from an endpoint.