I have followed this guide:
When I run (using run file) the main class sprint boot fires up as expected (among other things it starts a Tomcat server in the background). That is I can access the URL and the netbeans console shows me the same as if I had run the program from the command line.
However, when I stop the program, using the red box with the white dot in it (Stop the currently executing build), NetBeans does not stop the Tomcat server that Spring boot has started in the background. If I terminate the program from a command line the tomcat server is killed.
The program with not killing the tomcat process is that the next execution of the file will tell me that the port is taken which is very annoying, because there is no other way to see the tomcat process from within netbeans.
Hi Kim, could you please share with me few additional information? What kind of project (Maven or Ant) are you creating? What version of Tomcat you used?
Ideally please try to find few simple steps that leads to reproduction of the problem.
I tried to use Tomcat 7.0.14 in combination with both Ant Web and Maven War projects and did something like this:
1. Create project with Tomcat 7 selected as app. server
2. Debug application (it started server and show index page in the browser automatically)
3. Stop debugging (using the red box with the white dot as you described ;))
4. Debug application again (it correctly start-up the application again and show index in the browser)
Could you correct me, what I'm doing differently than you? Thanks in advance!
I just created a java maven application (from the maven menu) - note not a Web project - and followed the spring boot documentation. I did Not configure a tomcat server in netbeans (spring boot grabs a tomcat and manages it all, but I think it is version 7 something).
The whole point of spring boot is that it makes it easy to run spring apps. Hence it starts and stops tomcat, or what other server you choose but tomcat is default.
Having created the pom and java controller described in the Quick guide, see link in first comment, I then ran the file as also described in comment one and experienced what I have described.
Please tell me if you need more info, I work with my computer tomorrow so I will be able to assist.
I have tested with build 201402160001 and jdk 8 and latest spring boot (CR2) and the bug is still there.
please do not raise priority of issue without appropriate reasoning. This is not a P2 issue with respect to the NetBeans priority guidelines .
I was partially able to reproduce your problem with following steps:
1/ Create simple project (jar packaging) as you described
2/ Paste pom configuration from Spring boot quick start page
3/ Create SampleController as described in quick start page
4/ Run the project
--> Now if I stop the project, everything is fine and the Tomcat is shutdown by Spring boot and I can modify sources and run the project again without any issue
5/ Turn off IDE (note that project was still running when the IDE was turned off)
6/ Turn the IDE on again
7/ Try to run project
8/ Server is occupied
The problem here is actually the fact that Spring boot is taking care of starting up and shutting down of the server. Because of that NetBeans can't really control what's going on with Tomcat server and if user don't manually stop running application Spring boot server shutdown is not called.
The workaround here is to stop running application before exiting NetBeans. One way how we could theoretically resolve this issue would be to run the same shutdown when the IDE is turned off as we are doing when user click to stop the application run manually.
BTW: This does not have anything in common with Web Projects, even the example project is not a EE project. But since we officially don't support Spring boot, I'm not sure where this issue belong too (it's not about Spring, it's not about Maven or Ant).
Created attachment 151222 [details]
Run action configuration for running spring-boot maven plugin in netbeans
This screen shot shows how to configure the "Run" action to successfully run spring-boot maven plugin from within netbeans.
I had the same problem. I could start the spring-boot maven project inside netbeans but when I killed the build it did not shutdown the embedded tomcat server.
I managed to change the "Run" action for my project to only execute the spring-boot maven plugin e.g. "spring-boot:run".
This is all you need in your "Run" action to successfully start the spring-boot app. Now when you click the red button to stop the process, it actually stops the embedded tomcat container too.
I have the same problem. If I run the SpringBoot main class using the netbeans run context menu, the project start normally. When I hit the red square button on the console window, the projects stop except the embedded Tomcat. To stop it I need to kill the process and after that I can run the project again.
Having same problem: launching web project with a few REST services configured worked fine until we introduced springboot. I have not yet tried configuring the run button to use the spring-boot goal, but wanted to know if there was any special configuration required to launch the debugger? Before it was just a matter of rightclick on project and debug, and everything launched, now i'm wondering if springboot need additional actions..
I am also seeing this issue since switching to Mac OS X without closing my IDE. I did not see this issue a month ago when I was using Windows and Linux with the same versions of Maven, NetBeans, and Spring Boot and I do not see this issue when I use IntelliJ.
When I run through the debugger, it will shut down properly if I use the red button from the "Debug" toolbar (i.e. "Finish Debugger Session"). But if I use the red button from the process output window it doesn't die properly. It has nothing to do with shutting down the IDE. This happens within the same IDE session.
My workaround solution is to set my "server.port" to 0 so my Spring Boot application will always pick a new port.
When I am ready to clean up the abandoned processes, I run `jps -l` from the terminal and kill them manually.
I have defined my run configurations exactly the same in IntelliJ. I have both NetBeans and IntelliJ using `mvn spring-boot:run`. IntelliJ properly shuts down my application, but NetBeans doesn't. I prefer the NetBeans development environment, but sometimes I confess I go to IntelliJ because I just don't want the hassle of having to manually kill my applications.
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.
Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss
this issue exist in netbeans 8.1 with my project https://github.com/mcheung63/quantr-server
i run my project by maven goal spring-boot:run, i can't stop it by clicking the stop button in output window