我正试图在开放式班次听一个端口,但我得到了Permission否认。我正在使用Wildfly 8.2.1墨盒的叉子:
2016-12-31 13:24:06,016 INFO [com.hazelcast.instance.DefaultAddressPicker] (MSC service thread 1-8) [LOCAL] [name] [3.5.4] Interfaces is disabled, trying to pick one address from TCP-IP config addresses: [127.0.0.1]
2016-12-31 13:24:06,074 SEVERE [com.hazelcast.instance.DefaultAddressPicker] (MSC service thread 1-8) [LOCAL] [name] [3.5.4] ServerSocket bind has failed. Hazelcast cannot start! config-port: 5701, latest-port: 5801: com.hazelcast.core.HazelcastException: ServerSocket bind has failed. Hazelcast cannot start! config-port: 5701, latest-port: 5801
at com.hazelcast.instance.DefaultAddressPicker.pickAddress(DefaultAddressPicker.java:117) [hazelcast-3.5.4.jar:3.5.4]
at com.hazelcast.instance.Node.<init>(Node.java:143) [hazelcast-3.5.4.jar:3.5.4]
at com.hazelcast.instance.HazelcastInstanceImpl.<init>(HazelcastInstanceImpl.java:120) [hazelcast-3.5.4.jar:3.5.4]
at com.hazelcast.instance.HazelcastInstanceFactory.constructHazelcastInstance(HazelcastInstanceFactory.java:152) [hazelcast-3.5.4.jar:3.5.4]
at com.hazelcast.instance.HazelcastInstanceFactory.getOrCreateHazelcastInstance(HazelcastInstanceFactory.java:98) [hazelcast-3.5.4.jar:3.5.4]
at com.hazelcast.core.Hazelcast.getOrCreateHazelcastInstance(Hazelcast.java:116) [hazelcast-3.5.4.jar:3.5.4]
at org.springframework.boot.autoconfigure.hazelcast.HazelcastInstanceFactory.getHazelcastInstance(HazelcastInstanceFactory.java:80) [spring-boot-autoconfigure-1.3.2.RELEASE.jar:1.3.2.RELEASE]
.
.
.
Caused by: java.net.SocketException: Permission denied
at sun.nio.ch.Net.bind0(Native Method) [rt.jar:1.8.0_111]
at sun.nio.ch.Net.bind(Net.java:433) [rt.jar:1.8.0_111]
at sun.nio.ch.Net.bind(Net.java:425) [rt.jar:1.8.0_111]
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) [rt.jar:1.8.0_111]
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) [rt.jar:1.8.0_111]
at com.hazelcast.instance.DefaultAddressPicker.pickAddress(DefaultAddressPicker.java:98) [hazelcast-3.5.4.jar:3.5.4]
... 69 more
我为Openshift分叉了一个现有的Wildfly Cartridge: https://github.com/openshift-cartridges/openshift-wildfly-cartridge
我在manifest.yml文件中添加了额外的新端口:
- Private-IP-Name: IP
Private-Port-Name: HAZELCAST_PORT
Private-Port: 5701
Public-Port-Name: HAZELCAST_PROXY_PORT
完整清单可以在这里找到: https://github.com/mrj365/openshift-wildfly-cartridge/blob/master/metadata/manifest.yml
我不确定我错过了什么。我只是希望能够在该端口上本地收听。
答案 0 :(得分:1)
我想出了这个问题。 Hazelcast绑定到错误的IP地址。我必须将以下配置添加到hazelcast配置才能使其正常工作:
Config config = new Config();
config.setProperty("hazelcast.local.localAddress", System.getenv("OPENSHIFT_DIY_IP "));
我使用的是野生蝇,所以对我来说是:
config.setProperty("hazelcast.local.localAddress", System.getenv("OPENSHIFT_WILDFLY_IP"));
我还必须添加这两个额外的配置:
config.setProperty("hazelcast.socket.client.bind.any", "false");
config.setProperty("hazelcast.socket.bind.any", "false");