当 运行 jboss 实例时,jboss.bind.address 应该是什么?

what should be jboss.bind.address should be when running jboss instance?

我们的一个 Web 项目在 JBoss EAP 6. 上配置为 运行 在我们的开发机器中,我设置

jboss.bind.address=192.168.XX.X (This is the IP of the machine I run JBOSS)
jboss.bind.address.management=192.168.XX.X

我的本地开发箱应该有什么。 我尝试了以下方法:

127.0.0.1
192.168.YY.YY (This is the ip address of my computer when I execute `ifconfig`)
0.0.0.0

我在本地盒子里尝试了以上所有方法。我发现 127.0.0.1192.168.YY.YY 启动时没有任何错误。但是 0.0.0.0 抛出以下错误。

我完全不明白这个 jboss.bind.address 和 jboss.bind.address.management 是如何使用的。

这个blog提到

您可以使用以下方法将应用程序服务器 public 接口绑定到不同的 IP 地址: standalone.sh-Djboss.bind.address=192.168.0.1.

但是我不明白这个绑定是什么意思?我也尝试在 JBoss 文档中查找。但是我不太明白这个地址的用途。

Mar 12 21:52:19 local7:2015-03-13 04: 52:19,463 INFO  [ServerService Thread Pool -- 76] [stdout] GMS: address=0.0.0.0/singleton, cluster=singleton, physical address=0.0.0.0:55200
Mar 12 21:52:19 local7:2015-03-13 04: 52:19,463 INFO  [ServerService Thread Pool -- 76] [stdout] -------------------------------------------------------------------
Mar 12 21:52:19 local7:2015-03-13 04: 52:19,466 ERROR [ServerService Thread Pool -- 76] [fail] MSC000001: Failed to start service jboss.infinispan.singleton.global-component-registry: org.jboss.msc.service.StartException in service jboss.infinispan.singleton.global-component-registry: org.infinispan.manager.EmbeddedCacheManagerStartupException: org.infinispan.CacheException: Unable to invoke method public void org.infinispan.remoting.transport.jgroups.JGroupsTransport.start() on object of type JGroupsTransport
Mar 12 21:52:19 ...chronousService.java:91)
        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:745)
        at org.jboss.threads.JBossThread.run(JBossThread.java:122)
    Caused by: org.infinispan.manager.EmbeddedCacheManagerStartupException: org.infinispan.CacheException: Unable to invoke method public void org.infinispan.remoting.transport.jgroups.JGroupsTransport.start() on object of type JGroupsTransport
Mar 12 21:52:19 ...ories.GlobalComponentRegistry.start(GlobalComponentRegistry.java:247)
        at org.jboss.as.clustering.infinispan.subsystem.GlobalComponentRegistryService.start(GlobalComponentRegistryService.java: 57)
        at org.jboss.as.clustering.msc.AsynchronousService.run(AsynchronousService.java:86)
        ... 4 more
    Caused by: org.infinispan.CacheException: Unable to invoke method public void org.infinispan.remoting.transport.jgroups.JGroupsTransport.start() on object of type JGroupsTransport
        at org.infinispan.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:205)
Mar 12 21:52:19 ...t org.infinispan.factories.AbstractComponentRegistry$PrioritizedMethod.invoke(AbstractComponentRegistry.java: 886)
        at org.infinispan.factories.AbstractComponentRegistry.invokeStartMethods(AbstractComponentRegistry.java:657)
        at org.infinispan.factories.AbstractComponentRegistry.internalStart(AbstractComponentRegistry.java:646)
        at org.infinispan.factories.AbstractComponentRegistry.start(AbstractComponentRegistry.java:549)
        at org.infinispan.factories.GlobalComponentRegistry.start(GlobalComponentRegistry.java:225)
        ... 6 more
Mar 12 21:52:19 ...cheException: Unable to start JGroups Channel
        at org.infinispan.remoting.transport.jgroups.JGroupsTransport.startJGroupsChannelIfNeeded(JGroupsTransport.java: 209)
        at org.infinispan.remoting.transport.jgroups.JGroupsTransport.start(JGroupsTransport.java:198)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
Mar 12 21:52:19 ...nfinispan.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:203)
        ... 11 more
    Caused by: java.lang.Exception: connecting to channel "null" failed
        at org.jgroups.JChannel._connect(JChannel.java:542)
        at org.jgroups.JChannel.connect(JChannel.java:283)
        at org.jgroups.JChannel.connect(JChannel.java:268)
        at org.infinispan.remoting.transport.jgroups.JGroupsTransport.startJGroupsChannelIfNeeded(JGroupsTransport.java:207)
        ... 17 more
    Caused by: java.lang.IllegalArgumentException: failed to start server socket
Mar 12 21:52:19 ..._SOCK.java:308)
        at org.jgroups.protocols.FD.down(FD.java: 290)
        at org.jgroups.protocols.VERIFY_SUSPECT.down(VERIFY_SUSPECT.java:84)
        at org.jgroups.protocols.pbcast.NAKACK.down(NAKACK.java:569)
        at org.jgroups.protocols.UNICAST2.down(UNICAST2.java:544)
        at org.jgroups.protocols.pbcast.STABLE.down(STABLE.java:329)
        at org.jgroups.protocols.pbcast.GMS.down(GMS.java:931)
        at org.jgroups.protocols.FlowControl.down(FlowControl.java:351)
        at org.jgroups.protocols.FlowControl.down(FlowControl.java:351)
        at org.jgroups.protocols.FRAG2.down(FRAG2.java:147)
Mar 12 21:52:19 ...org.jgroups.protocols.RSVP.down(RSVP.java:143)
        at org.jgroups.stack.ProtocolStack.down(ProtocolStack.java: 1030)
        at org.jgroups.JChannel.down(JChannel.java:722)
        at org.jgroups.JChannel._connect(JChannel.java:536)
        ... 20 more
    Caused by: java.net.BindException: bind_addr /0.0.0.0 is not a valid interface: java.net.BindException: Address already in use
        at org.jgroups.util.Util.createServerSocket(Util.java:3404)
        at org.jgroups.protocols.FD_SOCK.startServerSocket(FD_SOCK.java:568)
        at org.jgroups.prot

问题是这样的:

java.net.BindException: Address already in use

当您绑定到 0.0.0.0 时,您将绑定到主机上的所有 IP 地址。如果有其他东西已经绑定到 JBoss 在任何 IP 地址上使用的端口之一,您将看到此错误。

JBoss 绑定到端口,以便任何到该端口的连接都定向到 JBoss。如果有另一个进程已经在监听该端口,那么该端口将被锁定到该其他进程并且 JBoss 无法绑定它。

管理 IP 地址和端口用于管理 JBoss 配置,而 jboss.bind.address 用于最终用户访问。管理地址通常会设置为内部 IP 地址,该地址可能位于生产环境中的不同接口(例如后端接口)上。

以上错误与 jgroups 管理端口有关...

    <socket-binding name="jgroups-mping" port="0" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45700"/>
    <socket-binding name="jgroups-tcp" port="7600"/>
    <socket-binding name="jgroups-tcp-fd" port="57600"/>
    <socket-binding name="jgroups-udp" port="55200" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45688"/>
    <socket-binding name="jgroups-udp-fd" port="54200"/>

检查您机器上的其他进程是否已打开这些端口之一(也许是另一个 JBoss 实例?)

您还可以 jboss 以偏移量开头,这样所有端口都会增加您指定的偏移量。例如,如果您以

开始 jboss
-Djboss.socket.binding.port-offset=100

然后端口 8080 变成 8180 等等。这可以防止端口冲突。或者只是使用特定的(否则未使用的)IP 地址进行管理 - 这实际上取决于您的环境。