javamacosdockernetwork-programmingwildfly-swarm

Wildfly Swarm on docker in MacOS


I'm trying to run a Wildfly Swarm service inside a Docker in a macOS, but it is throwing an exception. I do not know if is a MacOS issue (I believe it is) or a JVM issue.

I'm using a very simple Dockerfile for wildly swarm:

FROM java:openjdk-8-alpine

ADD target/service-swarm.jar /opt/service-swarm.jar

EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/opt/service-swarm.jar"]

I'm using a minimal swarm + vaadin for my service.

Here is the docker log:

2018-03-16 14:54:17,475 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service org.wildfly.undertow.listener.default: org.jboss.msc.service.StartException in service org.wildfly.undertow.listener.default: WFLYUT0082: Could not start 'default' listener.
    at org.wildfly.extension.undertow.ListenerService.start(ListenerService.java:181)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955)
    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:179)
    at org.xnio.XnioWorker.createStreamConnectionServer(XnioWorker.java:310)
    at org.wildfly.extension.undertow.HttpListenerService.startListening(HttpListenerService.java:106)
    at org.wildfly.extension.undertow.ListenerService.start(ListenerService.java:169)
    ... 5 more

2018-03-16 14:54:17,717 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
    ("subsystem" => "undertow"),
    ("server" => "default-server"),
    ("http-listener" => "default")
]) - failure description: {"WFLYCTL0080: Failed services" => {"org.wildfly.undertow.listener.default" => "WFLYUT0082: Could not start 'default' listener.
    Caused by: java.net.SocketException: Protocol family unavailable"}}
2018-03-16 14:54:17,774 INFO  [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0186:   Services which failed to start:      service org.wildfly.undertow.listener.default: WFLYUT0082: Could not start 'default' listener.

2018-03-16 14:54:17,820 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
2018-03-16 14:54:17,828 ERROR [org.jboss.as] (Controller Boot Thread) WFLYSRV0026: WildFly Swarm 2018.3.3 (WildFly Core 3.0.8.Final) started (with errors) in 2732ms - Started 82 of 92 services (1 services failed or missing dependencies, 17 services are lazy, passive or on-demand)
2018-03-16 14:54:17,859 ERROR [stderr] (main) java.lang.RuntimeException: org.jboss.msc.service.StartException in service org.wildfly.undertow.listener.default: WFLYUT0082: Could not start 'default' listener.
2018-03-16 14:54:17,860 ERROR [stderr] (main)   at org.wildfly.swarm.spi.api.ClassLoading.withTCCL(ClassLoading.java:45)
2018-03-16 14:54:17,860 ERROR [stderr] (main)   at org.wildfly.swarm.container.runtime.ServerBootstrapImpl.bootstrap(ServerBootstrapImpl.java:113)
2018-03-16 14:54:17,860 ERROR [stderr] (main)   at org.wildfly.swarm.Swarm.start(Swarm.java:398)
2018-03-16 14:54:17,861 ERROR [stderr] (main)   at org.wildfly.swarm.Swarm.main(Swarm.java:742)
2018-03-16 14:54:17,861 ERROR [stderr] (main)   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2018-03-16 14:54:17,861 ERROR [stderr] (main)   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2018-03-16 14:54:17,862 ERROR [stderr] (main)   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2018-03-16 14:54:17,862 ERROR [stderr] (main)   at java.lang.reflect.Method.invoke(Method.java:498)
2018-03-16 14:54:17,862 ERROR [stderr] (main)   at org.wildfly.swarm.bootstrap.MainInvoker.invoke(MainInvoker.java:53)
2018-03-16 14:54:17,862 ERROR [stderr] (main)   at org.wildfly.swarm.bootstrap.Main.run(Main.java:132)
2018-03-16 14:54:17,862 ERROR [stderr] (main)   at org.wildfly.swarm.bootstrap.Main.main(Main.java:85)
2018-03-16 14:54:17,863 ERROR [stderr] (main) Caused by: org.jboss.msc.service.StartException in service org.wildfly.undertow.listener.default: WFLYUT0082: Could not start 'default' listener.
2018-03-16 14:54:17,863 ERROR [stderr] (main)   at org.wildfly.extension.undertow.ListenerService.start(ListenerService.java:181)
2018-03-16 14:54:17,863 ERROR [stderr] (main)   at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032)
2018-03-16 14:54:17,863 ERROR [stderr] (main)   at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955)
2018-03-16 14:54:17,863 ERROR [stderr] (main)   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
2018-03-16 14:54:17,863 ERROR [stderr] (main)   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
2018-03-16 14:54:17,864 ERROR [stderr] (main)   at java.lang.Thread.run(Thread.java:745)
2018-03-16 14:54:17,864 ERROR [stderr] (main) Caused by: java.net.SocketException: Protocol family unavailable
2018-03-16 14:54:17,864 ERROR [stderr] (main)   at sun.nio.ch.Net.bind0(Native Method)
2018-03-16 14:54:17,864 ERROR [stderr] (main)   at sun.nio.ch.Net.bind(Net.java:433)
2018-03-16 14:54:17,865 ERROR [stderr] (main)   at sun.nio.ch.Net.bind(Net.java:425)
2018-03-16 14:54:17,865 ERROR [stderr] (main)   at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
2018-03-16 14:54:17,865 ERROR [stderr] (main)   at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
2018-03-16 14:54:17,865 ERROR [stderr] (main)   at org.xnio.nio.NioXnioWorker.createTcpConnectionServer(NioXnioWorker.java:179)
2018-03-16 14:54:17,865 ERROR [stderr] (main)   at org.xnio.XnioWorker.createStreamConnectionServer(XnioWorker.java:310)
2018-03-16 14:54:17,866 ERROR [stderr] (main)   at org.wildfly.extension.undertow.HttpListenerService.startListening(HttpListenerService.java:106)
2018-03-16 14:54:17,866 ERROR [stderr] (main)   at org.wildfly.extension.undertow.ListenerService.start(ListenerService.java:169)
2018-03-16 14:54:17,866 ERROR [stderr] (main)   ... 5 more
2018-03-16 14:54:17,866 ERROR [stderr] (main) java.lang.RuntimeException: org.jboss.msc.service.StartException in service org.wildfly.undertow.listener.default: WFLYUT0082: Could not start 'default' listener.
2018-03-16 14:54:17,866 ERROR [stderr] (main)   at org.wildfly.swarm.spi.api.ClassLoading.withTCCL(ClassLoading.java:45)
2018-03-16 14:54:17,867 ERROR [stderr] (main)   at org.wildfly.swarm.container.runtime.ServerBootstrapImpl.bootstrap(ServerBootstrapImpl.java:113)
2018-03-16 14:54:17,867 ERROR [stderr] (main)   at org.wildfly.swarm.Swarm.start(Swarm.java:398)
2018-03-16 14:54:17,867 ERROR [stderr] (main)   at org.wildfly.swarm.Swarm.main(Swarm.java:742)
2018-03-16 14:54:17,867 ERROR [stderr] (main)   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2018-03-16 14:54:17,867 ERROR [stderr] (main)   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2018-03-16 14:54:17,867 ERROR [stderr] (main)   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2018-03-16 14:54:17,868 ERROR [stderr] (main)   at java.lang.reflect.Method.invoke(Method.java:498)
2018-03-16 14:54:17,868 ERROR [stderr] (main)   at org.wildfly.swarm.bootstrap.MainInvoker.invoke(MainInvoker.java:53)
2018-03-16 14:54:17,868 ERROR [stderr] (main)   at org.wildfly.swarm.bootstrap.Main.run(Main.java:132)
2018-03-16 14:54:17,876 ERROR [stderr] (main)   at org.wildfly.swarm.bootstrap.Main.main(Main.java:85)
2018-03-16 14:54:17,876 ERROR [stderr] (main) Caused by: org.jboss.msc.service.StartException in service org.wildfly.undertow.listener.default: WFLYUT0082: Could not start 'default' listener.
2018-03-16 14:54:17,876 ERROR [stderr] (main)   at org.wildfly.extension.undertow.ListenerService.start(ListenerService.java:181)
2018-03-16 14:54:17,876 ERROR [stderr] (main)   at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032)
2018-03-16 14:54:17,877 ERROR [stderr] (main)   at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955)
2018-03-16 14:54:17,877 ERROR [stderr] (main)   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
2018-03-16 14:54:17,877 ERROR [stderr] (main)   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
2018-03-16 14:54:17,877 ERROR [stderr] (main)   at java.lang.Thread.run(Thread.java:745)
2018-03-16 14:54:17,878 ERROR [stderr] (main) Caused by: java.net.SocketException: Protocol family unavailable
2018-03-16 14:54:17,878 ERROR [stderr] (main)   at sun.nio.ch.Net.bind0(Native Method)
2018-03-16 14:54:17,878 ERROR [stderr] (main)   at sun.nio.ch.Net.bind(Net.java:433)
2018-03-16 14:54:17,878 ERROR [stderr] (main)   at sun.nio.ch.Net.bind(Net.java:425)
2018-03-16 14:54:17,879 ERROR [stderr] (main)   at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
2018-03-16 14:54:17,879 ERROR [stderr] (main)   at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
2018-03-16 14:54:17,879 ERROR [stderr] (main)   at org.xnio.nio.NioXnioWorker.createTcpConnectionServer(NioXnioWorker.java:179)
2018-03-16 14:54:17,879 ERROR [stderr] (main)   at org.xnio.XnioWorker.createStreamConnectionServer(XnioWorker.java:310)
2018-03-16 14:54:17,879 ERROR [stderr] (main)   at org.wildfly.extension.undertow.HttpListenerService.startListening(HttpListenerService.java:106)
2018-03-16 14:54:17,879 ERROR [stderr] (main)   at org.wildfly.extension.undertow.ListenerService.start(ListenerService.java:169)
2018-03-16 14:54:17,880 ERROR [stderr] (main)   ... 5 more
2018-03-16 14:54:17,881 INFO  [org.wildfly.swarm] (Thread-2) WFSWARM0027: Shutdown requested

This is a MacOS issue, or a docker + wildly-swarm issue? How can I solve it?


Solution

  • It's a known issue with IPv6 addressing inside Docker. To resolve it you need to set a property on the WF Swarm plugin to prefer IPv4 addressing. See https://github.com/wildfly-swarm/wildfly-swarm-examples/blob/master/ribbon/pom.xml#L33