从JDK1.8升级至JDK17后,selenium4.8.1报SocketException异常
异常 升级 JDK1.8
2023-09-27 14:21:31 时间
报错详情如下:
3月 01, 2023 5:19:09 上午 org.asynchttpclient.netty.handler.WebSocketHandler handleException 警告: onError java.net.SocketException: Connection reset at java.base/sun.nio.ch.SocketChannelImpl.throwConnectionReset(SocketChannelImpl.java:394) at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:426) at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:259) at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132) at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:357) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:833) 3月 01, 2023 5:19:09 上午 org.openqa.selenium.remote.http.WebSocket$Listener onError 警告: Connection reset java.net.SocketException: Connection reset at java.base/sun.nio.ch.SocketChannelImpl.throwConnectionReset(SocketChannelImpl.java:394) at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:426) at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:259) at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132) at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:357) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:833)
查看官方说明 selenium4.8.1是基于JDK 1.8的...
Selenium 使用 WebSocket 协议来与浏览器进行通信,而不同版本的 JDK 对 WebSocket 的支持程度可能会有所不同。
在 JDK 1.8 中,WebSocket API 是一个可用的标准 API,并且已经被广泛使用和测试。因此,Selenium 在 JDK 1.8 中使用 WebSocket 协议可能会比在 JDK 17 中更加稳定。
在 JDK 17 中,WebSocket API 已经被重新设计和实现,并且仍然处于试验阶段。因此,如果您在 JDK 17 中使用 Selenium,可能会遇到一些与 WebSocket 相关的问题。
解决此问题的一种方法是在 JDK 17 中使用较新版本的 Selenium,该版本已经对 WebSocket API 进行了更新和优化。或者,您可以尝试在 JDK 17 中使用旧版本的 WebSocket API,以避免出现兼容性问题。
相关文章
- 异常的介绍
- hibernate 验证异常 javax.validation.UnexpectedTypeException: HV000030: No validator could be found for constraint
- Tomcat启动异常:A child container failed during start 与 ClassNotFoundException: org.slf4j.Loggerl分析与解决方法
- 记录一次mysql由5.6升级到5.7出现的异常---Expression #23 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'c.commentCount' which is not functionally dependent on columns in GROUP BY clause;
- 【oracle】抛出自定义异常
- react异常 Each child in a list should have a unique “key” prop
- ClassLoader载入指定的类需注意六个细节或报ClassNotFundEception异常总结
- Java EasyExcel读取Excel数据转换等异常处理示例代码