I am working on spring boot on both command line runner and web application. Both applications require to be implemented with oracle wallet, so I implemented the oracle wallet. The command line runner is able to connect to database using spring jdbc template using oracle datasource but same configuration is not been able to create the bean for datasource object. When same has been implemented with database user name and password, I am able to connect.
I am taking help from this post - [Connect to Oracle DB from Spring-jdbc with Oracle Wallet authentification
with code similar to,
System.setProperty("oracle.net.tns_admin", "path/to/your/tnsnames");
OracleDataSource ds = new OracleDataSource();
Properties props = new Properties();
props.put("oracle.net.wallet_location", "(source=(method=file)(method_data=(directory=path/to/your/wallet)))");
ds.setConnectionProperties( props );
ds.setURL("jdbc:oracle:thin:/@dbAlias"); //dbAlias should match what's in your tnsnames
return ds;
I have all my properties set from application.properties of boot application and I am getting null pointer exception on creating the datasource.
Any pointer or help in this regard will be much appreciated.