开发中关于IPv6的问题
Posted 逍遥子
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了开发中关于IPv6的问题相关的知识,希望对你有一定的参考价值。
问题:
报错信息如下
[[email protected] iemp]# kubectl logs equipment-139404108-7mc14 -n iemp
2017-05-27 05:41:06,250 INFO [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction: JCA - STABLE org.wildfly.swarm:jca:2017.4.0
2017-05-27 05:41:06,288 INFO [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction: Logging - STABLE org.wildfly.swarm:logging:2017.4.0
2017-05-27 05:41:06,288 INFO [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction: Bean Validation - STABLE org.wildfly.swarm:bean-validation:2017.4.0
2017-05-27 05:41:06,288 INFO [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction: EJB - STABLE org.wildfly.swarm:ejb:2017.4.0
2017-05-27 05:41:06,288 INFO [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction: Transactions - STABLE org.wildfly.swarm:transactions:2017.4.0
2017-05-27 05:41:06,289 INFO [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction: JAX-RS - STABLE org.wildfly.swarm:jaxrs:2017.4.0
2017-05-27 05:41:06,289 INFO [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction: JPA - STABLE org.wildfly.swarm:jpa:2017.4.0
2017-05-27 05:41:06,289 INFO [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction: CDI - STABLE org.wildfly.swarm:cdi:2017.4.0
2017-05-27 05:41:06,289 INFO [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction: CDI Configuration - STABLE org.wildfly.swarm:cdi-config:2017.4.0
2017-05-27 05:41:06,289 INFO [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction: Datasources - STABLE org.wildfly.swarm:datasources:2017.4.0
2017-05-27 05:41:06,290 INFO [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction: Logstash - STABLE org.wildfly.swarm:logstash:2017.4.0
2017-05-27 05:41:06,290 INFO [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction: Undertow - STABLE org.wildfly.swarm:undertow:2017.4.0
2017-05-27 05:41:08,318 INFO [org.wildfly.swarm.datasources] (main) WFSWARM1003: Auto-detected JDBC driver for h2
2017-05-27 05:41:08,326 INFO [org.wildfly.swarm.datasources] (main) WFSWARM1003: Auto-detected JDBC driver for mysql
2017-05-27 05:41:08,343 INFO [org.wildfly.swarm.datasources] (main) WFSWARM1003: Auto-detected JDBC driver for postgresql
2017-05-27 05:41:09,171 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
2017-05-27 05:41:09,267 INFO [org.jboss.as] (MSC service thread 1-5) WFLYSRV0049: WildFly Swarm 2017.4.0 (WildFly Core 2.2.1.Final) starting
2017-05-27 05:41:09,333 INFO [org.wildfly.swarm] (MSC service thread 1-5) WFSWARM0019: Install MSC service for command line args: []
2017-05-27 05:41:11,053 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 29) WFLYNAM0001: Activating Naming Subsystem
2017-05-27 05:41:11,045 WARN [org.jboss.as.txn] (ServerService Thread Pool -- 27) WFLYTX0013: Node identifier property is set to the default value. Please make sure it is unique.
2017-05-27 05:41:11,058 INFO [org.jboss.as.security] (ServerService Thread Pool -- 21) WFLYSEC0002: Activating Security Subsystem
2017-05-27 05:41:11,077 INFO [org.jboss.as.security] (MSC service thread 1-1) WFLYSEC0001: Current PicketBox version=4.9.6.Final
2017-05-27 05:41:11,093 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 24) WFLYIO001: Worker ‘default‘ has auto-configured to 8 core threads with 64 task threads based on your 4 available processors
2017-05-27 05:41:11,110 INFO [org.jboss.as.naming] (MSC service thread 1-2) WFLYNAM0003: Starting Naming Service
2017-05-27 05:41:11,210 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0003: Undertow 1.4.11.Final starting
2017-05-27 05:41:11,232 INFO [org.jboss.as.connector] (MSC service thread 1-3) WFLYJCA0009: Starting JCA Subsystem (WildFly/IronJacamar 1.3.4.Final)
2017-05-27 05:41:11,333 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 17) WFLYJCA0005: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
2017-05-27 05:41:11,339 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-8) WFLYJCA0018: Started Driver service with driver-name = com.mysql
2017-05-27 05:41:11,359 INFO [org.xnio] (MSC service thread 1-1) XNIO version 3.4.3.Final
2017-05-27 05:41:11,369 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 17) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.4)
2017-05-27 05:41:11,370 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 17) WFLYJCA0005: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
2017-05-27 05:41:11,370 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-8) WFLYJCA0018: Started Driver service with driver-name = mysql
2017-05-27 05:41:11,372 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-4) WFLYJCA0018: Started Driver service with driver-name = h2
2017-05-27 05:41:11,490 INFO [org.xnio.nio] (MSC service thread 1-1) XNIO NIO Implementation Version 3.4.3.Final
2017-05-27 05:41:11,491 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 17) WFLYJCA0005: Deploying non-JDBC-compliant driver class org.postgresql.Driver (version 9.4)
2017-05-27 05:41:11,495 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-3) WFLYJCA0018: Started Driver service with driver-name = postgresql
2017-05-27 05:41:11,614 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0012: Started server default-server.
2017-05-27 05:41:11,750 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: WFLYUT0082: Could not start ‘default‘ listener.
at org.wildfly.extension.undertow.ListenerService.start(ListenerService.java:153)
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:171)
at org.xnio.XnioWorker.createStreamConnectionServer(XnioWorker.java:245)
at org.wildfly.extension.undertow.HttpListenerService.startListening(HttpListenerService.java:126)
at org.wildfly.extension.undertow.ListenerService.start(ListenerService.java:142)
... 5 more
2017-05-27 05:41:11,880 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) WFLYJCA0001: Bound data source [java:jboss/datasources/EmDS]
2017-05-27 05:41:11,885 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" => {"jboss.undertow.listener.default" => "org.jboss.msc.service.StartException in service jboss.undertow.listener.default: WFLYUT0082: Could not start ‘default‘ listener.
Caused by: java.net.SocketException: Protocol family unavailable"},
"WFLYCTL0412: Required services that are not installed:" => ["jboss.undertow.listener.default"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => undefined
}
2017-05-27 05:41:11,968 INFO [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0186: Services which failed to start: service jboss.undertow.listener.default: org.jboss.msc.service.StartException in service jboss.undertow.listener.default: WFLYUT0082: Could not start ‘default‘ listener.
2017-05-27 05:41:12,113 ERROR [org.jboss.as] (Controller Boot Thread) WFLYSRV0026: WildFly Swarm 2017.4.0 (WildFly Core 2.2.1.Final) started (with errors) in 2987ms - Started 141 of 156 services (1 services failed or missing dependencies, 28 services are lazy, passive or on-demand)
2017-05-27 05:41:12,128 ERROR [stderr] (main) java.lang.reflect.InvocationTargetException
2017-05-27 05:41:12,128 ERROR [stderr] (main) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2017-05-27 05:41:12,128 ERROR [stderr] (main) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2017-05-27 05:41:12,128 ERROR [stderr] (main) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2017-05-27 05:41:12,128 ERROR [stderr] (main) at java.lang.reflect.Method.invoke(Method.java:498)
2017-05-27 05:41:12,128 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.MainInvoker.invoke(MainInvoker.java:39)
2017-05-27 05:41:12,129 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.Main.run(Main.java:46)
2017-05-27 05:41:12,129 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.Main.main(Main.java:37)
2017-05-27 05:41:12,129 ERROR [stderr] (main) Caused by: java.lang.RuntimeException: org.jboss.msc.service.StartException in service jboss.undertow.listener.default: WFLYUT0082: Could not start ‘default‘ listener.
2017-05-27 05:41:12,129 ERROR [stderr] (main) at org.wildfly.swarm.spi.api.ClassLoading.withTCCL(ClassLoading.java:45)
2017-05-27 05:41:12,129 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.ServerBootstrapImpl.bootstrap(ServerBootstrapImpl.java:109)
2017-05-27 05:41:12,129 ERROR [stderr] (main) at org.wildfly.swarm.Swarm.start(Swarm.java:369)
2017-05-27 05:41:12,129 ERROR [stderr] (main) at com.mayocase.iemp.em.Main.main(Main.java:39)
2017-05-27 05:41:12,130 ERROR [stderr] (main) ... 7 more
2017-05-27 05:41:12,130 ERROR [stderr] (main) Caused by: org.jboss.msc.service.StartException in service jboss.undertow.listener.default: WFLYUT0082: Could not start ‘default‘ listener.
2017-05-27 05:41:12,130 ERROR [stderr] (main) at org.wildfly.extension.undertow.ListenerService.start(ListenerService.java:153)
2017-05-27 05:41:12,130 ERROR [stderr] (main) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
2017-05-27 05:41:12,130 ERROR [stderr] (main) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
2017-05-27 05:41:12,130 ERROR [stderr] (main) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
2017-05-27 05:41:12,130 ERROR [stderr] (main) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
2017-05-27 05:41:12,131 ERROR [stderr] (main) at java.lang.Thread.run(Thread.java:745)
2017-05-27 05:41:12,131 ERROR [stderr] (main) Caused by: java.net.SocketException: Protocol family unavailable
2017-05-27 05:41:12,131 ERROR [stderr] (main) at sun.nio.ch.Net.bind0(Native Method)
2017-05-27 05:41:12,131 ERROR [stderr] (main) at sun.nio.ch.Net.bind(Net.java:433)
2017-05-27 05:41:12,131 ERROR [stderr] (main) at sun.nio.ch.Net.bind(Net.java:425)
2017-05-27 05:41:12,131 ERROR [stderr] (main) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
2017-05-27 05:41:12,131 ERROR [stderr] (main) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
2017-05-27 05:41:12,131 ERROR [stderr] (main) at org.xnio.nio.NioXnioWorker.createTcpConnectionServer(NioXnioWorker.java:171)
2017-05-27 05:41:12,131 ERROR [stderr] (main) at org.xnio.XnioWorker.createStreamConnectionServer(XnioWorker.java:245)
2017-05-27 05:41:12,132 ERROR [stderr] (main) at org.wildfly.extension.undertow.HttpListenerService.startListening(HttpListenerService.java:126)
2017-05-27 05:41:12,132 ERROR [stderr] (main) at org.wildfly.extension.undertow.ListenerService.start(ListenerService.java:142)
2017-05-27 05:41:12,132 ERROR [stderr] (main) ... 5 more
2017-05-27 05:41:12,132 ERROR [stderr] (main) Exception in thread "main" java.lang.reflect.InvocationTargetException
2017-05-27 05:41:12,132 ERROR [stderr] (main) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2017-05-27 05:41:12,133 ERROR [stderr] (main) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2017-05-27 05:41:12,133 ERROR [stderr] (main) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2017-05-27 05:41:12,133 ERROR [stderr] (main) at java.lang.reflect.Method.invoke(Method.java:498)
2017-05-27 05:41:12,133 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.MainInvoker.invoke(MainInvoker.java:39)
2017-05-27 05:41:12,133 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.Main.run(Main.java:46)
2017-05-27 05:41:12,133 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.Main.main(Main.java:37)
2017-05-27 05:41:12,133 ERROR [stderr] (main) Caused by: java.lang.RuntimeException: org.jboss.msc.service.StartException in service jboss.undertow.listener.default: WFLYUT0082: Could not start ‘default‘ listener.
2017-05-27 05:41:12,133 ERROR [stderr] (main) at org.wildfly.swarm.spi.api.ClassLoading.withTCCL(ClassLoading.java:45)
2017-05-27 05:41:12,134 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.ServerBootstrapImpl.bootstrap(ServerBootstrapImpl.java:109)
2017-05-27 05:41:12,134 ERROR [stderr] (main) at org.wildfly.swarm.Swarm.start(Swarm.java:369)
2017-05-27 05:41:12,134 ERROR [stderr] (main) at com.mayocase.iemp.em.Main.main(Main.java:39)
2017-05-27 05:41:12,134 ERROR [stderr] (main) ... 7 more
2017-05-27 05:41:12,134 ERROR [stderr] (main) Caused by: org.jboss.msc.service.StartException in service jboss.undertow.listener.default: WFLYUT0082: Could not start ‘default‘ listener.
2017-05-27 05:41:12,134 ERROR [stderr] (main) at org.wildfly.extension.undertow.ListenerService.start(ListenerService.java:153)
2017-05-27 05:41:12,134 ERROR [stderr] (main) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
2017-05-27 05:41:12,134 ERROR [stderr] (main) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
2017-05-27 05:41:12,134 ERROR [stderr] (main) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
2017-05-27 05:41:12,135 ERROR [stderr] (main) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
2017-05-27 05:41:12,135 ERROR [stderr] (main) at java.lang.Thread.run(Thread.java:745)
2017-05-27 05:41:12,135 ERROR [stderr] (main) Caused by: java.net.SocketException: Protocol family unavailable
2017-05-27 05:41:12,135 ERROR [stderr] (main) at sun.nio.ch.Net.bind0(Native Method)
2017-05-27 05:41:12,135 ERROR [stderr] (main) at sun.nio.ch.Net.bind(Net.java:433)
2017-05-27 05:41:12,135 ERROR [stderr] (main) at sun.nio.ch.Net.bind(Net.java:425)
2017-05-27 05:41:12,135 ERROR [stderr] (main) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
2017-05-27 05:41:12,135 ERROR [stderr] (main) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
2017-05-27 05:41:12,136 ERROR [stderr] (main) at org.xnio.nio.NioXnioWorker.createTcpConnectionServer(NioXnioWorker.java:171)
2017-05-27 05:41:12,136 ERROR [stderr] (main) at org.xnio.XnioWorker.createStreamConnectionServer(XnioWorker.java:245)
2017-05-27 05:41:12,136 ERROR [stderr] (main) at org.wildfly.extension.undertow.HttpListenerService.startListening(HttpListenerService.java:126)
2017-05-27 05:41:12,136 ERROR [stderr] (main) at org.wildfly.extension.undertow.ListenerService.start(ListenerService.java:142)
2017-05-27 05:41:12,136 ERROR [stderr] (main) ... 5 more
使用以下命令:
java -D java.net.preferIPv4Stack=true TestHost.java
或者
在pom.xml配置文件中添加以下内容
<build>
<finalName>par</finalName>
<plugins>
<plugin>
<groupId>org.wildfly.swarm</groupId>
<artifactId>wildfly-swarm-plugin</artifactId>
<configuration>
<mainClass>com.ma.mp.pm.Main</mainClass>
<properties>
<java.net.preferIPv4Stack>true</java.net.preferIPv4Stack> #加上这条
</properties>
</configuration>
以上是关于开发中关于IPv6的问题的主要内容,如果未能解决你的问题,请参考以下文章
WP8.1开发中关于媒体(图片)文件的生成操作,属性如何设置(内容/嵌入资源等);