I am facing the error when launching the app i the emulator for the first time .emulator is from android not third party emulators
port 8632 error
Looks like the port is used by another process.
If you are using Windows, run the following command:
netstat -a -n -o
If you are using Linux, run the following command:
sudo ss -tulpn | grep :8632
And stop/kill the process ID that is using this port.
It looks like your port is occupied
you can run lsof -i:8632 to check what process is run on port 8632 and kill it kill -9 PID
or....restart your computer
Related
I have an issue where running sudo iscsiadm -m discovery -t st -p IP -l logs to dmesg across all terminals on the server.
The command is run from a java application, using:
Runtime.getRuntime().exec("/bin/bash", "-c", "sudo iscsiadm -m discovery -t st -p *IP* -l");
I have tried the following:
Apppending > /dev/null 2>&1 to the end of the iscsiadm discovery... command
Capturing input streams from the returned progress (process.getInputStream() and process.getErrorStream())
Appending > /dev/null 2>&1 to the software launching the Jar.
None of the above attempts prevent logging across all virtual terminals. The log starts [some_num.some_dec] LOG_MESSAGE which suggests it is outputting to dmesg? If this is true how do I prevent this? Currently it makes the system impossible to debug because it's printing over the terminal prompt.
Thanks
Issue fixed.
It turns out it was not iscsiadm logging to dmesg, it was the mount command afterwards because the blockdev did not exist.
I have modified my java code to try iscsiadm -m discovery... then run iscsiadm -m session to determine if the appropriate device has a connection or not prior to mounting.
i am running a springboot application in linux.To run this springboot we use below command.
java -jar sssup-SNAPSHOT.jar &
This spring boot application makes an endpoint available which is then used by other services.
Now when the new version of .jar is available i have to stop the current running .jar and again run the above mentioned command.
Here my question is how to stop the current running sssup-SNAPSHOT.jar ?
Since you are running the process in the background you need to find its process first to kill it.
To find the process ID fire below command:
ps -ef | grep "sssup-SNAPSHOT.jar"
The output will look something like below:
502 5980 5964 0 10:40AM ttys000
Your second column is your process ID So, over here it is 5980. After copying that fire below command.
kill 5980
Just check again by firing ps -ef command that it gets killed or not. If it's not killed already than you can use -9 flag to force kill it. Like kill -9 <PID>
One way is to bring the background process to the foreground with the fg command and then press Ctrl+C. This will only work if you are in the same terminal where you ran the JAR file.
Another more reliable way is to use ps -a | grep java to find the process id of your app. Then you can do kill <PID> with that process id.
If you want to do maually then do below steps
1. open terminal
2. type JPS and enter
3. copy your application process id
4. sudo kill -9 application_id
If JPS is not avilable then
1. open terminal
2. type ps -a | grep sssup-SNAPSHOT.jar
3. copy you process id
4. do sudo kill -9 processid
If you want to do via Shell script use below
app_id=$(ps -ef | grep 'sssup-SNAPSHOT.jar' | grep -v 'grep' | awk '{ printf $2 }')
sudo kill $app_id
echo Killed Application and Starting New
nohup java -jar "sssup-SNAPSHOT.jar" &
You kind find the PID of the spring process and send a SIGTERM signal to it.
Find the PID (Here the PID is 12345)
$ ps -ef | grep sssup | awk '{print $2}'
12345
Send a kill signal (This will send the signal SIGTERM)
kill 12345
If the application handles the SIGTERM gracefully, you can force kill it by sending SIGKILL
kill -s SIGKILL 12345
### or
kill -9 12345
Signals are documented here
https://www.man7.org/linux/man-pages/man7/signal.7.html
You can list signals and their numbers by running
kill -l
EDIT: Onliner
ps -ef | grep "sssup-SNAPSHO[T]" | awk '{print $2}' | xargs kill
Spring boot print's the process id in the log (Number after INFO in log) then use command kill -9 pid
Note: 9 means the process will be killed by the kernel; this signal cannot be ignored.
I have a Spring Boot Java app running on Ubuntu 14.x using Oracle Java 1.8.0 that I want to debug remotely with IntelliJ. I have tried to get it to listen on a port for debug purposes but with no success. Note, the ports I tried are all well above the port 1024, to make sure it's not a permission problem. I am not root but I do have sudo access to the box.
I tried adding this to the java command line:
-agentlib:jdwp=transport=dt_socket,address=localhost:9009,server=y,suspend=y
A technique I got from this document:
http://javahowto.blogspot.com/2010/09/java-agentlibjdwp-for-attaching.html
However when I run this command:
sudo netstat -an | grep LISTEN
I don't see port 9009. Also, the app does not wait for debugger attachment as indicated by the "suspend=y" parameter, because I see the app initialization messages stream by as normal as the app starts up. Why isn't this working?
Here is the shell script that launches the app. Note, this shell script is launched by supervisord. I point this out in case that might be causing any trouble:
# !/bin/bash
# Shell script to launch Spring Boot app
# Kill subprocess when parent bash process is terminated by supervisor or when CTRL+C is received
trap 'kill -TERM $PID' TERM INT
java \
-Dnetworkaddress.cache.ttl=5 \
-Dnetworkaddress.cache.negative.ttl=5 \
\
-jar spbootapp.jar \
-agentlib:jdwp=transport=dt_socket,address=localhost:9009,server=y,suspend=y
--spring.application.name=spbootapp-awsdev \
--spring.profiles.active=cluster \
--spring.cloud.config.enabled=false \
--endpoints.configprops.enabled=false \
--endpoints.health.sensitive=false \
&
The debug parameters -agentlib:jdwp=transport=dt_socket,address=localhost:9009,server=y,suspend=y need to go before the -jar in the command.
Glassfish Server is running in background and I am not able to stop, start or restart the process. I know, restarting the system will do the job. Is there any other process to stop the process?
Here is the details:
When I try to stop, it says it is domain1 is not running:
C:\Server\glassfish4\glassfish\bin>asadmin stop-domain
CLI306: Warning - The server located at C:\Server\glassfish4\glassfish\domains\domain1 is not running.
Command stop-domain executed successfully.
However I am able to open admin console in web browser for http://localhost:4848/common/index.jsf
When I am trying to start or restart it throws error:
C:\Server\glassfish4\glassfish\bin>asadmin start-domain There is a
process already using the admin port 4848 -- it probably is another
instance of a GlassFish server. Command start-domain failed.
C:\Server\glassfish4\glassfish\bin>asadmin restart-domain Server is
not running, will attempt to start it... There is a process already
using the admin port 4848 -- it probably is another instance of a
GlassFish server. Command restart-domain failed.
I tried to find PID with netstat -a -n -o command for the port 4848. I got two entries but not localhost id:
TCP 0.0.0.0:4848 0.0.0.0:0 LISTENING 9116
TCP [::]:4848 [::]:0 LISTENING 9116
Try this
taskkill /F /PID 9116
Also find the PIDs of processes which hold port 8080 and kill them. (If above solution don't work)
netstat -aon | find "LISTENING" | find ":8080"
taskkill /F /PID process_id_here
If are you using Mac OS you should open terminal and will write following:
jps
(jps - is command that help you to see PID of this process of GlassFish)
in my case I have following information:
MBP-Dmytro:~ melnychukdv$ jps
4004 ASMain
4500 Jps
After that we just kill this PID (in my case it is 4004):
sudo kill -4004 {PID}
or
sudo kill 4004 {PID}
That's all.
I was trying to run the following instruction,
Process p = Runtime.getRuntime().exec("/system/bin/lsof|grep mediaserver");
In android(java) but I am getting error. if I run following instruction,
Process p = Runtime.getRuntime().exec("/system/bin/lsof ");
the file is successfully saved.Can anyone tell what is the error? Actually I want to list and check if media server service is being running or not.
The grep utility may not be installed on your device.
You can check it by trying the following in a console:
> adb shell
$ grep
grep: not found
The last line indicates that this command is not available.
The problem is that Runtime.getRuntime().exec(...) does not know how to deal with the shell language. On a Linux / Unix platform you would so something like this:
Process p = Runtime.getRuntime().exec(new String[]{
"/bin/sh", "-c", "/system/bin/lsof | grep mediaserver"});
However, (apparently) Android doesn't have a command shell / command prompt by default. So either you need to identify and install a suitable shell on your device, or construct the pipeline "by hand"; i.e. by creating a "pipe" file descriptor, and execing the two commands so that lsof writes to the pipe and grep reads from it.
Maybe the answer is to run it like this ...
Process p = Runtime.getRuntime().exec(
"adb shell /system/bin/lsof | grep mediaserver");
(Try running the "shell ...." part from adb interactively before doing it from Java.)