1
java-sdk 创建AipOcr报错
18765805726 发布于2020-06 浏览:1872 回复:1
0
收藏

java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
at javax.net.ssl.DefaultSSLSocketFactory.throwException(SSLSocketFactory.java:248)
at javax.net.ssl.DefaultSSLSocketFactory.createSocket(SSLSocketFactory.java:255)
at sun.net.www.protocol.https.HttpsClient.createSocket(HttpsClient.java:405)
at sun.net.NetworkClient.doConnect(NetworkClient.java:162)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
at sun.net.www.protocol.https.HttpsClient.(HttpsClient.java:264)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1199)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:162)
at com.baidu.aip.http.AipHttpClient.post(AipHttpClient.java:68)
at com.baidu.aip.auth.DevAuth.oauth(DevAuth.java:48)
at com.baidu.aip.client.BaseClient.getAccessToken(BaseClient.java:189)
at com.baidu.aip.client.BaseClient.preOperation(BaseClient.java:245)
at com.baidu.aip.ocr.AipOcr.idcard(AipOcr.java:447)
at com.baidu.aip.ocr.AipOcr.idcard(AipOcr.java:476)
at com.sunyard.ocr.baidu.BaiduClient.idcard(BaiduClient.java:120)
at com.sunyard.ocr.baidu.BaiduClient.requestBai(BaiduClient.java:97)
at com.sunyard.ocr.baidu.thread.BaiduThreadAbstract.request(BaiduThreadAbstract.java:52)
at com.sunyard.ocr.baidu.thread.BaiduCardHandler.run(BaiduCardHandler.java:43)
Caused by: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
at java.security.Provider$Service.newInstance(Provider.java:1617)
at sun.security.jca.GetInstance.getInstance(GetInstance.java:236)
at sun.security.jca.GetInstance.getInstance(GetInstance.java:164)
at javax.net.ssl.SSLContext.getInstance(SSLContext.java:156)
at javax.net.ssl.SSLContext.getDefault(SSLContext.java:96)
at javax.net.ssl.SSLSocketFactory.getDefault(SSLSocketFactory.java:122)
at javax.net.ssl.HttpsURLConnection.getDefaultSSLSocketFactory(HttpsURLConnection.java:332)
at javax.net.ssl.HttpsURLConnection.(HttpsURLConnection.java:289)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.(HttpsURLConnectionImpl.java:94)
at sun.net.www.protocol.https.Handler.openConnection(Handler.java:62)
at java.net.URL.openConnection(URL.java:1028)
at com.baidu.aip.http.AipHttpClient.post(AipHttpClient.java:55)
... 9 more
Caused by: java.security.PrivilegedActionException: java.io.FileNotFoundException: D:\SSL\204\client\client.p12 (系统找不到指定的路径。)
at java.security.AccessController.doPrivileged(Native Method)
at sun.security.ssl.SSLContextImpl$DefaultManagersHolder.getKeyManagers(SSLContextImpl.java:829)
at sun.security.ssl.SSLContextImpl$DefaultManagersHolder.(SSLContextImpl.java:765)
at sun.security.ssl.SSLContextImpl$DefaultSSLContext.(SSLContextImpl.java:920)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.security.Provider$Service.newInstance(Provider.java:1595)
... 20 more
Caused by: java.io.FileNotFoundException: D:\SSL\204\client\client.p12 (系统找不到指定的路径。)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.(FileInputStream.java:138)
at java.io.FileInputStream.(FileInputStream.java:93)
at sun.security.ssl.SSLContextImpl$DefaultManagersHolder$2.run(SSLContextImpl.java:833)
at sun.security.ssl.SSLContextImpl$DefaultManagersHolder$2.run(SSLContextImpl.java:830)
... 29 more
20200630 14:33:25.529 [Thread-33] [WARN ] BaseClient.getAccessToken-222: oauth get error, current state: STATE_TRUE_CLOUD_USER
java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
at javax.net.ssl.DefaultSSLSocketFactory.throwException(SSLSocketFactory.java:248)
at javax.net.ssl.DefaultSSLSocketFactory.createSocket(SSLSocketFactory.java:255)
at sun.net.www.protocol.https.HttpsClient.createSocket(HttpsClient.java:405)
at sun.net.NetworkClient.doConnect(NetworkClient.java:162)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
at sun.net.www.protocol.https.HttpsClient.(HttpsClient.java:264)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1199)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:162)
at com.baidu.aip.http.AipHttpClient.post(AipHttpClient.java:68)
at com.baidu.aip.client.BaseClient.requestServer(BaseClient.java:292)
at com.baidu.aip.ocr.AipOcr.idcard(AipOcr.java:458)
at com.baidu.aip.ocr.AipOcr.idcard(AipOcr.java:476)
at com.sunyard.ocr.baidu.BaiduClient.idcard(BaiduClient.java:120)
at com.sunyard.ocr.baidu.BaiduClient.requestBai(BaiduClient.java:97)
at com.sunyard.ocr.baidu.thread.BaiduThreadAbstract.request(BaiduThreadAbstract.java:52)
at com.sunyard.ocr.baidu.thread.BaiduCardHandler.run(BaiduCardHandler.java:43)
Caused by: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
at java.security.Provider$Service.newInstance(Provider.java:1617)
at sun.security.jca.GetInstance.getInstance(GetInstance.java:236)
at sun.security.jca.GetInstance.getInstance(GetInstance.java:164)
at javax.net.ssl.SSLContext.getInstance(SSLContext.java:156)
at javax.net.ssl.SSLContext.getDefault(SSLContext.java:96)
at javax.net.ssl.SSLSocketFactory.getDefault(SSLSocketFactory.java:122)
at javax.net.ssl.HttpsURLConnection.getDefaultSSLSocketFactory(HttpsURLConnection.java:332)
at javax.net.ssl.HttpsURLConnection.(HttpsURLConnection.java:289)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.(HttpsURLConnectionImpl.java:94)
at sun.net.www.protocol.https.Handler.openConnection(Handler.java:62)
at java.net.URL.openConnection(URL.java:1028)
at com.baidu.aip.http.AipHttpClient.post(AipHttpClient.java:55)
at com.baidu.aip.auth.DevAuth.oauth(DevAuth.java:48)
at com.baidu.aip.client.BaseClient.getAccessToken(BaseClient.java:189)
at com.baidu.aip.client.BaseClient.preOperation(BaseClient.java:245)
at com.baidu.aip.ocr.AipOcr.idcard(AipOcr.java:447)
... 5 more
Caused by: java.security.PrivilegedActionException: java.io.FileNotFoundException: D:\SSL\204\client\client.p12 (系统找不到指定的路径。)
at java.security.AccessController.doPrivileged(Native Method)
at sun.security.ssl.SSLContextImpl$DefaultManagersHolder.getKeyManagers(SSLContextImpl.java:829)
at sun.security.ssl.SSLContextImpl$DefaultManagersHolder.(SSLContextImpl.java:765)
at sun.security.ssl.SSLContextImpl$DefaultSSLContext.(SSLContextImpl.java:920)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.security.Provider$Service.newInstance(Provider.java:1595)
... 20 more
20200630 14:33:25.910 [Thread-33] [WARN ] BaseClient.requestServer-317: call failed! response status: 0, data:
Caused by: java.io.FileNotFoundException: D:\SSL\204\client\client.p12 (系统找不到指定的路径。)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.(FileInputStream.java:138)
at java.io.FileInputStream.(FileInputStream.java:93)
at sun.security.ssl.SSLContextImpl$DefaultManagersHolder$2.run(SSLContextImpl.java:833)
at sun.security.ssl.SSLContextImpl$DefaultManagersHolder$2.run(SSLContextImpl.java:830)
... 29 more

收藏
点赞
0
个赞
共1条回复 最后由用户已被禁言回复于2022-04
#2用户已被禁言回复于2020-06

确保你的JDK是1.7+版本以上

 

把你初始化的代码最好发出来

1
TOP
切换版块