就是最后面的运行报错,显示的是SCTP not supported on this platform 说是此平台不支持
"C:\Program Files\Java\jdk-9.0.1\bin\java" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2017.2.3\lib\idea_rt.jar=59146:C:\Program Files\JetBrains\IntelliJ IDEA 2017.2.3\bin" -Dfile.encoding=UTF-8 -classpath E:\IDEAlianxi\WebSocket\out\production\WebSocket;E:\IDEAlianxi\WebSocket\lib\netty-all-5.0.0.Alpha1.jar com.ye.webSocket.Main
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.channel.nio.NioEventLoop (file:/E:/IDEAlianxi/WebSocket/lib/netty-all-5.0.0.Alpha1.jar) to field sun.nio.ch.SelectorImpl.selectedKeys
WARNING: Please consider reporting this to the maintainers of io.netty.channel.nio.NioEventLoop
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
服务端开启等待客户端连接....
11月 09, 2018 10:49:01 上午 io.netty.util.internal.PlatformDependent <clinit>
信息: Your platform does not provide complete low-level API for accessing direct buffers reliably. Unless explicitly requested, heap buffer will always be preferred to avoid potential system unstability.
io.netty.channel.ChannelException: Unable to create Channel from class class io.netty.channel.sctp.nio.NioSctpServerChannel
at io.netty.bootstrap.ServerBootstrap$ServerBootstrapChannelFactory.newChannel(ServerBootstrap.java:374)
at io.netty.bootstrap.ServerBootstrap.createChannel(ServerBootstrap.java:106)
at io.netty.bootstrap.AbstractBootstrap.initAndRegister(AbstractBootstrap.java:263)
at io.netty.bootstrap.AbstractBootstrap.doBind(AbstractBootstrap.java:234)
at io.netty.bootstrap.AbstractBootstrap.bind(AbstractBootstrap.java:230)
at io.netty.bootstrap.AbstractBootstrap.bind(AbstractBootstrap.java:205)
at com.ye.webSocket.Main.main(Main.java:26)
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
at io.netty.bootstrap.ServerBootstrap$ServerBootstrapChannelFactory.newChannel(ServerBootstrap.java:372)
... 6 more
Caused by: java.lang.UnsupportedOperationException: SCTP not supported on this platform
at jdk.sctp/sun.nio.ch.sctp.SctpServerChannelImpl.<init>(SctpServerChannelImpl.java:45)
at jdk.sctp/com.sun.nio.sctp.SctpServerChannel.open(SctpServerChannel.java:101)
at io.netty.channel.sctp.nio.NioSctpServerChannel.newSocket(NioSctpServerChannel.java:56)
at io.netty.channel.sctp.nio.NioSctpServerChannel.<init>(NioSctpServerChannel.java:69)
... 11 more
我也遇到这个问题了,只能在linux上跑?
https://github.com/wildfly/wildfly/commit/fc5b252e6727e4ff2ac30503f69345aec26f8bf6