Nullpointer exception when starting tomcat

My tomcat server does not start in eclipse, which worked fine, but now it shows the following exception. although it works great beyond the eclipse. but whenever I try to start the server, the following exception occurs and it shows a message = "running Tomcat server v8.0 server on localhost encountered a problem"

Dec 08, 2014 4:35:16 PM org.apache.coyote.AbstractProtocol destroy INFO: Destroying ProtocolHandler ["ajp-nio-8009"] Dec 08, 2014 4:35:16 PM org.apache.coyote.AbstractProtocol destroy SEVERE: Failed to destroy end point associated with ProtocolHandler ["ajp-nio-8009"] java.lang.NullPointerException at org.apache.tomcat.util.net.NioEndpoint.releaseCaches(NioEndpoint.java:307) at org.apache.tomcat.util.net.NioEndpoint.unbind(NioEndpoint.java:482) at org.apache.tomcat.util.net.AbstractEndpoint.destroy(AbstractEndpoint.java:795) at org.apache.coyote.AbstractProtocol.destroy(AbstractProtocol.java:531) at org.apache.catalina.connector.Connector.destroyInternal(Connector.java:1023) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305) at org.apache.catalina.core.StandardService.destroyInternal(StandardService.java:588) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305) at org.apache.catalina.core.StandardServer.destroyInternal(StandardServer.java:850) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305) at org.apache.catalina.startup.Catalina.start(Catalina.java:629) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485) 
+5
source share
2 answers

It seems that stacktrace shows that Tomcat has already decided that the launch is running and that the NPE occurred while trying to shut down.

I expect the real problem (i.e. the one that caused Tomcat to give up trying to run) earlier in the log file.


Indeed, the Tomcat source code confirms this:

 protected void releaseCaches() { this.keyCache.clear(); this.nioChannels.clear(); this.processorCache.clear(); if ( handler != null ) handler.recycle(); } 

A NullPointerException here means that keyCache or nioChannels or processorCache is null . (I think) what can happen only if during the construction of the NioEndPoint object something went wrong, because these three fields are private final . Or at least they are in the version I was looking at.

+1
source

This happened to me because I misconfigured my Tomcat server. I managed to delete it and create a new record on the server.

+1
source

Source: https://habr.com/ru/post/1208572/


All Articles