Linux 即使端口未被占用,也无法启动 Glassfish 3.1
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7391466/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Unable to start Glassfish 3.1 even though port not occupied
提问by Mark Bouchard
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.
我在Glassfish 3.1
新设置的 Debian“Squeeze”服务器上启动时遇到问题。这是一个已设置的测试服务器,并且Glassfish
安装已从工作服务器复制到另一台服务器。
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:
此时我确认Glassfish
没有运行,所以我检查了端口 4848 是否被占用:
# 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.
我怀疑它Glassfish
是Glassfish
在仍在运行时从源服务器复制的。也许还有某种 pid 文件或锁定文件也被复制了。
Any suggestions on how to get Glassfish
to start?
关于如何Glassfish
开始的任何建议?
Edit
编辑
Here's the server.log
file from domain1
after executing the asadmin start-domain
command:
这是执行命令后的server.log
文件:domain1
asadmin start-domain
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
采纳答案by Emre Karata?o?lu
First of all check the $HOSTNAME and the etc/hosts file configuration , not try to find a problem with ps aux or netstat -aon .
首先检查 $HOSTNAME 和 etc/hosts 文件配置,不要试图找到 ps aux 或 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.
作为回应,如果您在 127.0.0.1 之后看不到“$HOSTNAME”,则将其添加到字符串的末尾。再次尝试执行 start-domain 命令。
回答by Garrett Hall
Have you tried
你有没有尝试过
ps aux | grep glassfish
to see if other instances are running?
查看其他实例是否正在运行?
回答by iuiz
Small chance: Close Netbeans if it is running and try again.
小机会:如果 Netbeans 正在运行,请关闭它并重试。
回答by Miklos Krivan
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.
如果当前主机名转换为有效的 IP 地址,请检查您的 /etc/hosts 文件。我认为某些配置错误或简单的 IP 不存在。
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.
当我(在我的情况下)将它改回 127.0.0.1 地址(当然它可以是任何其他地址,但工作和附加的 IP 地址)时,glassfish 可以再次正常启动。
回答by jvea
the problem that the file /etc/host havent PC name with IP add this line in the file.
文件/etc/host 没有带IP 的PC 名称的问题在文件中添加了这一行。
ip_PC name_PC 192.144.168.2 miserver
ip_PC 名称_PC 192.144.168.2 miserver
This works
这有效
http://jvm-java.blogspot.com.es/2010/12/glassfish-v3-linux-process-already.html
http://jvm-java.blogspot.com.es/2010/12/glassfish-v3-linux-process-already.html
回答by gabo34
-step 1 start glassfish -step 2 change the hostname
-step 1 启动 glassfish -step 2 更改主机名
result: error starting glassfish
结果:启动 glassfish 时出错
solution: 1 quit the hostname and just leave localhost
解决方案:1 退出主机名,只留下本地主机
2 start glassfish 3 stop glassfish
2 启动 glassfish 3 停止 glassfish
4 add the hostname
4 添加主机名
5 start glassfish and it works!!!
5 启动 glassfish,它起作用了!!!
$ 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
$ 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
$ glassfish4/bin/asadmin start-domain
等待域 1 启动....... 成功启动域:域 1
回答by Mozquito
I resolve this by adding new hostname to /etc/host this is content of my host file :
我通过向 /etc/host 添加新主机名来解决这个问题,这是我的主机文件的内容:
127.0.0.1 localhost
127.0.1.1 mozquito <--- this is what I add
and then try start again your asadmin
然后尝试重新启动您的 asadmin
回答by Abbas Tofighi
I encountered similar problem in centOS when i set hostname for my linux. set your hostname to localhost , probably your problem will be solved.
当我为我的 linux 设置主机名时,我在 centOS 中遇到了类似的问题。将您的主机名设置为 localhost ,可能您的问题将得到解决。
command : hostname localhost or
命令:主机名 localhost 或
edit /etc/sysconfig/network file in redHat based linux.
在基于 redHat 的 linux 中编辑 /etc/sysconfig/network 文件。
goodluck
祝你好运
回答by Richard Wiseman
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.
当我遇到这个错误时,原来是因为机器没有连接到网络,所以无法绑定到/etc/hosts
和/etc/sysconfig/network-scripts/ifcfg-eth0
(我使用的是CentOS)中设置的IP地址。一旦我启用了网络(我的是一个虚拟机),它就可以正常工作。
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.
因此,在我的情况下,该消息具有误导性:(就 glassfish 而言)没有任何东西在所需 IP 地址上的端口 4848 上进行侦听,但是在尝试连接到该端口时显然存在错误,因为机器本身没有没有连接到网络。
回答by Paul Jowett
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:
最近(仅适用于 Amazon Web Services-AWS),我发现将服务器启动到 VPC 需要相当多的额外配置(一旦关闭)才能开始。一个关键线索:
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.
您可以:1) 在 EC2-classic 中启动服务器 2) 配置您的 VPC/主机以成功运行上述命令。
Hope that helps.
希望有帮助。