Closed musketyr closed 6 years ago
See the pull request comment, but I think I should be able to just use the latest version of 1.3 with some minor changes... I just went for "most current" when I picked one. :-)
Ok, I did a little testing and it seems that I can use 1.3.15 (and will try to track with boot/grails going forward). All I had to do was pull out the port updating into a non-static-compiled method and do some groovy digging :-)
@CompileStatic(SKIP)
private void applyPorts() {
actualHttpPort = server.channels[0].channel.localAddress.holder.port
if (httpsEnabled) {
actualHttpsPort = server.channels[1].tcpServer.channel.localAddress.holder.port
}
}
If just using 1.3.15 will solve the problem you ran into I will just use this version (and the code above) going forward. Thanks for your help. If this doesn't do it, let me know what I missed.
I guess I need to add a contributors page now.
I'm happy with this solution as well :-) just wonder why do go through tcpServer
for HTTPS and not for HTTP? (I don't know the internals of Undertow or XNIO it just looks weird to me 😄 ).
No need for contributors page yet, wait for real contribution 😄 But new release including this fix would be great 🍾
Ok, try v1.2.1 which was just released. It's available on bintray but might take a bit longer to become available on maven central. Let me know if this takes care of the issue and I will close it out. Thanks.
works great! thank you!
The compatibility seems to be broken again in 1.5.0
. With 1.3.0
it was ok.
java.lang.NoSuchMethodError: io.undertow.Undertow.getListenerInfo()Ljava/util/List;
at com.stehno.ersatz.ErsatzServer.applyPorts(ErsatzServer.groovy:498)
at com.stehno.ersatz.ErsatzServer.start(ErsatzServer.groovy:399)
at com.stehno.ersatz.ErsatzServer.expectations(ErsatzServer.groovy:245)
Yes. Now in order to work in a scenario like that you need to use the safe
(shadowed) jar (see Shadow Jar section in User Guide). I didn't want to hold back the internal version of Undertow since realistically two versions of Boot or Grails could both use a different version of Undertow - it and its internal-required libraries are all bundled with the shadow jar. The down side is that you no longer get the other transitive dependencies, such as Hamcrest.
This is somewhat experimental, but I have tested it to work on it's own. If you find any issues, feel free to register them and I will jump right on it.
I will leave this issue open for now - please respond or close it if the safe
distribution works for you.
works well. maybe it is worth to mention this directly in README file.
Thanks. Agreed! I will add it to the README. I am also planning on being a bit more rigorous with my release notes going forward. Hindsight, I should have asked you to test this before releasing it since you are the only know use case. ;-) Glad it works for you.
If not really necessary it would be nice if Ersatz server is compatible with Undertow 1.3.x (namely 1.3.15.Final) which is used by various spring boot related libraries (https://mvnrepository.com/artifact/io.undertow/undertow-core/1.3.25.Final/usages). This disqualifies from using Ersatz with Spring Boot or Grails 3. The construct offending the compatibility is currently
server.listenerInfo
: