users@glassfish.java.net

Re: using asadmin to stop domain running on a specific port number

From: <modjklist_at_comcast.net>
Date: Tue, 3 Jul 2012 19:39:01 +0000 (UTC)

Thanks Tom,

I'm using GlassFish version 3.1.2.

When I type:

jps -v | grep 20037

I see the directory of my GlassFish install, as you mention below.

Thanks for connecting the "domain1" with the --port 4850 option. I understand now it's need for stopping (and restarting) the domain.

I'm not aware about the bug you refer to. So, I tried issuing:

kill -9 20037

then I typed:

asadmin>start-domain domain1

and it started successfully. Then I tried this:

asadmin>restart-domain --port 4850

and nothing gets returned (it just sits there; normally it takes 2-3 seconds to complete). This is what I observed earlier today, and may be related to a process hanging somewhere. The last line in the server.log file is "The Admin Console application is loaded", which occurred 5 minutes after entering the restart command above. But the linux command line for asadmin> appears hung, although I can control-C to get a command prompt again. Any idea what is going on?



----- Original Message -----
From: "Tom Mueller" <tom.mueller_at_oracle.com>
To: modjklist_at_comcast.net
Cc: users_at_glassfish.java.net
Sent: Tuesday, July 3, 2012 12:14:45 PM
Subject: Re: using asadmin to stop domain running on a specific port number

What version of GlassFish are you running?

To see what process 20037 is, you can do:

jps -v | grep 20037

This will show must of the Java command line that was used to start the process. Assuming it is a GlassFish process, you'll see an argument on that command line that looks like this: -Djavax.net.ssl.keyStore=/scratch/trm/test/glassfish3/glassfish/domains/domain1/config/keystore.jks
This will show what domain directory the process is running from. If this is the directory of your GlassFish install, then the list-domains output is either wrong due to a bug (that's why I asked about the version) or the process is hung in some way that it is not responding to the list-domains query for it's status.

If the process is hung, you might want to try a kill -9 to stop it.

The --port option is not needed for the start-domain command. The port number is only needed by restart-domain to stop the process (it tries a graceful shutdown by sending it a command to shut down).

WRT your question about the connection between domain1 and port 4850, the "domain1" argument to start-domain is the directory name within the domain directory. In that directory, start-domain looks for the config/domain.xml file, and in that file, it finds the port number (4850) to use when starting the process.

Tom

On 7/3/2012 1:57 PM, modjklist_at_comcast.net wrote:


(including list)

Thanks Tom, Here's what I get when I type what you suggested:

[root_at_host9 ~]# netstat -tulpn | grep 4850
tcp 0 0 :::4850 :::* LISTEN 20037/java

Not sure what it means. I know that I setup the GlassFish web administrators console to use port 4850 during installation (instead of default port 4848). So that should be what is using port 4850.

I'm confused though. For whatever reason, I've been using the following to start/stop/restart domain1 (showing restart for example):

adasmin> restart-domain --port 4850

and it has always worked fine. Today when I try it I get:

asadmin> start-domain --port 4850
There is a process already using the admin port 4850 -- it probably is another instance of a GlassFish server.
Command start-domain failed.
asadmin> start-domain domain1 --port 4850
There is a process already using the admin port 4850 -- it probably is another instance of a GlassFish server.
Command start-domain failed.

How would I start domain1?
What's the connection between domain1 and port 4850?



----- Original Message -----
From: "Tom Mueller" <tom.mueller_at_oracle.com>
To: users_at_glassfish.java.net
Cc: modjklist_at_comcast.net
Sent: Tuesday, July 3, 2012 11:44:58 AM
Subject: Re: using asadmin to stop domain running on a specific port number

The list-domains command will only identify domains in the domain
directory that it is operating on. By default, this is the
"glassfish/domains" directory in the install directory for the asadmin
command. However, there is a --domaindir option for list-domains that
allows specifying something else.

The process that you have running on port 4850 could be a GlassFish
server process from another domain that is in a non-default domains
directory, or it could be from a domain from another install of
GlassFish on the same host, or the process could be some completely
different process that happens to be using port 4850.

On Linux, you can use "netstat -tulpn" to find out what process is
listening on a port, i.e.:

$ netstat -tulpn | grep 4850

Tom


On 7/3/2012 1:21 PM, modjklist_at_comcast.net wrote:
> I am observing the following:
>
> asadmin> list-domains
> domain1 not running
> Command list-domains executed successfully.
> asadmin> start-domain domain1 --port 4850
> There is a process already using the admin port 4850 -- it probably is another instance of a GlassFish server.
> Command start-domain failed.
>
> Shouldn't the "list-domains" show running domains on port 4850? Or, more importantly, how do I stop whatever is running on port 4850, so I can start domain1 on that port?