Getting NoSuchMethodError: javax.servlet.ServletContext.addServlet in Spring Boot while running a Spring MVC application

If you want to find out where the class is being loaded from, try java -verbose:class -jar foo.jar | grep javax.servlet.ServletContext where foo.jar is the fat JAR produced by Gradle or Maven. For example, the ServletContext class could be getting read from an older servlet-api JAR in a JDK extensions directory instead of your Maven … Read more

Resolving dependency problems in Apache Spark

Apache Spark’s classpath is built dynamically (to accommodate per-application user code) which makes it vulnerable to such issues. @user7337271’s answer is correct, but there are some more concerns, depending on the cluster manager (“master”) you’re using. First, a Spark application consists of these components (each one is a separate JVM, therefore potentially contains different classes … Read more

“Error: Main method not found in class MyClass, please define the main method as…”

When you use the java command to run a Java application from the command line, e.g., java some.AppName arg1 arg2 … the command loads the class that you nominated and then looks for the entry point method called main. More specifically, it is looking for a method that is declared as follows: package some; public … Read more

Interpreting java.lang.NoSuchMethodError message

From section 4.3.2 of the JVM Spec: Character Type Interpretation —————————————— B byte signed byte C char Unicode character D double double-precision floating-point value F float single-precision floating-point value I int integer J long long integer L<classname>; reference an instance of class S short signed short Z boolean true or false [ reference one array … Read more

How do I fix a NoSuchMethodError?

Without any more information it is difficult to pinpoint the problem, but the root cause is that you most likely have compiled a class against a different version of the class that is missing a method, than the one you are using when running it. Look at the stack trace … If the exception appears … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)