Common Java Errors and How to Fix Them
Browse all documented Java errors with detailed explanations, root causes, and step-by-step fixes.
java: cannot find symbol symbol: class Scanner location: class Main
This error occurs when the Java compiler cannot find a class, method, or variable that is used in the code. In this case…
Cannot find symbol: class Scanner on line 5
This error occurs when Java cannot find a class, method, or variable that is being used in the code. It is often caused …
Cannot get JDBC connection; nested exception is com.mysql.cj.jdbc.exceptions.Com
This error occurs when the Java application is unable to establish a connection to the database. It usually happens due …
ORA-12545: TNS:Cannot register with TSLS (TNS Listener Service)
This error occurs when the Oracle JDBC driver is unable to establish a connection with the TNS Listener Service due to a…
java.util.ConcurrentModificationException: Cannot modify a Collection while it i
This error occurs when a program attempts to modify a collection (like a list or set) while it is being iterated over by…
Error executing SQL query: Cannot insert explicit value for identity column in t
This error occurs when you're trying to insert a value into an auto-incrementing primary key column in a database, but t…
Incompatible types: int cannot be converted to String
This error occurs when you are trying to assign a value of one data type to a variable that is declared with a different…
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating
This error occurs when Spring cannot find or autowire a required bean, often due to a missing or incorrect dependency co…
Parameter index out of range: 2, query was: SELECT * FROM users WHERE username =
This error occurs when the number of parameters in a SQL query does not match the number of placeholders (represented by…
java: cannot find symbol variable 'user' in method 'main' at line 10
This error occurs when the compiler cannot find the definition of a variable, method, or class that is being used in the…
java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.Threa
This error occurs when a task is submitted to an executor service that is shutting down or has been terminated.…
Syntax error on token 'int', delete this token
This error occurs when the compiler encounters unexpected syntax in the code, making it difficult to parse and compile.…
Have a Java error that's not listed? Get an instant explanation.
Explain Another Error