Open martinfrancois opened 2 years ago
It looks like your using a mix of shaded and not shaded dependencies which is likely the issue.
Can you only use shaded or non shaded dependencies.
Also you don't need to specify the client if you have pulled in mockserver-netty
as it includes the client.
Once you can confirm this is the issue I can make it clearer in the documentation to only use one or the other type of dependence. The shading process re-writes packages so if you include both there is a race condition in the class loader as to which class is loaded and you're have a mix of re-written classes and non-re-written classes.
Thanks a lot for getting back to me so quickly! Ah, I wasn't even aware that using the non-shaded ones was an option, in the documentation for 5.12.0 I remember it used to recommend somewhere to use the shaded ones for the client.
I can indeed confirm that switching to unshaded dependencies fixes this issue. In my case I was able to reduce it to the following (in case someone else runs into the same issue):
implementation("org.mock-server:mockserver-netty-no-dependencies:$mockserver_version")
testImplementation("org.mock-server:mockserver-junit-jupiter:$mockserver_version")
I have some suggestions for the docs that could make it a bit clearer, just to give you a perspective of an outsider:
For more details on the different variants/variations that are available of the dependency, check the page on Java dependencies
. Maybe you have an even better idea, but I feel like especially the term "version" is already too reserved to be used in this context (even though of course, now that I understand what you mean I see why you went for it in the first place 😉 )netty
dependency already includes the client
, or maybe even more in general mention which dependencies include what already so people don't unnecessarily declare overlapping dependencies (pardon if it's mentioned somewhere, I couldn't find it at least)
Describe the issue When I'm trying to start the mockserver with version 5.13.1 or 5.13.2, it results in a
NoSuchMethodError
, which does NOT appear with 5.13.0:What you are trying to do When running a main method that does
ClientAndServer client = new ClientAndServer(1080);
, it results in the aforementioned error.A similar error appears when trying to start junit tests when using the
MockServerExtension
, I assume it's the same kind of issue, but wanted to mention it anyways in case it's a different issue.MockServer version 5.13.1 and 5.13.2
To Reproduce Steps to reproduce the issue:
src/main/java/MockServer.java
src/test/java/MockServerTest.java
NoSuchMethodError
appearsExpected behaviour The mockserver to start normally, as when the mockserver version is 5.13.0, with an output like this:
MockServer Log No log output by MockServer, apart from the error.