配置 Glassfish http 侦听器到端口 443/80

配置 Glassfish http 侦听器到端口 443/80

我想在 Linux 下的 Glassfish 3.1.2.2 Build 5 中配置 http 侦听器。我将 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 或端口重定向的情况下达到目的?

答案1

您可能正在尝试以普通用户身份而不是 root 身份运行此服务器。

为了绑定在大多数操作系统上,要侦听 1024 以下端口的 TCP 侦听器,您必须拥有 root 或同等权限。这是一项安全功能,旨在防止普通用户程序占用已知的服务端口。 (这些被称为特权端口.)

这就是错误报告的第一行包含“权限被拒绝”的原因。

相关内容