How to kill Tomcat when running it from Eclipse? - eclipse

I am running the Tomcat that gets delivered with your Eclipse download (no, I don't want to download and install the entire Tomcat), and sometimes it hangs when stopping or restarting, and the only way I can find to make it work is restarting all my Eclipse. I am using it under Windows.
Is there any way to kill the Tomcat process (which doesn't appear in the Task Manager)?

It appears as javaw.exe in task manager. An alternative is to execute Tomcat/bin/shutdown.bat.
As to the hang problem, are you sure that your webapp isn't spawning unmanaged threads which might be blocking Tomcat's shutdown?

On Windows, if you know the port Tomcat listens to (below, it is 8080), you can find the PID of the Tomcat process and then kill it from cmd:
> netstat -aon | find "8080"
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 2196
TCP [::]:8080 [::]:0 LISTENING 2196
> taskkill /pid 2196 /f
SUCCESS: The process with PID 2196 has been terminated.

I use better way to shutdown tomcat when it is not found in task manager.
1) Download TCPView(only 285kb) from following link.
http://technet.microsoft.com/en-in/sysinternals/bb897437.aspx
2) Extract folder and start TCPView application.
3) Right click on java.exe and select End Process option.
this would stop your tomcat easily.. This tool is very useful in monitoring port usage.
NOTE: Running TOMCATPATH/bin/shutdown.bat may not shutdown Tomcat when it contains some demon or unmanaged
threads. In such cases TCPView works fine without any issues.

You can set a timeout on startup and shutdown for your Tomcat server in Eclipse. If these timeouts are exceeded, Eclipse will pop up a message asking you if you want to kill it, or keep waiting.
To set these, double-click the name of the server in your Servers tab. It'll open a window like this:
There's a Timeouts section on the right hand side. I set startup to a day (so I can debug startup without it timing out), and shutdown to 30 seconds to be generous (usually this can be very short, since most apps can survive a forced shutdown with no issues).

If you use Linux, try the following steps.
List Tomcat processes (e.g., ps aux | grep catalina)
Locate the strings that look like this: myname 2244 5.5 0.3 57020937 2110741 ? Sl Oct03 5160:01 /usr/lib/jvm/java-1.8.0-<...>/bin/java <...> org.apache.catalina.startup.Bootstrap start
Copy-paste everything between /usr/lib/jvm/<...> and <...>.Bootstrap
Add stop at the end of your command and run it
Essentially, you would take the very same command that was used by Eclipse to start Tomcat and modify the last argument to stop Tomcat.

Related

EDB Postgres server from local host Apache, Server is up and running The default Apache context is www in the Apache installation

I have been trying to get rid of postgresEDB apache HTTP server within my localhost and I am failing to do it. I have tried various options, including:
netstat -ano|findstr :8080
and
taskkill /pid number /F
but failed, as everytime I re-start system and type localhost, this pops up.
I've uninstalled EnterpriseDB and PostgreSQL, but still no luck.
I have the same issue, and stopping PEM HTTPD works form me.
go to "run" then "services.msc"
find a service called "PEM HTTPD", description Apache/2.4.39 (Win32)
right-click and select stop or disable the service.
Note: The process that runs on port 8080 was httpd. I used resmon.exe to find out about the process.
How can you find out which process is listening on a port on Windows?
I know this is old, but I neeeded help with the same issue and the answer didn't work for me. What worked was:
go to "run" then "services.msc"
find a service called "pgbouncer", the description says it is a "lightweight connection pooler for postgres"
right-click and select stop
if you needed the localhost:8080 all the time perhaps you could change the startup type to disabled too. but for a one time use, stopping it works.
I am running windows on bootcamp on a macbook, hope this helps.
I know this thread is old, but I thought I'd throw the answer out there in case this is the first page anyone hits (as was the case with me).
On Windows you can kill this task through the Services applet.
Go to "Run"
Type "services.msc"
In the Services app, look for the following lines:
EnterpriseDB ApacheHTTPD
EnterPriseDB ApachePHP
Double click on each service.
Change "Startup type:" to "Disabled"
Click "Stop"
Click "Apply"
Repeat for the other service
This will ensure that you won't have to contend with the service popping up every time you restart your PC.
This information is available on the EDBPostgres site as well https://www.enterprisedb.com/docs/en/6.0.2/peminstguide/installation_guide.1.30.html
Hope this helps someone!

How to forcefully stop websphere liberty server in windows 7

Suddenly Websphere server is automatically started.
I stop many times but started again automatically.
Even I removed project from the web sphere and removed websphere from the project and Again add for the same.. But still I it is starting.
I also run the below command,
Server stop server_name
below Message is showing
Stopping server server_name
So it is not stoping. How to stop forcefully? or Kill existing process?
Your question doesn't state what OS you're running on, but Liberty doesn't currently ship with any means to automatically start the server (like a Windows service), so when you say "started again automatically", it is more likely that the server is never shutdown. Liberty runs as a process that can be killed and the process id can be determined by looking at the messages.log file in the server logs directory. The preamble of the file will contain a line like this:
process = 11488#YourHostName
Depending on the OS you're running on, you can use the kill command (Linux or MacOS), or the Windows Task manager to end the process. When you restart the server, you may want to specify the --clean option like this:
server start defaultServer --clean

Exception when I try to run a liferay portlet on my tomcat server

This is what I get:
Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 8099; nested exception is: java.net.BindException: Address already in use: JVM_Bind.
I have to mention that I use liferay 7.0 ga3 and tomcat 8.0.32, my ide is eclipse luna.
I tried to run in command line start rmiregistry some_port, but it didn't do nothing, just popped up a window and did effectively nothing.
Thank you!
Tomcat uses port 8099 for JMX communication (which is crucial for debugging). There is already another process using this port. Here are some possibilities:
In general, it is more practical just to finish the other process. A LOT OF TIMES, the other process is Spotify. Are you using Spotify? If so, just finish it, start Liferay and then reopen Spotify. Annoying but straightforward.
You started another Tomcat bundle. In this case, you only have to shut it down.
A previous Liferay execution just crashed and let a rogue Java process listening on the port. In this case, go to the terminal and execute jps:
$ jps
28058 org.eclipse.equinox.launcher_1.3.200.v20160318-1642.jar
1787 Bootstrap
14207 Jps
Kill the process that is labeled Bootstrap:
$ kill -9 1787
Technically, you could change the port on Tomcat. Open the server configuration, click on "Open Launch Configuration." Then, go to the "Arguments" tab and look for 8099. Basically, follow the GIF below:
However, I do not know all the consequences of it. I used to do it with Tomcat servers without LDS, not sure what problems it could bring with LDS.
Please check whether the shutdown port mentioned in the server.xml file under liferay-dxp-(version)-ga1\tomcat-(version)\conf folder.
Use the below command to find the ports running in your windows machine:
netstat /nao | findstr "80"
then change the shutdown port to any available ports, say 8010:
<Server port="8010" shutdown="SHUTDOWN">
restart the server.
Please try this step if the shutdown port is already in use.

server restart daemon cannot bind socket, address already in use, manual restart daemon ok

in Solaris 10, when server restart, the backup daemon (tina_daemon) does not work properly when calling for another executable to shutdown the application services.
however, when manually restart the backup daemon, the calling for the executable works fine.
I found the following lines in the log-file:
8|9|tina_daemon|780|1|3|1373964994|1373964994|10739|tina_daemon_1|<host name deleted>|~|root|~|backup_poc_tina|backup-poc|Event handler daemon started|0|~|~|~|~|~|~|
8|9|tina_daemon|880|256|3|1373964994|1373964994|10739|tina_daemon_1|<host name deleted>|~|root|~|backup_poc_tina|backup-poc|Service opened, host "<host name deleted>", Time Navigator Enterprise Edition Version 4.2.8.8 P4680|0|~|~|~|~|~|~|
8|14|TNUnixSocketImpl::initNetServiceTcp|11|1|1|1373965001|1373965001|10963|tina_daemon_1|<host name deleted>|~|root|~|backup_poc_tina|backup-poc|Unable to bind 5 socket, retos=125 "Address already in use"|0|~|~|~|~|~|~|
8|14|vos_init_net_service_tcp|1|1|4|1373965001|1373965001|10963|tina_daemon_1|<host name deleted>|~|root|~|backup_poc_tina|backup-poc|Unable to initialize network service of TCP type, retex=TN_ERR_CONFLICT_RESS (conflict in access to the same resource)|0|~|~|~|~|~|~|
is it a potential that not enough share memory? since the tina_daemon use 2 ports which already define in the /etc/services
I feel very weird since when manually using root to restart the tina_daemon, everything works fine. When server restart with the startup script (which i changed to similar to manul restart), it does not work well for calling another executable to shutdown the application. It shutdown the application half way, and cause the application hang (and ultimate need to restart the application)

Apache tomcat start up failure

I have been working with netbeans...til yesterday night it worked but now i couldnt run even a simple code its showing the following comments in the output screen
init:
deps-module-jar:
deps-ear-jar:
deps-jar:
library-inclusion-in-archive:
library-inclusion-in-manifest:
compile:
compile-jsps:
Starting of Tomcat failed, the server port 8084 is already in use.
D:\Dhivya\Job\calculator\payodaproject\nbproject\build-impl.xml:683: Deployment error:
Starting of Tomcat failed, the server port 8084 is already in use.
See the server log for details.
BUILD FAILED (total time: 3 seconds)
how to recover from this
First this isn't a constructive question as there is obvious lack of research. You didn't mention whether you tried to find out if any process was using port 8084. You may use netstat command to figure that out.
This usually happens when there is a Tomcat process already running and for whatever reason Netbeans is not able to see it, and tries to start another. You have to kill the Tomcat process manually, then Netbeans will be able to start it again.
It's a netbeans bug for port 8084 and there are few ways to resolve it. One is to remove tcnative-1.dll from the apache-tomcat/bin folder in your installation. For more you can visit netbeans-bugzilla.