21
votes

I'm having trouble starting Glassfish 3.1 on a newly setup Debian "Squeeze" server. This is a testing server that has been setup and the Glassfish installation was copied from a working server to this other server.

I tried running:

# ./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.

I also tried restarting the domain because I thought maybe it was running:

# ./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.

At this point I confirmed that Glassfish was not running so I checked to see if port 4848 was occupied:

# netstat -aon | grep 4848

which returned nothing.

I have suspicion that Glassfish was copied from the source server while Glassfish was still running. Maybe there is some sort of pid file or lock file that was copied over as well.

Any suggestions on how to get Glassfish to start?

Edit

Here's the server.log file from domain1 after executing the asadmin start-domain command:

Sep 12, 2011 11:18:02 AM com.sun.enterprise.admin.launcher.GFLauncherLogger info
INFO: JVM invocation command line:
/opt/glassfish3/jdk/bin/java
-cp
/opt/glassfish3/glassfish/modules/glassfish.jar
-XX:+UnlockDiagnosticVMOptions
-XX:MaxPermSize=192m
-XX:NewRatio=2
-Xmx512m
-client
-javaagent:/opt/glassfish3/glassfish/lib/monitor/flashlight-agent.jar
-Dosgi.shell.telnet.maxconn=1
-Djdbc.drivers=org.apache.derby.jdbc.ClientDriver
-Dfelix.fileinstall.disableConfigSave=false
-Dfelix.fileinstall.dir=/opt/glassfish3/glassfish/modules/autostart/
-Djavax.net.ssl.keyStore=/opt/glassfish3/glassfish/domains/domain1/config/keystore.jks
-Dosgi.shell.telnet.port=6666
-Djava.security.policy=/opt/glassfish3/glassfish/domains/domain1/config/server.policy
-Dfelix.fileinstall.log.level=2
-Dfelix.fileinstall.poll=5000
-Dcom.sun.aas.instanceRoot=/opt/glassfish3/glassfish/domains/domain1
-Dosgi.shell.telnet.ip=127.0.0.1
-Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory
-Djava.endorsed.dirs=/opt/glassfish3/glassfish/modules/endorsed:/opt/glassfish3/glassfish/lib/endorsed
-Dcom.sun.aas.installRoot=/opt/glassfish3/glassfish
-Djava.ext.dirs=/opt/glassfish3/jdk/lib/ext:/opt/glassfish3/jdk/jre/lib/ext:/opt/glassfish3/glassfish/domains/domain1/lib/ext
-Dfelix.fileinstall.bundles.startTransient=true
-Dfelix.fileinstall.bundles.new.start=true
-Djavax.net.ssl.trustStore=/opt/glassfish3/glassfish/domains/domain1/config/cacerts.jks
-Dorg.glassfish.additionalOSGiBundlesToStart=org.apache.felix.shell,org.apache.felix.gogo.runtime,org.apache.felix.gogo.shell,org.apache.felix.gogo.command
-Dcom.sun.enterprise.security.httpsOutboundKeyAlias=s1as
-DANTLR_USE_DIRECT_CLASS_LOADING=true
-Djava.security.auth.login.config=/opt/glassfish3/glassfish/domains/domain1/config/login.conf
-Dgosh.args=--nointeractive
-Djava.library.path=/opt/glassfish3/glassfish/lib:/opt/glassfish3/jdk/jre/lib/amd64/server:/opt/glassfish3/jdk/jre/lib/amd64:/opt/glassfish3/jdk/lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
com.sun.enterprise.glassfish.bootstrap.ASMain
-domainname
domain1
-asadmin-args
--host,,,localhost,,,--port,,,4848,,,--secure=false,,,--terse=false,,,--echo=false,,,--interactive=true,,,start-domain,,,--verbose=false,,,--debug=false,,,--domaindir,,,/opt/glassfish3/glassfish/domains,,,domain1
-instancename
server
-verbose
false
-debug
false
-asadmin-classpath
/opt/glassfish3/glassfish/modules/admin-cli.jar
-asadmin-classname
com.sun.enterprise.admin.cli.AsadminMain
-upgrade
false
-type
DAS
-domaindir
/opt/glassfish3/glassfish/domains/domain1
-read-stdin
true
10
How did you install Glassfish?Andrew
is IPV6 activated on your host? You should also check the server.log file in the domain directory (often domain1/logs/server.log as it might contain more detailed info.fvu
@Andrew Someone else did the installation. I believe we installed Glassfish by downloading the a tar and extracting it to /opt/glassfish3 on the source server. This test server we copied the folder directly.Mark Bouchard
@fvu No IPv6 isn't enabled on the host. Thanks for the suggestion to look at the log. I posted it above. Nothing out of the ordinary that I can tell.Mark Bouchard
@Mark can you run jps and share the results?Preston

10 Answers

43
votes

First of all check the $HOSTNAME and the etc/hosts file configuration , not try to find a problem with ps aux or netstat -aon .

> echo $HOSTNAME

response > server (or etc)

> cat /etc/hosts

in response if you cannot see "$HOSTNAME" after 127.0.0.1 then add it end of the string . Try again to execute the start-domain command.

6
votes

Check your /etc/hosts file if the current hostname translates to a valid IP address. I think something is misconfigured or simple the IP do not exists.

When I changed it back (in my situation) to the 127.0.0.1 address (of course it could be any other but working and attached IP address), the glassfish could be started properly again.

1
votes

Small chance: Close Netbeans if it is running and try again.

0
votes

Have you tried

ps aux | grep glassfish

to see if other instances are running?

0
votes

the problem that the file /etc/host havent PC name with IP add this line in the file.

ip_PC name_PC 192.144.168.2 miserver

This works

http://jvm-java.blogspot.com.es/2010/12/glassfish-v3-linux-process-already.html

0
votes

-step 1 start glassfish -step 2 change the hostname

result: error starting glassfish

solution: 1 quit the hostname and just leave localhost

2 start glassfish 3 stop glassfish

4 add the hostname

5 start glassfish and it works!!!

$ cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.1.2 YOURHOSTNAME

$ glassfish4/bin/asadmin start-domain Waiting for domain1 to start ....... Successfully started the domain : domain1

0
votes

I resolve this by adding new hostname to /etc/host this is content of my host file :

127.0.0.1   localhost
127.0.1.1   mozquito     <--- this is what I add

and then try start again your asadmin

0
votes

I encountered similar problem in centOS when i set hostname for my linux. set your hostname to localhost , probably your problem will be solved.

command : hostname localhost or

edit /etc/sysconfig/network file in redHat based linux.

goodluck

0
votes

When I encountered this error, it turned out to be because the machine wasn't connected to the network and so couldn't bind to the IP address that was set in /etc/hosts and /etc/sysconfig/network-scripts/ifcfg-eth0 (I'm using CentOS). As soon as I enabled the network (mine is a VM) it worked fine.

So the message was misleading in my case: there wasn't (as far as glassfish could tell) anything listening on port 4848 on the desired IP address, but there was evidently an error when trying to attach to that port because the machine itself wasn't connected to the network.

0
votes

Recently (only applicable on Amazon Web Services-AWS), I found that launching a server into VPC requires quite a bit of extra configuration (once off) to get started. A key clue:

 nslookup `hostname`

should work. If it doesn't work, that's likely to be the reason.

You can either: 1) launch a server into EC2-classic 2) configure your VPC / host to be able to run the command above successfully.

Hope that helps.