Glassfish4.1安装及配置
目录
安装及配置
下载及安装详情见官网。
关于文档
上述下载的GlassFish为开源版本,文档见GlassFish Server Documentation。
不过,在使用中发现该文档的参数并不全,比如,Reference Manual中提供了命令create-auth-realm
用来手动创建realm,现在要设定realm所在的domain,却没有找到相应的参数。反倒是在GlassFish商业版Sun GlassFish Enterprise Server v3 Prelude Reference Manual–create-auth-realm中找到参数:--host domain-host --port domain-port
满足上述需求。
修改用户名及密码
旧版Glassfish的默认管理员用户名为”admin”,密码为“adminadmin”。4.1版本的默认用户名为“admin”,密码为空。可通过如下命令修改管理员密码。
./asadmin change-admin-password --domain_name your_domain_name
问题1–远程访问出错
错误描述:其它主机访问admin终端,在登录界面出错:Glassfish: Secure Admin Must Be Enabled To Access The DAS Remotely
。或有时候该页面一直打不开。
解决办法:执行如下命令开启secure-admin并重启domain
- 允许特定主机访问:
./asadmin --host www.yourdomain.com --port 4848 enable-secure-admin
- 或允许所有主机访问:
./asadmin enable-secure-admin
- 重启domain:
./asadmin restart-domain
问题2–控制台进不去
错误描述:这个问题跟上个问题不同,GlassFish的控制台可以打开,但过一会后打不开了(用户名密码都正确)。
解决办法:清楚浏览器中的cookie即可。
问题3–jmx 8686报错
启动成功,但查看启动日志,
[2016-10-20T10:27:48.683+0800] [glassfish 4.1] [SEVERE] [] [] [tid: _ThreadID=61 _ThreadName=Thread-9] [timeMillis: 1476930468683] [levelValue: 1000] [[
java.io.IOException: Cannot bind to URL [rmi://0.0.0.1:8686/jmxrmi]: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: Exception creating connection to: 0.0.0.1; nested exception is:
java.net.SocketException: Invalid argument or cannot assign requested address]
at javax.management.remote.rmi.RMIConnectorServer.newIOExceptionRMIConnectorServer.java:827)
at javax.management.remote.rmi.RMIConnectorServer.startRMIConnectorServer.java:432)
at org.glassfish.admin.mbeanserver.RMIConnectorStarter.startRMIConnectorStarter.java:319)
at org.glassfish.admin.mbeanserver.JMXStartupService$JMXConnectorsStarterThread.startConnectorJMXStartupService.java:313)
at org.glassfish.admin.mbeanserver.JMXStartupService$JMXConnectorsStarterThread.runJMXStartupService.java:350)
Caused by: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: Exception creating connection to: 0.0.0.1; nested exception is:
java.net.SocketException: Invalid argument or cannot assign requested address]
at com.sun.jndi.rmi.registry.RegistryContext.rebindRegistryContext.java:163)
at com.sun.jndi.toolkit.url.GenericURLContext.rebindGenericURLCo
Caused by: java.rmi.ConnectIOException: Exception creating connection to: 0.0.0.1; nested exception is:
java.net.SocketException: Invalid argument or cannot assign requested address
...
参照如下方法解决,但貌似该错误没有造成什么影响。