我按照http://www.lyonlabs.org/howto/howdoi-glassfish.html在Ubuntu 14.04服务器上安装Glassfish 4.1。
但是当我尝试启动glassfish服务器时,它显示: 远程服务器不监听[localhost:4848]上的请求是否为服务器
谢谢
答案 0 :(得分:0)
不需要安装GlassFish。您需要做的就是下载ZIP文件,解压缩到正确的目录,然后运行$GF_HOME/bin/asadmin start-domain
。
输出应如下所示:
mike@mike-ProLiant/opt/glassfish/glassfish-4.1$ bin/asadmin start-domain
Waiting for domain1 to start ...
Successfully started the domain : domain1
domain Location: /opt/glassfish/glassfish-4.1/glassfish/domains/domain1
Log File: /opt/glassfish/glass
有几种方法可以确定服务器是否已启动。
您可以运行jps -l
:
mike@mike-ProLiant/opt/glassfish/glassfish-4.1$ jps -l
12540 sun.tools.jps.Jps
12301 com.sun.enterprise.glassfish.bootstrap.ASMain
您可以看到GlassFish流程有12301
“ASMain”。
jps
是JDK附带的工具,因此如果您没有它,或者您没有正确设置路径并且找不到它,则可以使用{{1 {}}和ps aux
grep
的输出:
ASMain
您应该至少获得两个条目。一个是实际的GlassFish流程,并且会很长,另一个是你刚刚运行的命令(因为它中有mike@mike-ProLiant/opt/glassfish/glassfish-4.1$ ps aux | grep ASMain
mike 12301 5.2 1.4 5125688 363452 pts/16 Sl 17:07 0:14 /usr/lib/jvm/java-7-oracle/bin/java -cp /opt/glassfish/glassfish-4.1/glassfish/modules/glassfish.jar -XX:+UnlockDiagnosticVMOptions -XX:MaxPermSize=192m -XX:NewRatio=2 -Xmx512m -client -javaagent:/opt/glassfish/glassfish-4.1/glassfish/lib/monitor/flashlight-agent.jar -Dfelix.fileinstall.disableConfigSave=false -Djavax.net.ssl.keyStore=/opt/glassfish/glassfish-4.1/glassfish/domains/domain1/config/keystore.jks -Djava.awt.headless=true -Dcom.ctc.wstx.returnNullForDefaultNamespace=true -Dfelix.fileinstall.poll=5000 -Djava.endorsed.dirs=/opt/glassfish/glassfish-4.1/glassfish/modules/endorsed:/opt/glassfish/glassfish-4.1/glassfish/lib/endorsed -Dfelix.fileinstall.bundles.startTransient=true -Djavax.net.ssl.trustStore=/opt/glassfish/glassfish-4.1/glassfish/domains/domain1/config/cacerts.jks -Djavax.xml.accessExternalSchema=all -Dcom.sun.enterprise.security.httpsOutboundKeyAlias=s1as -Djava.security.auth.login.config=/opt/glassfish/glassfish-4.1/glassfish/domains/domain1/config/login.conf -DANTLR_USE_DIRECT_CLASS_LOADING=true -Dgosh.args=--nointeractive -Dosgi.shell.telnet.maxconn=1 -Djdbc.drivers=org.apache.derby.jdbc.ClientDriver -Dfelix.fileinstall.dir=/opt/glassfish/glassfish-4.1/glassfish/modules/autostart/ -Dosgi.shell.telnet.port=6666 -Djava.security.policy=/opt/glassfish/glassfish-4.1/glassfish/domains/domain1/config/server.policy -Dfelix.fileinstall.log.level=2 -Dcom.sun.aas.instanceRoot=/opt/glassfish/glassfish-4.1/glassfish/domains/domain1 -Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory -Dosgi.shell.telnet.ip=127.0.0.1 -Dcom.sun.aas.installRoot=/opt/glassfish/glassfish-4.1/glassfish -Djava.ext.dirs=/usr/lib/jvm/java-7-oracle/lib/ext:/usr/lib/jvm/java-7-oracle/jre/lib/ext:/opt/glassfish/glassfish-4.1/glassfish/domains/domain1/lib/ext -Dfelix.fileinstall.bundles.new.start=true -Dorg.glassfish.additionalOSGiBundlesToStart=org.apache.felix.shell,org.apache.felix.gogo.runtime,org.apache.felix.gogo.shell,org.apache.felix.gogo.command,org.apache.felix.shell.remote,org.apache.felix.fileinstall -Djdk.corba.allowOutputStreamSubclass=true -Djava.library.path=/opt/glassfish/glassfish-4.1/glassfish/lib:/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,,,--watchdog=false,,,--debug=false,,,--domaindir,,,/opt/glassfish/glassfish-4.1/glassfish/domains,,,domain1 -instancename server -verbose false -debug false -asadmin-classpath /opt/glassfish/glassfish-4.1/glassfish/lib/client/appserver-cli.jar -asadmin-classname com.sun.enterprise.admin.cli.AdminMain -upgrade false -type DAS -domaindir /opt/glassfish/glassfish-4.1/glassfish/domains/domain1 -read-stdin true
mike 12608 0.0 0.0 18932 932 pts/16 S+ 17:12 0:00 grep --color=auto ASMain
)。
查看GlassFish是否已启动的另一种有用方法是检查它是否使用ASMain
绑定到正确的端口:
netstat
因此,您可以看到端口mike@mike-ProLiant/opt/glassfish/glassfish-4.1$ sudo netstat -lntp
[sudo] password for mike:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:3000 0.0.0.0:* LISTEN 28775/nodejs
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 1119/master
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 5305/cupsd
tcp6 0 0 :::25 :::* LISTEN 1119/master
tcp6 0 0 :::7676 :::* LISTEN 12301/java
tcp6 0 0 :::8686 :::* LISTEN 12301/java
tcp6 0 0 :::4848 :::* LISTEN 12301/java
tcp6 0 0 :::8080 :::* LISTEN 12301/java
tcp6 0 0 :::3700 :::* LISTEN 12301/java
tcp6 0 0 :::8181 :::* LISTEN 12301/java
tcp6 0 0 ::1:631 :::* LISTEN 5305/cupsd
受进程约束,并且我们之前看到的进程为4848
是GlassFish。
确保12301/java
命令(sudo
),因为最后的sudo netstat -lntp
需要超级用户权限。它是告诉我们进程名称的重要部分,因此我们可以看到它是Java。
答案 1 :(得分:0)
今天我根据这个问题进行了一些搜索并在https://www.stagejava.net/forum/topic/glassfish/glassfish/issues-starting-glassfish-server上获得相同的问题。如果您为Asadmin
提供了错误的选项,则会出现此错误消息。我正确选择并尝试它的工作。
感谢所有人。