java.io.FileNotFoundException: NONE (The system cannot find the file specified) When Using CAC Smartcard as the Java Keystore to Connect to a Database via SSL
(Doc ID 2268165.1)
Last updated on OCTOBER 31, 2022
Applies to:
JDBC - Version 12.1.0.1.0 and laterInformation in this document applies to any platform.
Symptoms
Not able to use a CAC smartcard as the java keystore to connect to a database via SSL using JDBC driver 12.2.0.1. When using the file based keystore or Oracle Wallet all works just fine; however, when using the CAC smatcard the error "java.io.FileNotFoundException: NONE (The system cannot find the file specified)" comes up.
java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:489)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:553)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:254)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:528)
at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:280)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:207)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:157)
Caused by: oracle.net.ns.NetException: The Network Adapter could notestablish the connection
at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:439)
at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:454)
at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:693)
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:251)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1140)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:340)
... 10 more
Caused by: oracle.net.ns.NetException: Unable to initialize ssl context.
at oracle.net.nt.CustomSSLSocketFactory.getSSLSocketFactory(CustomSSLSocketFactory.java:327)
at oracle.net.nt.TcpsNTAdapter.connect(TcpsNTAdapter.java:119)
at oracle.net.nt.ConnOption.connect(ConnOption.java:133)
at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:405)
... 15 more
Caused by: oracle.net.ns.NetException: Unable to initialize the key store.
at oracle.net.nt.CustomSSLSocketFactory.getKeyManagerArray(CustomSSLSocketFactory.java:369)
at oracle.net.nt.CustomSSLSocketFactory.getSSLSocketFactory(CustomSSLSocketFactory.java:308)
... 18 more
Caused by: java.io.FileNotFoundException: NONE (The system cannot find the file specified)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:93)
at oracle.net.nt.CustomSSLSocketFactory.getKeyManagerArray(CustomSSLSocketFactory.java:358)
... 19 more
Documentation 3.5 Tokens as JSSE Keystore and Trust Stores shows that System.setProperty("javax.net.ssl.trustStore", "NONE"); and System.setProperty("javax.net.ssl.keyStore", "NONE"); are the proper way to do this; however the error seems to indicate it is looking for a file called "NONE".
Basically when using a regular Oracle wallet file (.sso file) as a keystore, the code works:
ERROR
-----------------------
java.io.FileNotFoundException: NONE (The system cannot find the file specified)
STEPS
-----------------------
The issue can be reproduced at will with the following steps:
1. Set configuration of smart card as:
name = jdbctest
library = <DIR>\\opensc-pkcs11.dll
slot = -1
2. Specify keystore as 'NONE' and keyStoreType as 'Windows-My
Changes
Cause
To view full details, sign in with your My Oracle Support account. |
|
Don't have a My Oracle Support account? Click to get started! |
In this Document
Symptoms |
Changes |
Cause |
Solution |
References |