on 10-17-2023 4:45 AM
We're trying to implement a java map in our system (SAP PI 7.5). Inside this java map is a custom library that creates an https connection to another server. The library uses the javax.net.ssl package to do that. For our map to initialize the connection, we can only use a function available in the library which is described below:
httpConfig = HttpPublicKeyRepository.HttpConfig.builder()
.baseURL("https://server:port")
.sslContext(loadSSLContext("TrustedCAs"))
.retryContext(HttpClientWithRetry.DEFAULT_RETRY_CONTEXT)
.environment(env)
.build();
Upon running the application, we encountered the following error.
java.lang.ClassCastException: com.sap.engine.httpdsrclient.protocols.instrumented.https.DSRHttpsURLConnection (loaded by library:tc~bl~dsrhttpclient@96432 com.sap.engine.boot.loader.ResourceMultiParentClassLoader) cannot be cast to javax.net.ssl.HttpsURLConnection (loaded by <bootstrap>)
How can we ensure that our program will use the HttpsURLConnection under javax.net.ssl and not the one defined in the VM parameter java.protocol.handler.pkgs?
Hi Christopher,
Please try removing all import statements related to java.protocol.handler.pkgs .
Then try to execute the code containing on this part of the code.
Java will show you exact error.
Regards
Anupam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.