I run Apache Tomcat 6 using NetBeans. When there is a failure in my code such as a NullPointerException tomcat fail and will not run any other request.
My problem is I cannot get tomcat to stop and I must restart the entire Netbeans IDE.
Any Ideas?
on Netbeans 6.9.1 (windows), on the left hand side you should see "Services" tab along with the other tabs like "Projects", "Files"... etc. Click on the "Services" tab. Click the "+" of "Servers". Everything that has the green triangle (play icon) means that service is running. Right click on "Apache Tomcat 6.X.XX" and choose "Stop".
Netbeans seems to struggle with controlling Tomcat generally, I've found. The more times the application is deployed, the more unstable Tomcat gets until I get a smilar problem to the one you described. On large applications it takes only one deployment.
My workaround involves undeploying the application through the Services tab in Netbeans (under Servers/Tomcat6/applicationContext), and then stopping the Tomcat instance, before every time you run your application.
If Netbeans can't undeploy the application, I direct my browser at the Tomcat manager web application (typically http://localhost:8080/manager/html) and undeploying it from there.
If Netbeans can't stop Tomcat, I kill the JVM that Tomcat is using (CTRL + ALT + DEL in Windows).
Using those three methods, I can avoid restarting Netbeans about 95% of the time. When I get super frustrated, I run my project using Jetty from the command line.
I don't know which Netbeans version you use, but to stop a running Tomcat instance, right-click the Tomcat project's node and choose Stop Tomcat from the pop-up menu.
Are you using the embedded Tomcat that comes with NetBeans?
I suggest you download and unzip Tomcat 6 locally, add it to NetBeans and use this for your web applications.
You can simply go to the services and find 'apache tomcat'. Right click and make it manual (so that it will not start automatically when you open your machine again). On the left panel stop the service. You can start it later when you need.
I'll have to double check, but when I run NB on Linux I'm fairly sure there's a small icon/window in the bottom right hand corner with an "x" to kill running processes (ie, stop the run). I'm not seeing it on the mac, but why not?
Maybe I'm misremembering, but killing tomcat is awkward as described here.