When I am starting the server, it is getting started but I am getting errors. Due to this not able to do APIs call. These are the errors.
Jul 18, 2018 11:05:36 PM com.mongodb.ServerMonitor$ServerMonitorRunnable run
WARNING: Exception in monitor thread during notification of server state change
java.lang.NoClassDefFoundError: com/mongodb/ChangeEvent
at com.mongodb.ServerMonitor$ServerMonitorRunnable.sendStateChangedEvent(ServerMonitor.java:136)
at com.mongodb.ServerMonitor$ServerMonitorRunnable.run(ServerMonitor.java:119)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: Illegal access: this web application instance has been stopped already. Could not load [com.mongodb.ChangeEvent]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1362)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1219)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)
... 3 more
Caused by: java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [com.mongodb.ChangeEvent]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1372)
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1360)
... 5 more
Jul 18, 2018 11:05:36 PM org.apache.catalina.loader.WebappClassLoaderBase checkStateForResourceLoading
INFO: Illegal access: this web application instance has been stopped already. Could not load [java.util.concurrent.locks.Condition]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [java.util.concurrent.locks.Condition]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1372)
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1360)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1219)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)
at com.mongodb.ServerMonitor$ServerMonitorRunnable.waitForSignalOrTimeout(ServerMonitor.java:177)
at com.mongodb.ServerMonitor$ServerMonitorRunnable.waitForNext(ServerMonitor.java:158)
at com.mongodb.ServerMonitor$ServerMonitorRunnable.run(ServerMonitor.java:124)
at java.lang.Thread.run(Unknown Source)
Exception in thread "cluster-2-34.214.191.171:27017" java.lang.NoClassDefFoundError: java/util/concurrent/locks/Condition
at com.mongodb.ServerMonitor$ServerMonitorRunnable.waitForSignalOrTimeout(ServerMonitor.java:177)
at com.mongodb.ServerMonitor$ServerMonitorRunnable.waitForNext(ServerMonitor.java:158)
at com.mongodb.ServerMonitor$ServerMonitorRunnable.run(ServerMonitor.java:124)
at java.lang.Thread.run(Unknown Source)
2
Answers
The problem was with this class
@Component public class APIsAuthentications implements Filter
which is used for
APIs Authentications
. In this class there is a method called:@Override public void doFilter(ServletRequest servletRequest, ServletResponse response, FilterChain chain)throws IOException, ServletException
this is validating
APIs
and expectingtoken/authentication
inrequests header
. HeredoFilter
method validating APIs for base URLs also and giving response401
. There is no issues with tomcat.Finally, I put the one condition in
doFilter
method if it'sbase URLs/Open URLs
then there will no validations for these APIs.My Base URL for local machines:
http://localhost:8080/projects/
Problem solved !!! :)
Apparently your project is not packaged properly.
Please check your webapps/ROOT/WEB-INF/lib folder (under your tomcat directory) to see if your dependencies are copied over or not.