6

I'm running a Thorntail 2.2.1.Final microservice with Maven using either of these commands

mvn thorntail:start
mvn thorntail:run

It runs fine, but when I hit Ctrl-C it doesn't exit the application i.e. the console returns, but the app runs in the background. I've tried to stop it

mvn thorntail:stop

But that doesn't work. I have to go and kill the process. I'm using Windows 10.

Sean
  • 1,416
  • 19
  • 51
  • 1
    The `thorntail:start` and `thorntail:stop` goals are meant to be used together as part of a Maven lifecycle, typically for integration testing. That is, `thorntail:start` intentionally leaves the process running in the background, and `thorntail:stop` should stop it. For interactive use, `mvn thorntail:run` should be used. That keeps waiting in the foreground, and Ctrl+C should stop the application behind it. If none of that works, it's a bug. I'd recommend filing a bug in http://issues.jboss.org/browse/THORN and preferrably also include a `jstack` output for the process. – Ladicek Nov 12 '18 at 12:58
  • Thanks for the explanation on stop and start, that wasn't clear to me in the documentation. – Sean Nov 12 '18 at 13:12
  • If this was all that you needed, should I copy the comment to an actual answer so that you can mark the question as answered? – Ladicek Nov 12 '18 at 14:24
  • @Ladicek yes, sounds good to me – Sean Nov 12 '18 at 14:42
  • Just did that, thanks. – Ladicek Nov 13 '18 at 08:04

1 Answers1

7

The thorntail:start and thorntail:stop goals are meant to be used together as part of a Maven lifecycle, typically for integration testing. That is, thorntail:start intentionally leaves the process running in the background, and thorntail:stop should stop it.

For interactive use, mvn thorntail:run should be used. That keeps waiting in the foreground, and Ctrl+C should stop the application behind it.

If none of that works, it's a bug. I'd recommend filing a bug in https://issues.jboss.org/browse/THORN and preferrably also include a jstack output for the process.

Ladicek
  • 5,970
  • 17
  • 20
  • 3
    I'm running Thorntail 2.3.0.Final on Windows 7 and Ctrl+C is not enough to exit Thorntail. It seems that only the .bat file finishes (judging by the confirmation asked). The Java process keeps running. – marcus Feb 28 '19 at 20:27
  • 3
    Same situation for me with Thorntail 2.4.0.Final on Windows 10. Did you ever open a ticket about it? – Daniel Rodríguez Apr 04 '19 at 13:21
  • Don't know on Unix, but on Windows Thorntail behaves very bad – Fabrizio Stellato Jan 30 '20 at 15:04
  • On Linux Thorntail uberjar cannot be stopped via Maven: thorntail:stop is not usable from the CLI – fundagain Jul 13 '20 at 16:41
  • `thorntail:stop` is not meant to be used from CLI and definitely isn't supposed to stop arbitrary Thorntail uberjars. It's only meant to be used from Maven, in the `post-integration-test` phase, together with `thorntail:start` in the `pre-integration-test` phase. – Ladicek Jul 13 '20 at 20:26