Java Basics
java.util.regex.PatternSyntaxException: Illegal repetition near index
The java.util.regex.PatternSyntaxException: Illegal repetition near index 0 exception occurs when the regular expression special characters such as $ { } are used inside the java search string. When processing in the regular expression, the special characters have significant meaning. It is necessary to add a special character with an escape
java.util.regex.PatternSyntaxException: Illegal character range near index
The java exception java.util.regex.PatternSyntaxException: Illegal character range near index occurs when an Illegal or inappropriate character range is used to match the regular expression. The range is defined by a hyphen in between minimum and maximum values. If an invalid minimum or maximum value is specified in the regular expression,
How to fix NullPointerException in Java
The java.lang.NullPointerException occurs when a java variable does not point to any object and is accessed for any operation. The java.lang.NullPointerException is a runtime exception. The java.lang.NullPointerException is an exception to runtime. The java NullPointerException occurs when a variable is declared but is not assigned to an object until you
How to solve java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
The java.lang.ClassNotFoundException: com.mysql.jdbc.Driver exception occurs if the MySQL JDBC driver class can not found in the java class path. The Class.forName() fails to loads the mysql driver class that is not available in the class path. If the MySQL JDBC driver jar is not available, or if the jar is
java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/testdb
The java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/testdb exception occurs if the suitable driver is not found to connect mysql database from java application. The MySQL JDBC driver is not loaded in java either because the driver jar is not available in the class path, or because it is not
Loading class `com.mysql.jdbc.Driver’. This is deprecated. The new driver class
The Java exception Loading class com.mysql.jdbc.Driver'. This is deprecated. The new driver class iscom.mysql.cj.jdbc.Driver’. occurs because the deprecated mysql driver class is configured or used in the mysql database connection. This exception will be shown in framework such as spring, spring boot, hibernate etc. The MySQL JDBC driver class is
Java Thread Synchronization not working – Troubleshoot
Synchronized keyword is not working in java because the thread lock object is not correctly attached to the thread. Because of this, the Java thread synchronisation doesn’t work as expected. The main reason is that each thread will create a new object and lock the object. There’s no synchronisation going
Java Synchronized Method not working – Troubleshoot
Synchronized method is not working in java because the lock on the synchronised method is not attached to a single object. When the Java method is synchronised with the synchronised keyword, the threads are synchronised to access the Java method If the java synchronised method lock is not properly attached
Synchronized Block not working in Java – Troubleshoot
Synchronized block is not working in java because the lock on the synchronised block is not attached to a single object. When the Java code block is synchronised with the synchronised keyword, the threads are synchronised to access the Java code block. If the java synchronised block lock is not
No enclosing instance of type is accessible
The java No enclosing instance of type is accessible. Must qualify the allocation with an enclosing instance of type (e.g. x.new A() where x is an instance of ). exception happens when an instance is created for an inner class in the outer class static method. The static method attempts