Cannot create fabric in JBoss Fuse 6.1 Beta on Windows 7

Solution Verified - Updated -

Environment

  • JBoss Fuse 6.1 beta build 362
  • Windows 7
  • Java 7

Issue

I unzip the JBoss Fuse 6.1 beta build 362 distribution and try to create Farbic.

$ fabric-create

Unfortunately I see the following exception.

18:47:32,574 | INFO  | pool-17-thread-1 | AbstractDataStore                | 63 - io.fabric8.fabric-core - 1.0.0.redhat-362 | Using template: DataStoreBootstrapTemplate{name='root', connectionUrl='TOCON7D31211FD:2181'}
18:47:32,574 | INFO  | pool-17-thread-1 | CuratorFrameworkImpl             | 57 - io.fabric8.fabric-zookeeper - 1.0.0.redhat-362 | Starting
18:47:32,575 | INFO  | pool-17-thread-1 | ZooKeeper                        | 57 - io.fabric8.fabric-zookeeper - 1.0.0.redhat-362 | Initiating client connection, connectString=TOCON7D31211FD:2181 sessionTimeout=60000 watcher=org.apache.curator.ConnectionState@28e561d7
18:47:32,578 | INFO  | d.cibc.com:2181) | ClientCnxn                       | 57 - io.fabric8.fabric-zookeeper - 1.0.0.redhat-362 | Opening socket connection to server TOCON7D31211FD.ad.cibc.com/fe80:0:0:0:60b6:e3f1:b156:fc42%17:2181. Will not attempt to authenticate using SASL (unknown error)
18:47:32,579 | WARN  | d.cibc.com:2181) | ClientCnxn                       | 57 - io.fabric8.fabric-zookeeper - 1.0.0.redhat-362 | Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.SocketException: Permission denied: no further information
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)[:1.7.0_40]
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:735)[:1.7.0_40]
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350)[57:io.fabric8.fabric-zookeeper:1.0.0.redhat-362]
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1068)[57:io.fabric8.fabric-zookeeper:1.0.0.redhat-362]

Resolution

Java 7 uses IPv6 networking as a default. Java 7 socket client on Windows 7 tries to use IPv6 connectivity, which fails to connect to the ZooKeeper. You need to switch the Fabric Java client to use IPv4. In order to do so, set the following line in the KARAF/bin/setenv.bat file:

SET KARAF_OPTS '-Djava.net.preferIPv4Stack=true'

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.