Webserver
將 Glassfish http-listener 配置到埠 443/ 80
我想在 Linux 下的 Glassfish 3.1.2.2 Build 5 中配置 http-listeners。我將 http-listener-1 的設置更改為埠 80,將 http-listener-2 的設置更改為埠 443。目的是它們監聽這些埠,而不是預設埠 8080 和 8181。所以domain.xml 看起來像這樣:
<network-listeners> <network-listener port="80" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener> <network-listener port="443" protocol="http-listener-2" transport="tcp" name="http-listener-2" thread-pool="http-thread-pool"></network-listener> <network-listener port="4848" protocol="admin-listener" transport="tcp" name="admin-listener" thread-pool="admin-thread-pool"></network-listener> </network-listeners>
我通過控制台、管理控制台和手動編輯文件進行了嘗試。結果,我無法啟動 Glassfish 並在 Ubuntu 12 和 Red Hat 6.4 下出現此錯誤:
java.net.BindException: permission denied: 443=com.sun.enterprise.v3.services.impl.monitor.MonitorableSSLSelectorHandler@239190ce at com.sun.grizzly.TCPSelectorHandler.initSelector(TCPSelectorHandler.java:432) at com.sun.grizzly.TCPSelectorHandler.preSelect(TCPSelectorHandler.java:378) at com.sun.grizzly.SelectorHandlerRunner.doSelect(SelectorHandlerRunner.java:188) at com.sun.grizzly.SelectorHandlerRunner.run(SelectorHandlerRunner.java:132) 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:722) |#] [#|2013-08-21T12:02:21.761+0200|INFO|glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.services.impl|_ThreadID=32;_ThreadName=Grizzly-kernel-thread(1);|Grizzly Framework 1.9.50 started in: 18ms - bound to [0.0.0.0:7676]|#] [#|2013-08-21T12:02:21.762+0200|INFO|glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.services.impl|_ThreadID=30;_ThreadName=Grizzly-kernel-thread(1);|Grizzly Framework 1.9.50 started in: 33ms - bound to [0.0.0.0:3700]|#] [#|2013-08-21T12:02:21.957+0200|INFO|glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.admin.adapter|_ThreadID=1;_ThreadName=main;|The Admin Console is already installed, but not yet loaded.|#] [#|2013-08-21T12:02:22.105+0200|INFO|glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=1;_ThreadName=main;|GlassFish Server Open Source Edition 3.1.2.2 (5) Startzeit: Felix (3.772ms), Startservices(1.766ms), gesamt(5.538ms)|#] [#|2013-08-21T12:02:22.106+0200|SEVERE|glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=1;_ThreadName=main;|v3 wird aufgrund einer Startausnahme heruntergefahren: Keine Berechtigung: 80=com.sun.enterprise.v3.services.impl.monitor.MonitorableSelectorHandler@6254067e|#] [#|2013-08-21T12:02:22.199+0200|INFO|glassfish3.1.2|javax.enterprise.system.tools.admin.com.sun.enterprise.v3.admin|_ThreadID=38;_ThreadName=Thread-21;|Herunterfahren des Servers initiiert|#] [#|2013-08-21T12:02:22.209+0200|INFO|glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=38;_ThreadName=Thread-21;|Already stopped, so just returning|#] Exception: java.lang.NullPointerException thrown from the UncaughtExceptionHandler in thread "Grizzly-kernel-thread(1)" Command start-domain was not successful.
所以我和這個人有同樣的錯誤: https ://www.java.net//node/693510
有沒有辦法在不使用 iptables 或埠重定向的情況下達到目標?
您可能正試圖以普通使用者而不是 root 使用者身份執行此伺服器。
為了在大多數作業系統上將 TCP 偵聽器綁定到 1024 以下的埠,您必須具有 root 或同等權限。這是一項安全功能,可防止普通使用者程序佔用知名服務埠。(這些被稱為特權埠。)
這就是錯誤報告的第一行包含“權限被拒絕”的原因。