Restart PlayConsole SBT server - scala

I'm running a scala playframework app using sbt run on intellij console. However, I exited the server using ctrl+Z instead of ctrl+D. Now, I try to sbt sbt run again, but I'm getting following exception:
java.net.BindException: Address already in use
The port is already in use. That means, previous server did not exited. If I try sbt run with different port sbt run 9999 other than default 9000, the server starts without any exception.
So, is there any way to restart or end previous session so that I will not get any binding failed exception if I run the project again?

You have another process already on that port you are using. You need to kill it or use another port.
You can list the process that are using the port and then kill them
use lsof -i:portnumber(8080)
Then kill the process using that port kill PID
Hope this helps!

Related

Failed to bind Netty Server on /xxxx:20880, cause: Address already in use

When I try to use Dubbo-admin to view the visual interface and start the jar package, it shows that this address is occupied. 20880 is the default port of Dubbo, so I checked the port through "sudo lsof -i:20880", but there was no result. Running the jar package again after restart still shows that the address is occupied

Secure Socket Agent Proxies listener Error

I try to run the server for ssa by using ssaserver& command but I face this error on my server machine
from yesterday.
Error creating listening socket at [host name : port number] the network address may be in use.
I really don't know why it is showing this error and how can be the address in use.
My OS is RedHat7.
That is really happen because you maybe closed your terminal or logged out from current user account in RedHat.
To solve this issue you can use this command here:
ps -ef|grep ssaserver
Which will show you if the service ssaserver already in use and from this you can get the service id and child ids.
You can then kill the service id by using kill command:
kill #(serviceid)
Here is a link to show you how to use kill command: Link_1
But you can face this problem again and again so I think it will be fine if you will use nohup command to run the service you need.
Note: nohup is a command used to run a process(job) on a server and have it continue after you have logged out or otherwise lost connection to the server
Such as:
nohup ssaserver&
Here is extra link for nohup examples: Link_2

How can I launch postgres server headless (without terminal) on Windows?

Using Postgres 9.5 and the libpqxx c++ bindings, I want to launch a copy of postgres that is not installed on the users machine, but is instead packaged up in my application directory.
Currently, I am using pg_ctl.exe to start and stop the server, however when we do this, pg_ctl.exe seems to launch postgres.exe in a new terminal window.
I want it to launch postgres.exe in a headless state, but can't work out how.
I have tried enabling/disabling the logging collector, setting the logging method to a csv file (instead of stdout/stderr), and a couple of other logging related things, but I don't think the issue is the logging.
I have also tried running postgres.exe manually (without pg_ctl) and can get that to run headless by spawning it as a background process and redirecting the logs, but I would prefer to use the "pg_ctl start" api for the "wait for startup" (-w), and "timeout" (-t) options that it provides.
I believe you won't be able to do that with pg_ctl.
It is perfectly fine to start PostgreSQL directly through the server executable postgres.exe. Alternatively, you can use pg_ctl register to create a service and start the service.
In my use case, I was able to resolve the issue by running pg_ctl.exe using
CreateProcess, and providing the dwCreationFlags CREATE_NEW_PROCESS_GROUP | CREATE_NO_WINDOW.
I was originally using CREATE_NEW_PROCESS_GROUP | DETACHED_PROCESS, but DETACHED_PROCESS still allowed a postgres terminal to appear. This is because DETACHED_PROCESS will spawn the pg_ctl without a console, but any process that inherits stdin/stdout from pg_ctl will try to use it's console, and since there isn't one, one will be spawned. CREATE_NO_WINDOW however will launch the process with a conhost.exe, however the console will have no window. When the executables spawned by pg_ctl try to write to the terminal, they will successfully write to the console created by the conhost.exe which has no window.
I am now able to run pg_ctl from code with no console appearing.

How do I stop Apache/Tomcat server on localhost://8080?

I keep getting errors when trying to serve files locally. I am using Tomcat on port 8080.
When using Eclipse, I get the following error message:
Several ports (8080, 8009) required by Tomcat v8.0 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(s).
Question
How do I stop the server on port 8080 if I don't know which process started it?
Try to go with a web browser to:
localhost:8080 or 127.0.0.1:8080
and
localhost:8009 or 127.0.0.1:8009
There you could see which service is running on those ports.
Then it will be more simple to understand what you have to stop.
EDIT:
You could use a prompt and the command:
netstat -b
-b it will show the name of the executable running on a port.
For understanding how it works here a good explanation.

Having issue with Tomcat when I run in a eclipse

I am novice in java I have installed Tomcat and it runs fine in a browser but when I run in a eclipse its showing error like
Several ports (8005, 8282, 8009) required by Tomcat v7.0 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(s).
I would like to mention one thing I am not authorized to login with admin account I have tried lot to stop the already running stuff through command prompt and i followed this link Deployment error: Starting of tomcat fail
however I am getting the same error is there any way to solve this issue.
Thank You.
Some other process is using one or more of the ports needed by tomcat (8005, 8282, 8009). Probably an old instance of tomcat. Kill it, then try again.
You can run netstat -abn on windows or netstat -apn on Linux to figure out which process is listening to these ports.