问题描述
我正在尝试在开放班次的端口上侦听,但是我被拒绝了权限.我正在使用Wildfly 8.2.1墨盒的叉子:
I'm trying to listen on a port in open shift, but I'm getting Permission denied. I am using a fork of the Wildfly 8.2.1 Cartridge:
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墨盒: https://github.com/openshift-cartridges/openshift-wildfly-cartridge
I forked an existing Wildfly Cartridge for Openshift:https://github.com/openshift-cartridges/openshift-wildfly-cartridge
然后我将额外的新端口添加到manifest.yml文件中:
And I added the extra new ports to the manifest.yml file:
- 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
The full manifest can be found here:https://github.com/mrj365/openshift-wildfly-cartridge/blob/master/metadata/manifest.yml
我不确定我缺少什么.我只想能够在该端口上本地收听.
I'm not sure what I'm missing. I just want to be able to listen locally on that port.
推荐答案
我发现了问题所在. Hazelcast绑定到错误的IP地址.我必须将以下配置添加到hazelcast配置中才能使其正常工作:
I figured out the issue. Hazelcast was binding to the wrong IP address. I had to add the following configurations to the hazelcast config to get it to work:
Config config = new Config();
config.setProperty("hazelcast.local.localAddress", System.getenv("OPENSHIFT_DIY_IP "));
我正在使用野生蝇,所以对我来说是
I'm using wildfly, so for me it was:
config.setProperty("hazelcast.local.localAddress", System.getenv("OPENSHIFT_WILDFLY_IP"));
我还必须添加以下2个其他配置:
I also had to add these 2 additional configurations:
config.setProperty("hazelcast.socket.client.bind.any", "false");
config.setProperty("hazelcast.socket.bind.any", "false");
这篇关于Openshift V2-自定义墨盒权限被拒绝打开端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!