java.io.IOException: 应用程序没有调用 WSAStartup,或者 WSAStartup 失败。

2019-05-17 16:38:26.387 [lettuce-nioEventLoop-4-1] INFO io.lettuce.core.protocol.CommandHandler - null Unexpected exception during request: java.io.IOException: 应用程序没有调用 WSAStartup,或者 WSAStartup 失败。
java.io.IOException: 应用程序没有调用 WSAStartup,或者 WSAStartup 失败。
at sun.nio.ch.SocketDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
at sun.nio.ch.IOUtil.read(IOUtil.java:192)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
at io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288)
at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1108)
at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:345)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
at io.netty.util.concurrent.SingleThreadEventExecutor 5. r u n ( S i n g l e T h r e a d E v e n t E x e c u t o r . j a v a : 884 ) a t i o . n e t t y . u t i l . c o n c u r r e n t . F a s t T h r e a d L o c a l R u n n a b l e . r u n ( F a s t T h r e a d L o c a l R u n n a b l e . j a v a : 30 ) a t j a v a . l a n g . T h r e a d . r u n ( T h r e a d . j a v a : 748 ) 2019 − 05 − 1716 : 38 : 26.389 [ h t t p − n i o − 9001 − A c c e p t o r − 0 ] E R R O R o r g . a p a c h e . t o m c a t . u t i l . n e t . N i o E n d p o i n t − S o c k e t a c c e p t f a i l e d j a v a . i o . I O E x c e p t i o n : 一 个 封 锁 操 作 被 对 W S A C a n c e l B l o c k i n g C a l l 的 调 用 中 断 。 a t s u n . n i o . c h . S e r v e r S o c k e t C h a n n e l I m p l . a c c e p t 0 ( N a t i v e M e t h o d ) a t s u n . n i o . c h . S e r v e r S o c k e t C h a n n e l I m p l . a c c e p t ( S e r v e r S o c k e t C h a n n e l I m p l . j a v a : 422 ) a t s u n . n i o . c h . S e r v e r S o c k e t C h a n n e l I m p l . a c c e p t ( S e r v e r S o c k e t C h a n n e l I m p l . j a v a : 250 ) a t o r g . a p a c h e . t o m c a t . u t i l . n e t . N i o E n d p o i n t 5.run(SingleThreadEventExecutor.java:884) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.lang.Thread.run(Thread.java:748) 2019-05-17 16:38:26.389 [http-nio-9001-Acceptor-0] ERROR org.apache.tomcat.util.net.NioEndpoint - Socket accept failed java.io.IOException: 一个封锁操作被对 WSACancelBlockingCall 的调用中断。 at sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method) at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:422) at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:250) at org.apache.tomcat.util.net.NioEndpoint 5.run(SingleThreadEventExecutor.java:884)atio.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)atjava.lang.Thread.run(Thread.java:748)2019051716:38:26.389[httpnio9001Acceptor0]ERRORorg.apache.tomcat.util.net.NioEndpointSocketacceptfailedjava.io.IOException:WSACancelBlockingCallatsun.nio.ch.ServerSocketChannelImpl.accept0(NativeMethod)atsun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:422)atsun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:250)atorg.apache.tomcat.util.net.NioEndpointAcceptor.run(NioEndpoint.java:455)
at java.lang.Thread.run(Thread.java:748)
2019-05-17 16:38:26.393 [RMI TCP Accept-2826] WARN sun.rmi.transport.tcp - RMI TCP Accept-2826: accept loop for ServerSocket[addr=0.0.0.0/0.0.0.0,localport=2826] throws
java.net.SocketException: socket closed
at java.net.DualStackPlainSocketImpl.accept0(Native Method)
at java.net.DualStackPlainSocketImpl.socketAccept(DualStackPlainSocketImpl.java:131)
at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:409)
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:199)
at java.net.ServerSocket.implAccept(ServerSocket.java:545)
at java.net.ServerSocket.accept(ServerSocket.java:513)
at sun.rmi.transport.tcp.TCPTransport A c c e p t L o o p . e x e c u t e A c c e p t L o o p ( T C P T r a n s p o r t . j a v a : 400 ) a t s u n . r m i . t r a n s p o r t . t c p . T C P T r a n s p o r t AcceptLoop.executeAcceptLoop(TCPTransport.java:400) at sun.rmi.transport.tcp.TCPTransport AcceptLoop.executeAcceptLoop(TCPTransport.java:400)atsun.rmi.transport.tcp.TCPTransportAcceptLoop.run(TCPTransport.java:372)
at java.lang.Thread.run(Thread.java:748)

问题描述:java代码在main方法中可以执行,如果这段代码放入到项目组执行就报上面的错误;
答案:是代码底层通信的问题

你可能感兴趣的:(java)