I noticed that if I set another port number instead of the default one in derby (1527) in the derby.properties with for instance:
derby.drda.portNumber=1528
It will then correctly start up the server on that new port but unfortunately when calling stop script it will still attempt to kill something on the default port and leaving the derby alive. Is that a bug or is there something else that needs to be addressed in the properties file to make it work?
You are probably looking for the -p portnumber argument to stopNetworkServer: http://db.apache.org/derby/docs/10.13/adminguide/tadminconfigshuttingdownthenetworkserver.html
Related
This question already has answers here:
How do I kill the process currently using a port on localhost in Windows? [closed]
(28 answers)
Closed 3 years ago.
I'm using embedded Tomcat server in Spring Tool Suite IDE. My problem is when I run my project there is an error as follows,
***************************
APPLICATION FAILED TO START
***************************
Description:
The Tomcat connector configured to listen on port 8080 failed to start. The port may already be in use or the connector may be misconfigured.
Action:
Verify the connector's configuration, identify and stop any process that's listening on port 8080, or configure this application to listen on another port.
There are some similar questions but none of the answers not working for me.
Solution 1: Kill Process
Run command-line as an Administrator
netstat -ano | findstr :<yourPortNumber>
taskkill /PID <typeyourPIDhere> /F
Solution 2: Change Port
Please Make sure that new port you are going to set for your Application doesn't listen to any other process
Change the port
server.port=8088 # Server HTTP port.
Solution 3:
Another way is to terminate the process (in IDE) and clean and rebuild project.
UPDATE:
For solution 2, Please Make sure that new port you are going to set for your Application doesn't listen to any other process.
How to check Port Status?
Option 1
Run resmon.exe and go to Network -> Listening Port (Also can be viewed on TaskManager)
Option 2
PowerShell
Get-Process -Id (Get-NetTCPConnection -LocalPort portNumber).OwningProcess
cmd
C:\> netstat -a -b
(Add -n to stop it trying to resolve hostnames, which will make it a lot faster.)
-a Displays all connections and listening ports.
-b Displays the executable involved in creating each connection or listening port. In some cases, well-known executables host multiple independent components, and in these cases, the sequence of components involved in creating the connection or listening port is displayed. In this case, the executable name is in [] at the bottom, on top is the component it called, and so forth until TCP/IP was reached. Note that this option can be time-consuming and will fail unless you have sufficient permissions.
-n Displays addresses and port numbers in numerical form.
-o Displays the owning process ID associated with each connection.
I found that the answer by PatelRomil didn't work for me. I found that by running:
netstat -a -o -n
And getting the PID for the port, and then running:
taskkill /F /PID [PID]
Worked for me. Replace [PID] with the value in the table from the previous command.
Is there a way to assign a custom name to a process started using the command below
~lein run
The process stared by the above command is as displayed below -
~lsof -i tcp:8082
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 96029 <username> 89u IPv6 0xa04954e1ea972891 0t0 TCP *:us-cli (LISTEN)
It's possible though it gets a bit ugly and likely not worth the trouble
You would need to make a symlink to java with an alternate name, and modify lein to call that instead of calling java. You could do this by writing a lein plugin for instance. When Linux starts a process the name of the process it uses the name of the file from which the process was run as the name of the process thereafter, so you need to change the name of the file that gets run to create the process that will open the port, in this case "java".
If all you needed was an easy way to find either the process that opened the port or it's parent process then you could just make a script with a good name that called lein run. This would show up in the output from ps though not from lsof.
One of our application servers (Glassfish v3.0.1) keeps crushing down with no reason. Sometimes, I am away from Internet so I cannot run it back again. Therefore, I wrote a simple bash script to wait for 10 minutes and then run asadmin. It is like:
#!/bin/bash
while true;
do sleep 600;
sudo /home/ismetb/glassfishv3.0.1/glassfish/bin/asadmin start-domain;
done
This seems to work fine however I have a couple of problems:
If I terminate the bash script (by pressing ctrl+z buttons), the Java process (Glassfish) dies and start-domain and stop-domain commands do not work at all. That means, I can neither stop Glassfish nor can I access it. I do not know if anybody else experienced this problem before or not. If the process dies, only thing I can do is to look for the ID of Java process and kill it from terminal. This not desirable at all. Any ideas why Java process dies when I quit script?
What I want to add to my script is something like to check the port Glassfish is using. If port is occupied maybe I can assume that Glassfish is not down! (However, the port (8080 default) might still be used by Glassfish although Glassfish is dead, I am not sure of it). If not, then with the help of a simple code, I can get the id of the Java process and kill them all. Then start-domain command will successfully work. Any ideas or any directions on how I can do this?
You can use a cron job instead. To install a cron job for root, enter
sudo crontab -e
and add this line
*/10 * * * * /home/ismetb/glassfishv3.0.1/glassfish/bin/asadmin start-domain
This will run asadmin every ten minutes.
If you're not comfortable with the command line, you might also try gnome-schedule, but I have no experience with that.
For your second problem, you can use curl or wget to access glassfish. You can try to get some URL, or even access the administration interface, and if you don't get a response, assume glassfish is down.
I run a local server using Thin server. When it starts successively, it returns a message like this:
>> Thin web server (v1.3.1 codename Triple Espresso)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop
I want to run a web browser right after the server starts successfully. I feel that it should be possible to catch the message from thin using some kind of pipe, and starting a web browser as soon as that message is received, but am not sure about the details. How can I do that? The code for starting Thin is something like:
Rack::Handler::Thin.run(...)
so I think that piece of code should be embedded somehow in a pipe.
In your shell, type the following:
alias thin='/usr/bin/thin && firefox http://localhost:3000/ &'
(Or, whatever the path to the thin server is.)
Now, from that shell, type thin and your server will start and once it succeeds, firefox will start.
If you like this, add this to your shell's startup files, such as ~/.bashrc. (The startup files can be complicated; see the bash(1) manpage for full details.)
I have a bash script that tests whether the sftp connection exists, very simple one:
$ if [ -d ~/.gvfs/sftp for username on 192.168.1.101 ]; then echo "sftp missing" exit; fi
Now heres the question:
How do I make the script reestablish the previously connected sftp that still has a cached pass to reconnect without having it depend on if the bash script is on?
Since I have a bookmarked sftp thing in nautilus, i just point and click, presto its reconnected. I need the same for my script which will TERMINATE in a couple of lines; in other words the script only reconnects nautilus and dies, connection stays open...
I am still noobish at sftp, besides connecting...
Extra info: I use Ubuntu for both client and server, and i dont mind entering the ssh pass again if its new conection, any help is appreciated :D
Its critical that sftp wont d/c, or die, when i close script, or it ends, nohup cant be used for script since it will be run >10 times per day
Thanks!
Okay, some research done. You are using the GVFS (GNOME Virtual File System), and are looking with a none-GNOME application (bash) on the FUSE mount point of one of the URIs.
I think you can use the gvfs-mount command to reconnect, if you know the SFTP URL, but I didn't really find much documentation about this.