I'm using Jetty for a long time. This is the first time I'm getting this error,and I received a lot of this error which made the server not responding well. I'm using Jetty 9.3.9 only to handle websockets connections.
Exception in thread "qtp147268537-19366" java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
at org.eclipse.jetty.util.log.JettyAwareLogger.log(JettyAwareLogger.java:607)
at org.eclipse.jetty.util.log.JettyAwareLogger.warn(JettyAwareLogger.java:431)
at org.eclipse.jetty.util.log.Slf4jLog.warn(Slf4jLog.java:69)
at org.eclipse.jetty.util.log.Slf4jLog.warn(Slf4jLog.java:64)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:646)
at java.lang.Thread.run(Thread.java:745)
There were so many errors in a period of 1 hour, that made the server not accepting any new connections, but currently established connections worked well.
After digging more into the problem I think this has to do with this
_logger.log(marker, FQCN, level, msg, null, t);
I'm using slf4j-api-1.5.3.jar and slf4j-log4j12-1.5.3.jar. Do I need to upgrade slf4j to a newer version , because it might break some other things in my program? If yes, what is the minimum required version? Or the problem is from something else?
Yes, you need to upgrade your version of slf4j.
Going to slf4j of at least version 1.6.6 is recommended. (feel free to use something even newer, like version 1.7.12)
The org.slf4j.api.LocationAware
class was added to support several of the slf4j bridges: jcl-over-slf4j, jul-to-slf4j and log4j-over-slf4j, as well as wrapped loggers.
Jetty's Slf4jLog implementation makes use of wrapped loggers, and as such it needs this class / method to exist.