2

I have a JAX-RS service that works locally with wildfly-swarm 1.0.0.Beta8, but when I boot it on a remote machine, I get the following exception:

ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.undertow.listener.default: org.jboss.msc.service.StartException in service jboss.undertow.listener.default: Could not start http listener
    at org.wildfly.extension.undertow.ListenerService.start(ListenerService.java:142)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.SocketException: Protocol family unavailable
    at sun.nio.ch.Net.bind0(Native Method)
    at sun.nio.ch.Net.bind(Net.java:433)
    at sun.nio.ch.Net.bind(Net.java:425)
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
    at org.xnio.nio.NioXnioWorker.createTcpConnectionServer(NioXnioWorker.java:190)
    at org.xnio.XnioWorker.createStreamConnectionServer(XnioWorker.java:243)
    at org.wildfly.extension.undertow.HttpListenerService.startListening(HttpListenerService.java:126)
    at org.wildfly.extension.undertow.ListenerService.start(ListenerService.java:138)
    ... 5 more

Also when I deploy the app to a full wildfly 10, it works just fine.

I googled that the 'Protocol family unavailable' exception can be related to a machine having only an IPv6 address while java defaults to IPv4, but this machine does have an IPv4 address.

I have no idea what I might be doing wrong.

Any suggestions?

user140547
  • 7,750
  • 3
  • 28
  • 80
rü-
  • 2,129
  • 17
  • 37

3 Answers3

7

Can you try modifying the wildfly-swarm-plugin to have a setup like:

  <plugin>
    <groupId>org.wildfly.swarm</groupId>
    <artifactId>wildfly-swarm-plugin</artifactId>
    <configuration>
      <mainClass>org.wildfly.swarm.examples.netflix.ribbon.frontend.Main</mainClass>
      <properties>
        <java.net.preferIPv4Stack>true</java.net.preferIPv4Stack>
      </properties>
    </configuration>
    <executions>
      <execution>
        <goals>
          <goal>package</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

It may need the java.net.preferIPv4Stack set to true.

Ken
  • 835
  • 4
  • 11
2

I build upon Ken's answer. When I tried it I had the following error: java.lang.ClassNotFoundException: org.wildfly.swarm.examples.netflix.ribbon.frontend.Main.

Removing the <mainClass> element from the plugin configuration in the pom worked like a charm.

    <configuration>
      <properties>
        <java.net.preferIPv4Stack>true</java.net.preferIPv4Stack>
      </properties>
    </configuration>
Ahmad Shahwan
  • 1,662
  • 18
  • 29
1

Add a java option in $JBOSS_HOME/bin/standalone.conf  JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"

user3468921
  • 561
  • 2
  • 8
  • 26