Netbeans and Grails - stop server - grails

What is the correct way to stop the web server for Grails in the Netbeans IDE?
After I Run Project (F6), I have been just rebuilding the project to do this. Is there a better way?

If you look under the output tab you can find the task labelled (run-app) and select the Stop icon (a Red Square with a White dot at the center) to stop the application.

This is not true. Type in your terminal "ps aux | grep grails" then you will see a number associated with the app and type "kill -9 (then the number)" and it will stop all process

There is no special Grails command to stop a running server, so just use whatever Netbeans provides to stop a project that was started from inside the IDE

Related

Why does Erlang run configuration in Eclipse IDE stop at 57%?

I am starting out Erlang in Win 7 64 bit box and I was able to use Erlang IDE just fine and since I am used to Eclipse I wanted to use Erlide with Eclipse. I am following running project document on erlide I was able to follow along. (Except step 41, Where it is talking about adding something to 'Main tab' and in my case it shows as 'Erlang', but options they are same) When I run the 'new configuration' on the HelloWorld example it runs and stuck at 57%.
I did install Erlang on my PC and installed it in a directory without space and it does shows up on my installed runtime in Eclipse.
When I run I do not see 'Eclipse IDE' like I saw when I was running Scala IDE in eclipse.
I did enter a dummy cookie name just in case if that is the problem
I tried running 'erl -name foo' to make sure node is able to run and it did.
Is there anything I need to check?
Thanks
Try first this:
* delete the configuration you created
* open a file in your project, right-click in it and choose Run as -> Erlang application
This will create a configuration that should work. You should see a console opening, where you can interact with the Erlang node.
If that is not happening, please go to window->preferences->erlang->report problem and create a report. Attach it to an issue at https://github.com/erlide/erlide/issues or send it to erlide_bugs#lists.sourceforge.net
I have the same problem on Win 7 - 64bit.
Problem: After some very first times build and run successfully, then eclipse couldnt run anymore. Restart Eclipse won't help.
Solution: Restarting the computer, and plz remember to Build Project before running it.

Grails 2.3 & GGTS 3.4 stop button not working

How to stop grails processes in GGTS 3.4 with grails 2.3. the stop button of GGTS is not stopping the server running and the java.exe processes are still showing in task manager.
Comment the grails.project.fork = [ .. ] part of your BuildConfig.groovy file.
This part enables running run-app, test-app and war in different threads(so you don't have to stop one to start the other), and it seems ggts isn't successfully destroying the thread right now.
For reference, here is the related issue in the ggts bug tracker https://issuetracker.springsource.com/browse/STS-3522
Can you try to disable the "Keep external Grails running" option in Eclipse Preferences -> Groovy -> Grails -> Grails Launcher?
Unchecking the "Keep external Grails running" does not work for me. What I do is to hit the "Grails Command History" icon and type "stopApp" (or pick stopApp if previously typed). Once this commands finishes executing, then you can stop the Grails application using the stop button.
Using Groovy Grails Tool Suite GGTS 3.4.0 on windows 64x. For my simple projects, the stop button works. For a bigger complex project, it does not. I use the "stop-app" (opposite of "run-app"). See: 2.8 Running an Application in the getting started guide. I think that in older versions of Grails ( < 2.x something) you had to create your own "stop-app" script. I think the newer 2.3.x has it built in.
I am using GGTS 3.5.1, Grails 2.3.8, Java1.7 over Windows configuration the command is works for me "stop-app" and "run-app"

conemu and console2 emulators not getting new path variable

I thought maybe it was a system issue but recently did a fresh install (win7 64bit) and a clean install of conemu (had same problem with both conemu and console2 on old win32 system). Also everything I find researching has to do with adding variables via the command line. I'm doing this through Start->Control Panel->System->Advanced System Settings and then restarting the console. cmd picks up the path correctly.
When I manually add a new path to the system or user PATH variable and then restart the console and echo %path% it has not re-loaded the new PATH variable.
cmd.exe:
C:\Users\lotus>echo %path%
C:\Python33\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\
System32\WindowsPowerShell\v1.0\;C:\Program Files\nodejs\;C:\PHP;C:\ProgramData\
Composer\bin;C:\PHP;C:\PHP\ext;C:\Ruby200-x64\bin;C:\Users\lotus\AppData\Roaming
\npm
conemu:
C:\Program Files\ConEmu>echo %path%
C:\Program Files\ConEmu\ConEmu;C:\Program Files\ConEmu;C:\Python33\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Ruby200-x64\bin
I know there is a extra C:\PHP but that's another issue. I still have the same problem if I remove that.
Thanks
When you are using alternative tab based terminals like ConEmu or Console2, you need to restart the terminal, not a single console (read tab)!
This is because child processes inherit their environment their direct parent process, not from the system!
Sometimes explorer (or whatever shell you are using to start ConEmu) needs to be restarted, as in you have to kill explorer.exe, so your start menu disappears and relaunch it from task manager. If all else fails, log off and on again.
Even if ConEmu is closed, there is a ConEmu64.exe process. Need to kill it.

Eclipse freezes when erlide tries to run

I'm just getting started with erlide, using a fresh install of Eclipse Juno and erlide. I've used erlang on my system (64-bit Fedora) from the command-line, so I'm just trying to make the switch. I started with R15B, and have upgraded to R15B02 (built from source) as suggested by another SO post. If I right-click on a .erl file and pick Run As..Erlang Application, the IDE freezes and I have to kill it. If I try to run from Run Configurations and specify the module and function, it will start to execute, but never progresses beyond 27%. This is on a simple function that runs instantaneously on the command line.
Please try with the latest nightly from http://erlide.org/update_nightly, we did some work about similar issues, I hope they will solve yours too.
It would help to see the log from /erlide.log.
You can also open the launch configuration from run->configurations and see if there is some weird value in any of the fields in the "runtime" tab, most probably the node host name.
[I will be away for a week or so, so I can't answer very soon. Sorry about that.]
/Vlad

How to use command to shutdown grails run-app

After executing grails run-app, except using Ctrl + C", is there a command to shutdown it?
For Stop Server
Exit from the terminal and use any one from the commands below:
grails exit
grails stop-app
grails quit
No. grails run-app is intended to be run for development, interactively.
If you want to control grails as a service, you should deploy it to a web application container such as tomcat. The tomcat plugin allows you to easily deploy your app to tomcat, for example. Add lines like
tomcat.deploy.username="manager"
tomcat.deploy.password="secret"
tomcat.deploy.url="http://myserver.com/manager"
to Config.groovy and then you can use
grails tomcat deploy
grails tomcat undeploy
to start and stop your application. Alternatively, you can use grails war to bundle your app into a war archive which all java app servers should be able to use.
If you really want to stop grails run-app without Ctrl+C, write a small controller that calls System.exit(0). Then browse to that URL, or write a small shell script or batch file that invokes it with e.g. wget or curl.
Open a new command line window, go to the project directory and type:
grails stop-app
This will stop the application if it is running in forked mode.
You can then go to the same URL and see that the page won't be displayed, i.e., the server has been stopped as it will be specified also when the command executes.
grails exit
This will stop the application if running in non-forked mode, otherwise it will quit the console.
grails quit
Exits the console.
in Grails 2.3.3, running 'grails dev run-app' on the command line leaves the command window in a kind-of limbo. It does not give you back the command prompt, Ctrl-C does nothing, and you have to revert to killing the processes by hand.
It is much more pleasant to follow the intended usage, as follows:
On the command line, enter the command 'grails' and hit return (notice no parameters are given). This starts grails itself, (and only grails, i.e. it does not start your server or app). This results in one new java process. It also gives you back the grails prompt, so you are still in control.
1.1 At the grails prompt, you can start your server (and app), by typing 'run-app'. This starts your server (in dev mode), and again gives you back the grails prompt. With your server running, you now have two java processes running, one for grails, and the other for your server and app.
1.2 If you want to stop your server (and app), you can, at the grails prompt, enter 'stop-app', which will stop the server and app. Also, you get your grails prompt back. After stopping your server/app, you will be back to having just one java process running, i.e. grails.
1.3 At the grails prompt, you can start and stop your app as many times as you like.
1.4 To stop grails itself, at the grails prompt, you can enter 'exit' or 'quit', and then grails will quit, and leave you back with the normal command prompt. At this point, the grails java process should be gone too, so there should be no java processes running.
I believe all of grails 2.3.x behaves like this.
My system is windows 7.
Hope this helps.
Noel
In Grails 2.1.0, a simple "exit" stops the server
I found a neat way that works on Grails 2.0.1 for me.
This is a hack that uses a hack put in GrailsRun.groovy for shutting down servers after running functional tests. (see line 246)
Create a file in the application basedir named .kill-run-app
When Grails sees the .kill-run-app file, it issues a grailsServer.stop(). It also conveniently deletes the file. This may depend on having autoRecompile on. I'm not sure, like I said this is a hack.
One day it will most likely cease to work when the GrailsRun.groovy script is changed.
I created a simple Ant target to do this. Granted you will need another terminal to execute it (actually I run it from Eclipse).
<target name="kill-app" description="--> Kills Grails web application" depends="">
<touch file="${basedir}/.kill-run-app"/>
</target>
Quick way is to kill the java process:
ps -aux | grep grails
kill "proess ID from above that is container to your application"
I'm new to Grails and I also had this "problem". I wrote a little script (called grill ;-)) that kills all the grails-processes.
#!/bin/bash
for P in $(ps aux | grep grails | grep java | awk '{print $2};'); do
kill -9 $P
done
exit 0
I had same problem to stop my running grails server. I did
ps aux | grep grails --> that gave me the PID
kill -9 PID
That way I was able to stop my running server. Hope that helps.

Resources