मैं एक आरईएसटी एंडपॉइंट पर कॉल करने के लिए क्लाइंट साइड पर स्प्रिंग रीस्टटेम्प्लेट का उपयोग कर रहा हूं। इस मामले में ग्राहक एक स्प्रिंग ऐप है और टोमकैट सर्वलेट कंटेनर है।मुझे एसएसएल हैंडशेक के लिए ट्रस्टस्टोर क्यों नहीं मिल सकता है?
मैं एक HTTPS एंडपॉइंट से कनेक्शन बनाने में समस्याएं चला रहा हूं। मुझे एक त्रुटि मिल रही है जो इंगित करती है कि इसे ट्रस्टस्टोर के लिए वैध पथ नहीं मिल रहा है। मैं इसे कहां निर्दिष्ट कर सकता हूं? क्या यह कंटेनर स्तर या एप्लिकेशन कॉन्फ़िगरेशन (स्प्रिंग) स्तर पर किया जाता है?
स्टैक ट्रेस:
org.springframework.web.client.ResourceAccessException: I/O error:
sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target;
nested exception is javax.net.ssl.SSLHandshakeException:
sun.security.validator.ValidatorException:
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target
org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:330)
org.springframework.web.client.RestTemplate.execute(RestTemplate.java:292)
org.springframework.web.client.RestTemplate.postForObject(RestTemplate.java:227)
कहाँ कि कोड लिखने के लिए? – kamaci
आप इसे कहीं भी कहीं भी लिख सकते हैं, क्योंकि यह SSLContext क्लास पर एक स्थिर कॉल कर रहा है। जब तक आप इसे उसी क्लासलोडर संदर्भ में कॉल करते हैं और पहले HttpClient कॉल से पहले आपको जाना अच्छा होना चाहिए। –
बस यह सुनिश्चित करने के लिए: ऊपर वर्णित एसएसएलकॉन्टेक्स्ट के ट्रस्टमैनेजर को बदलना एक सतत कार्रवाई नहीं है, है ना? तो आवेदन शुरू होने पर हर बार इसे करने की जरूरत है। – ptikobj