Glassfish 4 无法在 Linux 上启动

Posted

技术标签:

【中文标题】Glassfish 4 无法在 Linux 上启动【英文标题】:Glassfish 4 fails to start on Linux 【发布时间】:2014-10-28 04:02:08 【问题描述】:

我收到以下错误。任何帮助将不胜感激。

$ sudo glassfish4/glassfish/bin/asadmin start-domain Waiting for domain1 to start ..................Error starting domain domain1. The server exited prematurely with exit code 0. Before it died, it produced the following output:

Launching GlassFish on Felix platform Registered com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishRuntime@72d53ac7 in service registry. Found populator: com.sun.enterprise.v3.server.GFDomainXml



#!## LogManagerService.postConstruct : rootFolder=/srv/glassfish4/glassfish
#!## LogManagerService.postConstruct : templateDir=/srv/glassfish4/glassfish/lib/templates
#!## LogManagerService.postConstruct : src=/srv/glassfish4/glassfish/lib/templates/logging.properties
#!## LogManagerService.postConstruct : dest=/srv/glassfish4/glassfish/domains/domain1/config/logging.properties Completed shutdown of Log manager service Completed shutdown of GlassFish runtime Watcher for /srv/glassfish4/glassfish/domains/domain1/autodeploy/bundles exiting because of interruption.: java.lang.InterruptedException java.lang.InterruptedException  at java.lang.Object.wait(Native Method)     at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:226) Oct 27, 2014 8:57:08 PM com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner createBundleProvisioner INFO: Create bundle provisioner class = class com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner. Oct 27, 2014 8:57:08 PM com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner$DefaultCustomizer getLocations WARNING: Skipping entry  because it is not an absolute URI. Oct 27, 2014 8:57:08 PM com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner$DefaultCustomizer getLocations WARNING: Skipping entry  because it is not an absolute URI. [#|2014-10-27T20:57:15.978-0700|INFO|glassfish
4.1|javax.enterprise.logging|_ThreadID=15;_ThreadName=RunLevelControllerThread-1414468635292;_TimeMillis=1414468635978;_LevelValue=800;_MessageID=NCLS-LOGGING-00009;| Running GlassFish Version: GlassFish Server Open Source Edition  4.1  (build 13)|#]

[#|2014-10-27T20:57:15.989-0700|INFO|glassfish
4.1|javax.enterprise.logging|_ThreadID=15;_ThreadName=RunLevelControllerThread-1414468635292;_TimeMillis=1414468635989;_LevelValue=800;_MessageID=NCLS-LOGGING-00010;| Server log file is using Formatter class: com.sun.enterprise.server.logging.ODLLogFormatter|#]

[#|2014-10-27T20:57:17.173-0700|INFO|glassfish
4.1|org.hibernate.validator.internal.util.Version|_ThreadID=15;_ThreadName=RunLevelControllerThread-1414468635292;_TimeMillis=1414468637173;_LevelValue=800;| HV000001: Hibernate Validator 5.0.0.Final|#]

[#|2014-10-27T20:57:17.266-0700|INFO|glassfish
4.1|javax.enterprise.system.core.security|_ThreadID=14;_ThreadName=RunLevelControllerThread-1414468635273;_TimeMillis=1414468637266;_LevelValue=800;_MessageID=NCLS-SECURITY-01115;| Realm [admin-realm] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.|#]

[#|2014-10-27T20:57:17.320-0700|INFO|glassfish
4.1|javax.enterprise.system.core.security|_ThreadID=14;_ThreadName=RunLevelControllerThread-1414468635273;_TimeMillis=1414468637320;_LevelValue=800;_MessageID=NCLS-SECURITY-01115;| Realm [file] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.|#]

[#|2014-10-27T20:57:17.473-0700|INFO|glassfish
4.1|javax.enterprise.system.core.security|_ThreadID=14;_ThreadName=RunLevelControllerThread-1414468635273;_TimeMillis=1414468637473;_LevelValue=800;_MessageID=NCLS-SECURITY-01115;| Realm [certificate] of classtype [com.sun.enterprise.security.auth.realm.certificate.CertificateRealm] successfully created.|#]

[#|2014-10-27T20:57:17.954-0700|INFO|glassfish
4.1|org.glassfish.ha.store.spi.BackingStoreFactoryRegistry|_ThreadID=17;_ThreadName=RunLevelControllerThread-1414468635378;_TimeMillis=1414468637954;_LevelValue=800;| Registered org.glassfish.ha.store.adapter.cache.ShoalBackingStoreProxy for persistence-type = replicated in BackingStoreFactoryRegistry|#]

[#|2014-10-27T20:57:18.164-0700|INFO|glassfish
4.1|javax.enterprise.security.services|_ThreadID=14;_ThreadName=RunLevelControllerThread-1414468635273;_TimeMillis=1414468638164;_LevelValue=800;_MessageID=SEC-SVCS-00100;| Authorization Service has successfully initialized.|#]

[#|2014-10-27T20:57:18.406-0700|INFO|glassfish
4.1|javax.enterprise.system.core|_ThreadID=16;_ThreadName=RunLevelControllerThread-1414468635370;_TimeMillis=1414468638406;_LevelValue=800;_MessageID=NCLS-CORE-00087;|   Grizzly Framework 2.3.15 started in: 113ms - bound to [/0.0.0.0:8181]|#]

[#|2014-10-27T20:57:18.982-0700|INFO|glassfish
4.1|javax.enterprise.system.core|_ThreadID=16;_ThreadName=RunLevelControllerThread-1414468635370;_TimeMillis=1414468638982;_LevelValue=800;_MessageID=NCLS-CORE-00087;|   Grizzly Framework 2.3.15 started in: 129ms - bound to [/0.0.0.0:4848]|#]

[#|2014-10-27T20:57:19.308-0700|INFO|glassfish
4.1|javax.enterprise.system.core|_ThreadID=17;_ThreadName=RunLevelControllerThread-1414468635378;_TimeMillis=1414468639308;_LevelValue=800;_MessageID=NCLS-CORE-00087;|   Grizzly Framework 2.3.15 started in: 11ms - bound to [/0.0.0.0:3700]|#]

[#|2014-10-27T20:57:20.181-0700|INFO|glassfish
4.1|javax.enterprise.system.core|_ThreadID=1;_ThreadName=main;_TimeMillis=1414468640181;_LevelValue=800;_MessageID=NCLS-CORE-00017;|   GlassFish Server Open Source Edition  4.1  (13) startup time : Felix (9,542ms), startup services(4,931ms), total(14,473ms)|#]

[#|2014-10-27T20:57:20.183-0700|SEVERE|glassfish
4.1|javax.enterprise.system.core|_ThreadID=1;_ThreadName=main;_TimeMillis=1414468640183;_LevelValue=1000;_MessageID=NCLS-CORE-00019;| Shutting down server due to startup exception java.net.BindException: Address already in use  at sun.nio.ch.Net.bind0(Native Method)  at sun.nio.ch.Net.bind(Net.java:444)    at sun.nio.ch.Net.bind(Net.java:436)    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)     at org.glassfish.grizzly.nio.transport.TCPNIOBindingHandler.bindToChannelAndAddress(TCPNIOBindingHandler.java:132)  at org.glassfish.grizzly.nio.transport.TCPNIOBindingHandler.bind(TCPNIOBindingHandler.java:88)  at org.glassfish.grizzly.nio.transport.TCPNIOTransport.bind(TCPNIOTransport.java:236)   at org.glassfish.grizzly.nio.transport.TCPNIOTransport.bind(TCPNIOTransport.java:225)   at org.glassfish.grizzly.nio.transport.TCPNIOTransport.bind(TCPNIOTransport.java:85)    at org.glassfish.grizzly.config.GenericGrizzlyListener.start(GenericGrizzlyListener.java:180)   at com.sun.enterprise.v3.services.impl.GlassfishNetworkListener.start(GlassfishNetworkListener.java:109)    at com.sun.enterprise.v3.services.impl.GrizzlyProxy.start0(GrizzlyProxy.java:267)   at com.sun.enterprise.v3.services.impl.GrizzlyProxy.start(GrizzlyProxy.java:241)    at com.sun.enterprise.v3.services.impl.GrizzlyService.createNetworkProxy(GrizzlyService.java:567)   at com.sun.enterprise.v3.services.impl.GrizzlyService.postConstruct(GrizzlyService.java:490)    at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:329)   at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:377)    at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:461)    at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:227)     at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:84)     at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2258)  at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:105)  at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:87)   at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1162)    at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1147)   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  at java.lang.Thread.run(Thread.java:745) |#]

[#|2014-10-27T20:57:20.481-0700|INFO|glassfish
4.1|javax.enterprise.system.core|_ThreadID=55;_ThreadName=Thread-11;_TimeMillis=1414468640481;_LevelValue=800;_MessageID=NCLS-CORE-00092;|   Server shutdown initiated|#]

[#|2014-10-27T20:57:20.498-0700|INFO|glassfish
4.1|javax.enterprise.bootstrap|_ThreadID=1;_ThreadName=main;_TimeMillis=1414468640498;_LevelValue=800;_MessageID=NCLS-BOOTSTRAP-00027;| Registered com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishImpl@2c3b2e73 as OSGi service registration: org.apache.felix.framework.ServiceRegistrationImpl@290bdbae.|#]

[#|2014-10-27T20:57:21.488-0700|INFO|glassfish
4.1|javax.enterprise.bootstrap|_ThreadID=55;_ThreadName=Thread-11;_TimeMillis=1414468641488;_LevelValue=800;_MessageID=NCLS-BOOTSTRAP-00028;| Unregistered com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishImpl@2c3b2e73 from service registry.|#]

[#|2014-10-27T20:57:21.503-0700|INFO|glassfish
4.1||_ThreadID=55;_ThreadName=Thread-8;_TimeMillis=1414468641503;_LevelValue=800;| FileMonitoring shutdown|#]

[#|2014-10-27T20:57:21.904-0700|INFO|glassfish
4.1|javax.enterprise.system.core|_ThreadID=55;_ThreadName=Thread-11;_TimeMillis=1414468641904;_LevelValue=800;_MessageID=NCLS-CORE-00013;|   Shutdown procedure finished|#]


Command start-domain failed

【问题讨论】:

如果您需要实际帮助,请尝试提供一些代码或上下文。 @KenY-N,您可以将其发布为答案吗?你应该得到这个功劳,因为这就是问题所在。杀死玻璃鱼的是雄猫。不是阿帕奇。 【参考方案1】:

错误日志中重要的一行是:

java.net.BindException:地址已在 sun.nio.ch.Net.bind0 中使用

这很可能是因为已经有另一个服务(Apache、旧的 Tomcat 安装等)使用 GlassFish 的默认端口 8080。GlassFish 使用的端口可以通过following the instructions here 更改。

此外,要找出已经在使用 GlassFish 端口的内容,以便在必要时停止服务,请使用 this for Windows 和 this for Linux。

【讨论】:

供未来用户使用。如果您想查看应用程序是否绑定到端口并且您在 linux 上,您可以使用以下命令:sudo netstat -tulpn | grep port_number ----- 所以对于我的问题,我使用了 sudo netstat -tulpn | grep 8080 后跟一个 kill 命令使该进程终止。

以上是关于Glassfish 4 无法在 Linux 上启动的主要内容,如果未能解决你的问题,请参考以下文章

无法启动GlassFish 4.0(Windows) - 端口1527 - 已在使用的地址

无法通过 Glassfish 4.1 Web 管理员创建任何 JMS 资源

GlassFish 服务器无法在 NetBeans IDE 8.0 中启动

Glassfish 服务器无法启动。空指针异常

GlassFish 4 无法部署

需要在 Glassfish 上启动域,出现错误:“目录”中没有域