this is my NIO Connector configuration in server.xml <Connector acceptCount="100" enableLookups="false" port="80" protocol="org.apache.coyote.http11.Http11NioProtocol" acceptorThreadCount="2" socket.bufferPool="-1" connectionTimeout="60000" maxKeepAliveRequests="-1" maxThreads="200" minSpareThreads="25" redirectPort="8443" /> when I am starting my tomcat it is giving following error in the console several time SEVERE: java.lang.NullPointerException at org.apache.tomcat.util.net.NioEndpoint.setSocketOptions(NioEndpoint.java:985) at org.apache.tomcat.util.net.NioEndpoint$Acceptor.run(NioEndpoint.java:1169) at java.lang.Thread.run(Thread.java:595)
One more important thing I missed out . The condition when this bug is comming is if there is any preexisting connection which is trying to connect to the server but server is down and when I start it again it will give this error.
I've stumbled upon this bug too. Looks like it is being caused by the race condition between the main thread and the newly created acceptor thread. I'm getting this error quite often on my Core 2 Duo/WinXP 32-bit/Java 6u02. I think that's what happens here: 1) Acceptor thread is started at NioEndpoint:792; 2) Main thread allocates the pollers array (initially filled with nulls) at NioEndpoint:796; 3) Acceptor thread immediately catches an incoming connection and accesses the still uninitialized pollers array (inside the setSocketOptions method called at NioEndpoint:1169). Seems that poller threads should be created before starting acceptors; also, poller-related fields shall be marked volatile.
Http11AprProtocol has the same bug.
Filip fixed this for 6.0.15 onwards. APR was fixed even earlier.