In this tutorial I am going to explain one of the most common Java exception that is well known by all the Java developers. IOExceptions are thrown when there is any input / output file operation issues while application performing certain tasks accessing the files. IOException is a checked exception and application developer has to handle in …
Java Exceptions
Java InvalidPropertiesFormatException Example
When we are using the collection of properties, if the input does not conform to the valid XML document type with the appropriate properties specification at that time an exception is thrown called InvalidPropertiesFormatException, to indicate operation could not be completed. This example explains about that exception. Java InvalidPropertiesFormatException Class Declaration In the above declaration, …
javax.naming.NameNotFoundException: Name is not bound in this Context Exception
When you are working with the JNDI look up, quite often you would encounter the javax.naming.NameNotFoundException thrown by your application. JNDI names are registered in the registery, if you try to access the name which is not registered or by the wrong format, you would get the javax.naming.NameNotFoundException. Lets look at the below code for …
java.sql.SQLException: Can’t call commit when autocommit=true Exception
When you work with JDBC application, by default the auto commit is set to true, after the transaction is completed all the transactions are committed to the database. When it is set as true, you can not explicitly call the commit method. If you call the connection.commit() method, then the below exception will be thrown.
How To Resolve java.lang.IllegalAccessException
This example shows when the java.lang.IllegalAccessException is thrown in your application. When an application tries to reflectively create an instance (other than an array), set or get a field, or invoke a method, if that method is not accessible to your application (probably the modifier is private or not accessible one), then your application will …
FileNotFoundException in Java
If you are working with the File APIs in Java, it is common that you would encounter the FileNotFoundException. This is a subclass of IOException. This Java exception is thrown by the classes FileInputStream, FileOutputStream, and RandomAccessFile. These classes trying to access a file in the system for the purposes of reading or writing into …