问题描述
我刚刚更新了一个服务器,该服务器在应用程序启动且tomcat开始处理请求后开始发生异常。
我更改了连接以验证是否存在也有问题,但发生了同样的事情:
2018年4月19日20:31:38.833严重[http-nio2- 8080-Acceptor-0] org.apache.tomcat.util.net.Nio2Endpoint.setSocketOptions java.lang.NoSuchMethodError:java.nio.ByteBuffer.clear()Ljava / nio / ByteBuffer;
在org.apache.tomcat.util.net.SocketBufferHandler.reset(SocketBufferHandler.java:146)
在org.apache.tomcat.util.net.Nio2Channel.reset(Nio2Channel.java:58)
在org.apache.tomcat.util.net.Nio2Endpoint.setSocketOptions(Nio2Endpoint.java:317)
在org.apache.tomcat.util.net.Nio2Endpoint $ Acceptor.run(Nio2Endpoint.java: 454)
at java.lang.Thread.run(Thread.java:748)
此应用程序是运行在tomcat 8.5.30上的java8,带有此连接器配置的debian
< Connector port = 8080 protocol = org.apache.coyote.http11.Http11Nio2Protocol executor = tomcatThreadPool
URIEncoding = UTF-8 connectionTimeout = 15000 disableUploadTimeout = false
connectionUploadTimeout = 60000 maxHttpHeaderSize = 16384 acceptCount = 1000>
< UpgradeProtocol className = org.apache.coyote.http2.Http2Protocol />
< / Connector>
使用常规1.1连接器
SEVERE [catalina-exec-44] org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.doRun
java.lang.NoSuchMethodError:java.nio.ByteBuffer.limit(I Ljava / nio / ByteBuffer;
在org.apache.coyote.http11.Http11InputBuffer.recycle(Http11InputBuffer.java:280)
在org.apache.coyote.http11.Http11Processor.recycle(Http11Processor.java:1709)
在org.apache.coyote.AbstractProtocol $ ConnectionHandler.release(AbstractProtocol.java:972)在org.apache.coyote.AbstractProtocol $ ConnectionHandler.process(AbstractProtocol.java:940)
在org.apache .tomcat.util.net.NioEndpoint $ SocketProcessor.doRun(NioEndpoint.java:1459)
在org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
在Java .util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:624)
在org.apache.tomcat.util .threads.TaskThread $ WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
好的,问题是由Debian更新引起的,
I have just updated a server where an exception started to happen after the application starts and tomcat starts serving requests.
I changed the connection to verify if there was an isue with it as well but the same happened:
19-Apr-2018 20:31:38.833 SEVERE [http-nio2-8080-Acceptor-0] org.apache.tomcat.util.net.Nio2Endpoint.setSocketOptions java.lang.NoSuchMethodError: java.nio.ByteBuffer.clear()Ljava/nio/ByteBuffer;
at org.apache.tomcat.util.net.SocketBufferHandler.reset(SocketBufferHandler.java:146)
at org.apache.tomcat.util.net.Nio2Channel.reset(Nio2Channel.java:58)
at org.apache.tomcat.util.net.Nio2Endpoint.setSocketOptions(Nio2Endpoint.java:317)
at org.apache.tomcat.util.net.Nio2Endpoint$Acceptor.run(Nio2Endpoint.java:454)
at java.lang.Thread.run(Thread.java:748)
This app is a java8 running on tomcat 8.5.30 debianWith this connector config
<Connector port="8080" protocol="org.apache.coyote.http11.Http11Nio2Protocol" executor="tomcatThreadPool"
URIEncoding="UTF-8" connectionTimeout="15000" disableUploadTimeout="false"
connectionUploadTimeout="60000" maxHttpHeaderSize="16384" acceptCount="1000">
<UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol"/>
</Connector>
With the regular 1.1 connector
SEVERE [catalina-exec-44] org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun
java.lang.NoSuchMethodError: java.nio.ByteBuffer.limit(I)Ljava/nio/ByteBuffer;
at org.apache.coyote.http11.Http11InputBuffer.recycle(Http11InputBuffer.java:280)
at org.apache.coyote.http11.Http11Processor.recycle(Http11Processor.java:1709)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.release(AbstractProtocol.java:972)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:940)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Ok, the issue was caused by a Debian update, which was not prepared for jdk 8. They are working on a fix though.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=895866
这篇关于开始服务后,Tomcat将NiO2Endpoint.setSocketOptions视为NoSuchMethodError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!