Glassfish runs in the background
The Glassfish Server is running in the background and I cannot stop, start, or restart the process. I know restarting the system will do the job. Is there another process to stop the process?
Here are the details:
-  When I try to stop, it says that 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 completed successfully.
-  However, I can open the admin console in a web browser for http: // localhost: 4848 / common / index.jsf 
-  When I try to start or restart, it throws an error: C: \ Server \ glassfish4 \ glassfish \ bin> asadmin start-domain There is a process already using admin port 4848 - this is probably another instance of the GlassFish server. Failed to execute start-domain command. C: \ Server \ glassfish4 \ glassfish \ bin> asadmin restart-domain Server - this doesn't work, will try to start it ... There is already a process using admin port 4848 - this is probably another example GlassFish Server. Domain restart failed. 
-  I tried to find the PID with the command netstat -a -n -o
 
 for port 4848. I have two entries, but not the localhost id:TCP 0.0.0.0:4848 0.0.0.0:0 LISTENING 9116 TCP [::]:4848 [::]:0 LISTENING 9116
 
 
try it
taskkill /F /PID 9116
      
        
        
        
      
    Also find the PIDs of the processes that are holding port 8080
      
        
        
        
      
    and killing them. (If above solution doesn't work)
netstat -aon | find "LISTENING" | find ":8080"
taskkill /F /PID port_no_here
      
        
        
        
      
    If you are using Mac OS, you should open a terminal and write the following:
jps
      
        
        
        
      
    (jps is a command to help you see the PID of this GlassFish process) in my case, I have the 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}
      
        
        
        
      
    What all.