How to Stop WSO2 ESB 4.0.3 - java

I have started the WSO2 ESB server with ./wso2server.sh , but there is no script to stop the server ?
Can anybody tell the command to stop the server ?
Thanks
Suresh

If you have started the server using ./wso2server.sh then you can stop the server by pressing Ctrl and c keys together on the console, it will simply kill the server.
If you have started using ./wso2server.sh --start or ./deamon.sh start then you can kill the server using the commands ./wso2server.sh --stop or ./deamon.sh stop.

./wso2server.sh --stop or ./daemon.sh stop

Generally, pressing CTRL + C in the terminal you started the server would do.
If it's not possible for you, then do the following.
Enter the command ps ax | grep wso2esb
This will list the set of processes started that has the text wso2esb. Unless you opened several esb instances, there will be one process that would like the following [1]. There, the first number refers to the process id.
So, enter following command to gracefully shutdown the esb.
kill <process-id>
You may force the shutdown by sending signal kill (-9) like follows if you need to.
kill -9 <process-id>
As you may have noticed, the kill command is a native program that comes with most linux distros, not a wso2 provided one.

To stop the server,
If you have started the server using ./wso2server.sh then you can stop the server by pressing Ctrl+C in the command window
If you have started using ./wso2server.sh --start then stop using ./wso2server.sh --stop
If you have started using ./deamon.sh start use ./deamon.sh stop
clicking the Shutdown/Restart link in the navigation pane in the Management Console works well for all..

On Management-Console, we can shutdown or Restart
On management console we can shutdown / Restart

This is an old thread... but I since I arrived here with the same question, I may as well post the answer I found for future users.
Another way to shut down the wso2 server is through the online admin console. Once the server is running, simply navigate in your browser to
https://localhost:9443/carbon
Log into the server's admin page using the default username and password, "admin" for both. Then scroll to the bottom of the page and select "shutdown/restart" and select "graceful shutdown" from the menu.

Related

How to programmatically detect port already in use in Tomcat webapp?

I supply my customers with my Tomcat webapp, which is configured to listen on port 80 and runs on their Windows PCs.
In some of their deployments, Microsoft's World Wide Web Publishing Service is already running unintentionally, which also listens on port 80. Thus when Tomcat and my webapp is launched, an Address already in use: JVM_Bind exception message is logged to the console, however it is scrolled off the screen by later startup messages and is thus unnoticed.
My Question: Is there some way to either
Configure the Tomcat server to stop under such circumstances, or
Code my webapp to detect this and stop? If my webapp could detect this, I would then log a message about what steps the user should take to kill the other program. Hopefully the message would remain visible on the console and not scroll off the screen.
netstat -a -o -n | findstr 0.0:80
taskkill /F /PID *pid*
While I have user documentation describing the problem and remedy, it's not usually handy. My thinking is that if this were the last message on the console, it may reduce the support call time.
Your application will start to be deployed into servlet container after IO (Http/Ajp connectors) is already started, so there is no way how you can do this from web application.
You can however wrap Tomcat startup script with batch file which will do that for you (and print meaningful error message, then wait for user to press enter).

Is there a way to be notified when a task started with nohup goes down?

I have a service developed in DropWizard. I run the fat jar on an AWS server with the nohup command like this.
nohup java -jar myapp-0.0.1-SNAPSHOT.jar server my-configure.yml > outfile &
This works fine.
However, yesterday I tried to use the app that makes use of the service and it wasn't working. When I logged into the server I realized that the service was no longer running. It had been running for couple of months without any issues. In the logs (outfile) I just see the following:
INFO [2014-11-13 19:48:31,978] org.eclipse.jetty.server.Server: Graceful shutdown SocketConnector#0.0.0.0:9001
INFO [2014-11-13 19:48:31,987] org.eclipse.jetty.server.Server: Graceful shutdown InstrumentedBlockingChannelConnector#0.0.0.0:9000
INFO [2014-11-13 19:48:31,988] org.eclipse.jetty.server.Server: Graceful shutdown o.e.j.s.ServletContextHandler{/,null}
INFO [2014-11-13 19:48:31,988] org.eclipse.jetty.server.Server: Graceful shutdown o.e.j.s.ServletContextHandler{/,null}
Question
How can I troubleshoot why the service stopped running?...could AWS server have been restarted?
Is there a better way to do this that is not prone to errors like these
Is there a way I can be notified when the service stopped running ...rather than checking it every so often...
Edit
Just checked uptime on the AWS server and it says up for 7 days. Which coincides with when the service went down. I guess the solution is to have the service start automatically on server restart.
You can look at the solution used here to give yourself a notification when the program shuts down.
It won't know it was called with nohup though, that's something for the shell. But a java solution might work for you.
Based on your edit, you might want to create an init.d script to start (and stop) your process:
a template for that can be found here.

Cannot start Apache Tomcat 6 from IntelliJ IDEA 12.1.4 Ultimate (Windows 7)

I need to debug a web application for Tomcat6 in IntelliJ IDEA.
When I try to run my web application, I get two errors:
Address localhost:1099 is already in use
Unable to open debugger port: java.net.SocketException
Launching the Apache Tomcat 6 service manually works fine.
What should I do in order to be able to debug web applications in Apache Tomcat 6 from Intellij IDEA?
Following the below steps work:-
Open command prompt and type the command netstat -ano
You will see a list of active TCP connections with PID as the last column
See the second column listing the local addresses and find the one using port 1099 from it and you'll get its PID
Now open your Task Manager, click the Process tab and get the PID column to display [either by right clicking on the heading row and selecting PID OR click View, and then click Select Columns and select PID.]
Now find the PID we got from Step3 and end the process.
Now you are good to go :)
I face this issue all the time. Here's how to fix it
LINUX
Open a terminal instance.
fuser 1099/tcp
This should return you a process ID.
1099/tcp: 31596
where 31596 is the process ID. Now you can either use the process ID to kill it or just bash the following -
fuser -k 1099/tcp
WINDOWS
Open a command prompt instance.
netstat -aon | find "1099"
This will return you an instance of the process.
output:
TCP 0.0.0.0:1099 0.0.0.0:0 LISTENING 15776
Here 15776 is the process ID. To kill this, enter -
taskkill /F /PID 15776
Cheers!
You can change the JMX port (1099 per default) in the Run/Debug Configuration dialog. Just try a different port number (i.e. 9099).
If you had the web application up and running before, there may be an old debug server that did not close down properly running in the background. See this post about how to find what process that uses port 1099. If it proves to be a java process, kill it.
How can you find out which process is listening on a port on Windows?
(If you use the GUI sw suggested in the link above, you may kill the process(es) by marking all java processes that uses port 1099, right click and press "End Process...")
As said before, there's an old debug server running in the background.
My solution was to close the Java process that was left open from the Windows Task Manager.
Please verify that you can close this process before doing so!
Change your http port to 8080(default for tomcat) and debug port to something that is not being used currently by any processes. You can use anything that is upwards of 1024, but since you are getting an error on 1099, try something that is greater that 6000.
Debugger setting can be found here
There might be other program or server running at the background. First close other server running in the background and then restart your server.
I found this answer helpful:
How can you find out which process is listening on a port on Windows?
I opened the resource monitor and looked for what was using the ports. Then opened task manager and ended those processes
What worked for me was. I assumed I would need to have the "Apache Tomcat" service running under "Services" [Windows + R >> services.msc]
I went and stopped the Tomcat service here. Then I came to my Java application and ran it in Intellij, which allowed me to run it.
Hope this helps!
Just close all other unnecessary servers while using InteliJ.
I stopped my WAMP in order to remove this error "Port is already in use".

how to stop a program running in the server?

I m doing a eclipse plugin project to create an IDE for a particular language.
For running i connect to the server and ask the user the command,type of connection...
After the program has started execution The only way to stop the execution of the program is by pressing "ctrl+C" when done in the command prompt.
I run the program by sending the server the following command:
"probevue filename.e >output.txt"
when i give this command it is running,but i m not able to stop the program...
i.e when i press Ctrl+C the program should stop execution.
How shall i do this?
Thanks in Advance.
after reading into this article about probevue it seems that you have started a dynamic session. i think the program you're calling is never terminating itself.
http://pic.dhe.ibm.com/infocenter/aix/v7r1/index.jsp?topic=%2Fcom.ibm.aix.cmds%2Fdoc%2Faixcmds4%2Fprobevue.htm
you should first read how to invoke a command properly. e.g. -> http://www.javalobby.org/java/forums/t53333.html
then you should think about how would you terminate the command if you wouldn't have the ctrl+c option, like finding out the process-id of the shell command you executed before (e.g.: ps -ef | grep ) and terminating it by using another shell command (e.g.: kill -9 )
hope this helps you find a solution.
Common eclipse server plugins like JBoss Tools call the server scripts that are delivered with the server for starting and stopping. Deployment/undeployment and starting/stopping of applications is done via the management port.
So either you have a manageable server to control your program, or you could work around the problem by writing the scripts yourself.

A problem occurred when I tried to run a java web-app on server

I use eclipse for java EE as my IDE and tomcat as my server. Here's the problem:
Several ports (8080, 8009) required by Tomcat v5.5 Server at localhost are already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number.
It is as the exception says - you have a running instance of Tomcat (or, less likely, something else), that's taking ports 8080 and/or 8009. What to do:
if you've started tomcat, find it and stop it: using /etc/init.d/tomcat stop, or administrative tools > services > apache tomcat > stop, or shutdown.sh / shutdown.bat
if it is not you, find the process of tomcat and kill it (task manager on windows, and something like ps ux on nix)
if you don't find it, reboot
It looks like you have a Tomcat running already. It is possible that Eclipse couldn't stop Tomcat and now that it tries to run it again, it can't. Find and kill the existing process or reboot.
Issue the tasklist command in command prompt.
It should display tomcat as one of the processes. You can kill it by issuing either taskkill /IM "image_name" or taskkill /PID "process_id"
Others have mentioned that you could try and track down what's using those ports (perhaps another instance of Tomcat?), and kill it. However it might be that Windows itself is using them.
Killing the rogue program, or rebooting, might cure the problem for now, but to prevent this happening again, you need to reserve the ports you need. KB812873 explains how to do this.
Disclaimer: This KB article is for Windows Server 2003 and Windows 2000, and it's a while since I had to do this (for a few Windows Server 2003 installations). However I imagine it's the same for Windows 7. If not, someone will correct me :-)
Several ports (8080, 8009) required by Tomcat v5.5 Server at localhost are already in use.
You are not required to run Tomcat on 8080 or 8009. I am using Eclipse 8.6. I have set my Tomcat port to 8086 for eg.
Here are the steps to do it:
Stop Tomcat.
Click on the Run/Stop/Restart dropdown button
Select MyEclipse Tomcat
Click Configure Connector
Change port to whichever one you think is free.
To make sure you see these options make sure you have the latest version of MyEclipse.

Categories