Jetty

Stopping maven jetty plugin from eclipse - NO CTRL/C -

Details

  • Type: New Feature New Feature
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: Maven2
  • Description:
    Hide

    As indicated in the doc, from a dos window, mvn jetty:run ... works fine and stopping it with ctrl/c works fine as well.
    However, I using maven jetty plugin from Eclipse
    I wrote a simple .bat command file to start it with all my requested options, and this works fine, but ... I cant stop it from Eclipse,
    (killing under Eclipse stops the associated console, but doesnt stop jetty - it can only be done from the windows task manager)

    Any chance to get an mvn jetty:stop or something similar ?

    Thanks for any hint,

    Christian-Luc

    Show
    As indicated in the doc, from a dos window, mvn jetty:run ... works fine and stopping it with ctrl/c works fine as well. However, I using maven jetty plugin from Eclipse I wrote a simple .bat command file to start it with all my requested options, and this works fine, but ... I cant stop it from Eclipse, (killing under Eclipse stops the associated console, but doesnt stop jetty - it can only be done from the windows task manager) Any chance to get an mvn jetty:stop or something similar ? Thanks for any hint, Christian-Luc
  • Environment:
    Windows, Eclipse

Activity

Hide
Greg Wilkins added a comment - 05/Jan/07 9:50 AM

I run mvn jetty:run directly as a external tool from eclipse.
Clicking the red stop square works perfectly.

Why do you need a bat file?

Show
Greg Wilkins added a comment - 05/Jan/07 9:50 AM I run mvn jetty:run directly as a external tool from eclipse. Clicking the red stop square works perfectly. Why do you need a bat file?
Hide
Markus Joschko added a comment - 05/Jan/07 9:58 AM

I can confirm the bug. I always have the process explorer open to kill jetty. If I press the red square it seems that jetty is stopped but the process is still running. Trying to start again results in an "address already bound" exception. That's true for eclipse3.2/windows. Not sure if it happens using linux.

Show
Markus Joschko added a comment - 05/Jan/07 9:58 AM I can confirm the bug. I always have the process explorer open to kill jetty. If I press the red square it seems that jetty is stopped but the process is still running. Trying to start again results in an "address already bound" exception. That's true for eclipse3.2/windows. Not sure if it happens using linux.
Hide
Greg Wilkins added a comment - 05/Jan/07 11:20 AM

OK - I have reopened.... but my vmware is stuffed - so I will have to rely on a volunteer windows user to debug!

Show
Greg Wilkins added a comment - 05/Jan/07 11:20 AM OK - I have reopened.... but my vmware is stuffed - so I will have to rely on a volunteer windows user to debug!
Hide
christian-Luc Houze added a comment - 08/Jan/07 1:19 AM

thanks for reopening.

In order to confirm previous comment from Markus, i'm using eclipse3.2/windows xp sp1
the problem happens wether jetty plugin is launched directly through an eclipse "run", or via an eclipse "run external tool" (e.g. a bat file).
the need for a bat file is taht I want to be able to launch jetty plugin even if I am not in an eclipse environment

Show
christian-Luc Houze added a comment - 08/Jan/07 1:19 AM thanks for reopening. In order to confirm previous comment from Markus, i'm using eclipse3.2/windows xp sp1 the problem happens wether jetty plugin is launched directly through an eclipse "run", or via an eclipse "run external tool" (e.g. a bat file). the need for a bat file is taht I want to be able to launch jetty plugin even if I am not in an eclipse environment
Hide
Markus Joschko added a comment - 08/Jan/07 4:49 AM

sorry. I can't volunteer as I only use windows at work where I don't have the time to debug this issue. Just for the record, on a linux box it works fine for me.

Show
Markus Joschko added a comment - 08/Jan/07 4:49 AM sorry. I can't volunteer as I only use windows at work where I don't have the time to debug this issue. Just for the record, on a linux box it works fine for me.
Hide
Jan Bartel added a comment - 23/Jan/07 8:43 AM

Armi, can you investigate this on windows?

Show
Jan Bartel added a comment - 23/Jan/07 8:43 AM Armi, can you investigate this on windows?
Hide
Armi Lyn B. Manlosa added a comment - 25/Jan/07 2:48 AM

The mvn jetty:run executed as an external tool is terminated but the child java process isn't.. could be an eclipse/windows issue with respect to killing child processes?

Show
Armi Lyn B. Manlosa added a comment - 25/Jan/07 2:48 AM The mvn jetty:run executed as an external tool is terminated but the child java process isn't.. could be an eclipse/windows issue with respect to killing child processes?
Hide
Jakub Pawlowicz added a comment - 25/Jan/07 3:37 AM

I can confirm a similar behavior when creating a new process from within Ant script. Then if I hit CTRL+C or stop it when running from Eclipse, the created process is not stopped at all.
I suppose this could be a windows issue in general.
On *nix boxes everything works fine though.

Show
Jakub Pawlowicz added a comment - 25/Jan/07 3:37 AM I can confirm a similar behavior when creating a new process from within Ant script. Then if I hit CTRL+C or stop it when running from Eclipse, the created process is not stopped at all. I suppose this could be a windows issue in general. On *nix boxes everything works fine though.
Hide
Jan Bartel added a comment - 26/Jan/07 6:39 AM

Armi, does this problem happen if you launch jetty as an external tool (ie java -jar start.jar) rather than the mvn jetty plugin?

Show
Jan Bartel added a comment - 26/Jan/07 6:39 AM Armi, does this problem happen if you launch jetty as an external tool (ie java -jar start.jar) rather than the mvn jetty plugin?
Hide
Armi Lyn B. Manlosa added a comment - 26/Jan/07 5:52 PM

Hi Jan. No, it doesn't. I tried running "java -jar start.jar etc/jetty.xml" as an external tool and pressing the red button in this case works fine in stopping the process.

Show
Armi Lyn B. Manlosa added a comment - 26/Jan/07 5:52 PM Hi Jan. No, it doesn't. I tried running "java -jar start.jar etc/jetty.xml" as an external tool and pressing the red button in this case works fine in stopping the process.
Hide
David Yu added a comment - 21/Oct/07 11:39 PM

The process doesnt stop when the red button was pressed. This is a windows issue since this works fine on a linux box.
Used Eclipse 3.3 and still the same result.

Show
David Yu added a comment - 21/Oct/07 11:39 PM The process doesnt stop when the red button was pressed. This is a windows issue since this works fine on a linux box. Used Eclipse 3.3 and still the same result.
Hide
Greg Wilkins added a comment - 28/Oct/07 7:22 PM

David,

can you use jstack or some other threaddump mechanism to work out where it is hanging?

Show
Greg Wilkins added a comment - 28/Oct/07 7:22 PM David, can you use jstack or some other threaddump mechanism to work out where it is hanging?
Hide
Allan G. Ramirez added a comment - 30/Oct/07 2:03 AM

I created a simple program in eclipse which only waits for keyboard input. I created a batch file and invoked it through the external tools of eclipse. I pressed the red button and checked the task manager. The java.exe is still there.

Therefore, it's an eclipse issue. Eclipse would simple execute the lines of the batch file. It has no reference to what program was invoked during the execution of the lines.

The terminate button works fine when you run a program using external tools that is if java.exe was set in the Location textbox and you provide the arguments.

The same with linux. Bash files won't work either.

I guess eclipse would store the program invoked to a stack and when terminate button was pressed, eclipse would end all those programs in the stack. If you use batch file, the batch program was stored and so eclipse would end the batch file not the java which was invoked by the batch file.

Show
Allan G. Ramirez added a comment - 30/Oct/07 2:03 AM I created a simple program in eclipse which only waits for keyboard input. I created a batch file and invoked it through the external tools of eclipse. I pressed the red button and checked the task manager. The java.exe is still there. Therefore, it's an eclipse issue. Eclipse would simple execute the lines of the batch file. It has no reference to what program was invoked during the execution of the lines. The terminate button works fine when you run a program using external tools that is if java.exe was set in the Location textbox and you provide the arguments. The same with linux. Bash files won't work either. I guess eclipse would store the program invoked to a stack and when terminate button was pressed, eclipse would end all those programs in the stack. If you use batch file, the batch program was stored and so eclipse would end the batch file not the java which was invoked by the batch file.
Hide
David Yu added a comment - 30/Oct/07 9:37 PM

This is not a jetty issue.
If using the eclipse red button:
Turns out that the process would not stop if the program(all java programs) is ran using a batch file.

Show
David Yu added a comment - 30/Oct/07 9:37 PM This is not a jetty issue. If using the eclipse red button: Turns out that the process would not stop if the program(all java programs) is ran using a batch file.
Hide
Jan Bartel added a comment - 27/Nov/07 10:12 PM

To clarify what is going on:

The behaviour of the Eclipse Console "stop" button is different under Windows and Linux.

The implementation of the "stop" button calls java.lang.Process.destory() to kill the process that was launched in the Console.
On Windows, the implementation of Process.destory() is a brutal kill which does not allow the jvm to run the shutdown hooks.
On Linux, the implementation of Process.destroy does allow for the jvm to run the shutdown hooks.

Furthermore, on Linux, the mvn shell script launches java with an exec, meaning that the running shell script process is replaced
by the jvm execution. Therefore, when Process.destory() is invoked by the "stop" button, the process that will be stopped is that of
the jvm. On Windows however, it seems that there is no exec, and so there is one process for the mvn batch file and another for
the jvm launched from it. Therefore, the Process.destroy() can only affect the mvn batch file process, leaving the jvm process
running. You will need to use the Task Manager to kill the child java process.

+ https://bugs.eclipse.org/bugs/show_bug.cgi?id=38016
+ https://bugs.eclipse.org/bugs/show_bug.cgi?id=55208
+ http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4485742

regards
Jan

Show
Jan Bartel added a comment - 27/Nov/07 10:12 PM To clarify what is going on: The behaviour of the Eclipse Console "stop" button is different under Windows and Linux. The implementation of the "stop" button calls java.lang.Process.destory() to kill the process that was launched in the Console. On Windows, the implementation of Process.destory() is a brutal kill which does not allow the jvm to run the shutdown hooks. On Linux, the implementation of Process.destroy does allow for the jvm to run the shutdown hooks. Furthermore, on Linux, the mvn shell script launches java with an exec, meaning that the running shell script process is replaced by the jvm execution. Therefore, when Process.destory() is invoked by the "stop" button, the process that will be stopped is that of the jvm. On Windows however, it seems that there is no exec, and so there is one process for the mvn batch file and another for the jvm launched from it. Therefore, the Process.destroy() can only affect the mvn batch file process, leaving the jvm process running. You will need to use the Task Manager to kill the child java process. + https://bugs.eclipse.org/bugs/show_bug.cgi?id=38016 + https://bugs.eclipse.org/bugs/show_bug.cgi?id=55208 + http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4485742 regards Jan
Hide
Jan Bartel added a comment - 28/Nov/07 1:51 AM

Given my previous comments, it is clear that there is no solution possible on windows that will make the Stop button work until Eclipse changes the implementation.

To stop Jetty when running via Maven inside Eclipse on Windows, you need to go to the Task Manager and kill the java process.

Alternatively, we've implemented a new Maven target:

mvn jetty:stop

If you invoke this from a different window, then the maven jetty plugin running inside Eclipse will shutdown nicely and cleanly.

This is available in svn head, and will be scheduled for 6.1.7rc0.

regards
Jan

Show
Jan Bartel added a comment - 28/Nov/07 1:51 AM Given my previous comments, it is clear that there is no solution possible on windows that will make the Stop button work until Eclipse changes the implementation. To stop Jetty when running via Maven inside Eclipse on Windows, you need to go to the Task Manager and kill the java process. Alternatively, we've implemented a new Maven target: mvn jetty:stop If you invoke this from a different window, then the maven jetty plugin running inside Eclipse will shutdown nicely and cleanly. This is available in svn head, and will be scheduled for 6.1.7rc0. regards Jan

People

Dates

  • Created:
    05/Jan/07 6:21 AM
    Updated:
    28/Nov/07 1:51 AM
    Resolved:
    28/Nov/07 1:51 AM

Time Tracking

Estimated:
Not Specified
Original Estimate - Not Specified
Remaining:
0m
Remaining Estimate - 0 minutes
Logged:
5h
Time Spent - 5 hours