即使端口未被占用也无法启动 Glassfish 3.1

发布于 2024-12-04 07:57:17 字数 3709 浏览 1 评论 0原文

我在新设置的 Debian“Squeeze”服务器上启动 Glassfish 3.1 时遇到问题。这是一个已设置的测试服务器,并且 Glassfish 安装已从工作服务器复制到另一台服务器。

我尝试运行:

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

我还尝试重新启动域,因为我认为它可能正在运行:

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

此时我确认 Glassfish 没有运行,所以我检查端口 4848 是否被占用:

# netstat -aon | grep 4848

它没有返回任何内容。

我怀疑 Glassfish 是在 Glassfish 仍在运行时从源服务器复制的。也许还有某种 pid 文件或锁定文件也被复制了。

关于如何启动 Glassfish 有什么建议吗?

编辑

以下是执行 asadmin start-domain 命令后来自 domain1server.log 文件:

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

挽容 2024-12-11 07:57:17

首先检查 $HOSTNAME 和 etc/hosts 文件配置,而不是试图用 ps aux 或 netstat -aon 来查找问题。

> echo $HOSTNAME

响应> 如果您在 127.0.0.1 之后看不到“$HOSTNAME”,则服务器(或等)

> cat /etc/hosts

响应,然后将其添加到字符串末尾。
再次尝试执行 start-domain 命令。

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.

许一世地老天荒 2024-12-11 07:57:17

检查 /etc/hosts 文件当前主机名是否转换为有效的 IP 地址。
我认为有些东西配置错误或者只是 IP 不存在。

当我将其改回(在我的情况下)为 127.0.0.1 地址(当然它可以是除工作和附加 IP 地址之外的任何其他地址)时,glassfish 可以再次正确启动。

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.

一袭白衣梦中忆 2024-12-11 07:57:17

可能性很小:如果 Netbeans 正在运行,请将其关闭,然后重试。

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

爱情眠于流年 2024-12-11 07:57:17

您是否尝试过

ps aux | grep glassfish

查看其他实例是否正在运行?

Have you tried

ps aux | grep glassfish

to see if other instances are running?

谁的年少不轻狂 2024-12-11 07:57:17

文件/etc/host没有带IP的PC名的问题
在文件中添加这一行。

ip_PC 名称_PC
192.144.168.2 miserver

这有效

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

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

烦人精 2024-12-11 07:57:17

-步骤1
开始玻璃鱼
-步骤2
更改主机名

结果:启动glassfish时出错

解决方案:
1 退出主机名并只保留 localhost

2 启动 glassfish
3 停止 glassfish

4 添加主机名

5 启动 glassfish
它有效!

$ cat /etc/hosts
127.0.0.1 本地主机 本地主机.本地域 本地主机4 本地主机4.本地域4
::1 本地主机 本地主机.本地域 本地主机6 本地主机6.本地域6
192.168.1.2 YOURHOSTNAME

$ glassfish4/bin/asadmin 起始域
等待domain1启动.......
成功启动域:domain1

-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

寒冷纷飞旳雪 2024-12-11 07:57:17

我通过将新主机名添加到 /etc/host 来解决此问题
这是我的主机文件的内容:

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

然后尝试再次启动您的 asadmin

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

橘味果▽酱 2024-12-11 07:57:17

当我为我的linux设置主机名时,我在centOS中遇到了类似的问题。
将您的主机名设置为 localhost ,您的问题可能会得到解决。

命令:主机名 localhost 或

在基于 redHat 的 linux 中编辑 /etc/sysconfig/network 文件。

祝你好运

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

╭⌒浅淡时光〆 2024-12-11 07:57:17

当我遇到这个错误时,原来是因为机器没有连接到网络,所以无法绑定到/etc/hosts中设置的IP地址/etc/sysconfig/network-scripts/ifcfg-eth0 (我使用的是 CentOS)。一旦我启用网络(我的是虚拟机),它就可以正常工作。

因此,在我的情况下,该消息具有误导性:(据 glassfish 所知)没有任何东西在所需 IP 地址上的端口 4848 上侦听,但在尝试连接到该端口时显然出现错误,因为机器本身没有未连接到网络。

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.

悸初 2024-12-11 07:57:17

最近(仅适用于 Amazon Web Services-AWS),我发现将服务器启动到 VPC 需要相当多的额外配置(一旦关闭)才能开始。一个关键线索:

 nslookup `hostname`

应该有效。如果不起作用,很可能就是这个原因。

您可以:
1) 在 EC2-classic 中启动服务器
2) 配置您的 VPC/主机,以便能够成功运行上述命令。

希望有帮助。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文