The issue is due to the mismatch of
The official document says,
If you're using JDK8 or above, you could use ojdbc8.jar that ships with Oracle Database 18c. Alternatively, you can also use ojdbc8.jar that ships with OracleDatabase 184.108.40.206. If you're still on JDK7 or even JDK6, you can use ojdbc7.jar or ojdbc6.jar respectively. These ship with Oracle Database 220.127.116.11, and are downloadable from this page.
My project is using JDK 7 and project has custom ojdbc6 jar and version 11.3. Then I replace
ojdbc7.jar(downloaded from https://www.oracle.com/database/technologies/jdbc-upc-downloads.html) with my custom jar. Due to this change above exception is gone and the code works well.