2015-05-09 114 views
3

我是開發在Eclipse中使用Java EE一個網站,並使用Glassfish的本地測試,但升級到OS X 10.10.3後,服務器開始啓動時超時。當試圖從終端啓動時,Glassfish無法啓動,但與sudo一起使用時,它啓動成功。在環顧了一下Web之後,我發現使用10.10.3 Glassfish需要root權限才能運行。有沒有一種方法可以使Eclipse以root權限啓動服務器或以其他方式繞過問題?如何在OS X 10.10.3上從Eclipse啓動Glassfish服務器?

編輯:這是使用亞洲時報Siddharth的第一選擇後日志(從Eclipse中運行時,第二個沒有任何區別):

2015-05-16T16:30:39.877+1000|Info: Running GlassFish Version: GlassFish Server Open Source Edition 4.1 (build 13) 
2015-05-16T16:30:39.879+1000|Info: Server log file is using Formatter class: com.sun.enterprise.server.logging.ODLLogFormatter 
2015-05-16T16:30:39.980+1000|Info: Realm [admin-realm] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created. 
2015-05-16T16:30:39.981+1000|Info: Realm [file] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created. 
2015-05-16T16:30:39.984+1000|Info: Realm [certificate] of classtype [com.sun.enterprise.security.auth.realm.certificate.CertificateRealm] successfully created. 
2015-05-16T16:30:40.104+1000|Info: Authorization Service has successfully initialized. 
2015-05-16T16:30:40.130+1000|Info: Registered org.glassfish.ha.store.adapter.cache.ShoalBackingStoreProxy for persistence-type = replicated in BackingStoreFactoryRegistry 
2015-05-16T16:30:40.375+1000|Info: Grizzly Framework 2.3.15 started in: 25ms - bound to [/0.0.0.0:8080] 
2015-05-16T16:30:40.391+1000|Info: Grizzly Framework 2.3.15 started in: 1ms - bound to [/0.0.0.0:8181] 
2015-05-16T16:30:40.397+1000|Info: Grizzly Framework 2.3.15 started in: 1ms - bound to [/0.0.0.0:4848] 
2015-05-16T16:30:40.427+1000|Info: Grizzly Framework 2.3.15 started in: 0ms - bound to [/0.0.0.0:3700] 
2015-05-16T16:30:40.428+1000|Info: GlassFish Server Open Source Edition 4.1 (13) startup time : Felix (1,426ms), startup services(619ms), total(2,045ms) 
2015-05-16T16:30:40.602+1000|Info: JMXStartupService has started JMXConnector on JMXService URL service:jmx:rmi://olivers-imac.gateway:8686/jndi/rmi://olivers-imac.gateway:8686/jmxrmi 

有時只達到這裏。

2015-05-16T16:30:40.602+1000|Info: Grizzly Framework 2.3.15 started in: 0ms - bound to [/0.0.0.0:7676] 
2015-05-16T16:30:40.670+1000|Info: Registered com.su[email protected]ae372b9 as OSGi service registration: [email protected] 

有時它只能到達這裏。

2015-05-16T16:30:40.904+1000|Info: visiting unvisited references 
2015-05-16T16:30:41.444+1000|Info: Created HTTP listener http-listener-1 on host/port 0.0.0.0:8080 
2015-05-16T16:30:41.450+1000|Info: Created HTTP listener http-listener-2 on host/port 0.0.0.0:8181 
2015-05-16T16:30:41.453+1000|Info: Created HTTP listener admin-listener on host/port 0.0.0.0:4848 
2015-05-16T16:30:41.471+1000|Info: Created virtual server server 
2015-05-16T16:30:41.473+1000|Info: Created virtual server __asadmin 
2015-05-16T16:30:41.638+1000|Info: Setting JAAS app name glassfish-web 
2015-05-16T16:30:41.639+1000|Info: Virtual server server loaded default web module 
2015-05-16T16:30:41.927+1000|Info: Java security manager is disabled. 
2015-05-16T16:30:41.928+1000|Info: Entering Security Startup Service. 
2015-05-16T16:30:41.930+1000|Info: Loading policy provider com.sun.enterprise.security.provider.PolicyWrapper. 
2015-05-16T16:30:41.969+1000|Info: Security Service(s) started successfully. 
2015-05-16T16:30:42.155+1000|Info: visiting unvisited references 
2015-05-16T16:30:42.170+1000|Info: visiting unvisited references 
2015-05-16T16:30:42.172+1000|Info: visiting unvisited references 
2015-05-16T16:30:43.060+1000|Info: Initializing Mojarra 2.2.7 (20140610-1547 https://svn.java.net/svn/mojarra~svn/tags/[email protected]) for context '' 
2015-05-16T16:30:43.655+1000|Info: HV000001: Hibernate Validator 5.0.0.Final 
2015-05-16T16:30:43.965+1000|Info: Loading application [__admingui] at [/] 
2015-05-16T16:30:43.966+1000|Info: Loading application __admingui done in 3,296 ms 

編輯:我也標誌着亞洲時報Siddharth的答案是正確的,因爲它幫助我的,但是大多數的問題完全只更新到埃爾卡皮坦後問題本身。

+0

我在優勝美地10.10.3有同樣的問題。從終端與sudo作品,但從日食沒有奏效。有任何想法嗎? – Gere

+0

@Gere是的,那也是我的問題。 – Ontonator

回答

1

這是一個已知問題,現在已被修復(see this)。如果您想繼續使用當前版本的Glassfish,那麼可以考慮發佈here的解決方案。

報價如下,相同的解決方案: -

It turns out that the Glassfish team made an assumption that they could use launchctl bsexec in their nucleus/admin/launcher/src/main/java/com/sun/enterprise/admin/launcher/GFLauncher.java file.

This sub-command now requires root privileges.

Someone has submitted a patch to Glassfish trunk, but if you want to continue using Glassfish immediately, you can create this script somewhere e.g. ~/bin/launchctl.

#!/bin/bash 
# A little hack to wrap launchctl in order to 
# successfully start Glassfish on Yosemite 10.10.3+ 
if [[ ${1} == "bsexec" ]]; then 
    nohup ${@:3} 
else 
    /bin/launchctl ${@} 
fi 

Remember to ‘chmod 755 ~/bin/launchctl’ so that it is executable.

Also remember that your ~/.profile or ~/.bash_profile must have something like this:

export PATH="$HOME/bin:$PATH" 

The idea here is that this script is a wrapper for launchctl. As a user in Yosemite 10.10.3, you cannot run bsexec, but you may want to use launchctl for other things.

+0

我試圖底部的選項(我不確定如何使用最上面的一個)和Glassfish仍然無法正常工作。當從終端啓動時,它會打印: '等待domain1啓動。域錯誤啓動domain1。\ n服務器提前退出並退出代碼1. \ n在它死前,它會產生以下輸出:\ n \ n錯誤:無法找到或加載主類Workspace.GlassFish.glassfish4.glassfish.modules.glassfish.jar \ n \ n命令啓動域失敗。新行被替換爲\ n。 – Ontonator

+0

實際上,它從終端後,我安裝的Glassfish的全新副本的作品,但它仍然無法從Eclipse的工作。在'信息:加載應用程序__admingui在3,808 ms內完成'後它就卡住了。 – Ontonator

+0

我設法使用top方法,通過下載源代碼並使用'nohup'改變GFLauncher類的重新編譯,以便它在終端沒有'sudo'的情況下工作,但它仍然不能用於Eclipse。它會吸引到完全相同的地方。 – Ontonator

0

我有,我已經從Eclipse的市場安裝了Eclipse月神Glassfish的工具,同樣的問題,OSX 10.9下。

我在堆棧溢出中遇到了下面的帖子,我想,在10.10解決root訪問問題後,我相信那裏提出的解決方案也應該適用於您的案例,就像它爲我做的那樣。

不要忘記卸載以前從市場上安裝的Glassfish工具!

Installing Glassfish tools in eclipse luna

相關問題