Not able to connect to Trial S4Instance in CAL from SAP BTP Destination service - sap-cloud-sdk

I am developing SAP Extension Application using java 1.8, Spring Boot and SAP SDK.
I am deploying this application in SAP BTP (SAP Cloud platform).
My S4HANA instance is trial version and it is running in CAL.
My Spring Boot application could talk to S4HANA instance from my local after doing below steps.
provided entries in /etc/hosts
exported certificate by using open-ssl command
Added the exported certificate to Java CACerts
Used Domain Name in application as destination
I have deployed same application to SAP BTP and configured the destination from Sub Domain -> Space -> Instances -> Destinations
Here I could give only IP address only as the domain name is not recognised and provided the certificate which I was using in my local. But it is not working, the application is failing with below error.
2021-04-05T22:04:24.42+0530 [APP/PROC/WEB/0] OUT Caused by: java.security.KeyStoreException: CERTIFICATE not found
2021-04-05T22:04:24.42+0530 [APP/PROC/WEB/0] OUT at java.security.KeyStore.getInstance(KeyStore.java:851) ~[na:1.8.0_281]
2021-04-05T22:04:24.42+0530 [APP/PROC/WEB/0] OUT at com.sap.cloud.sdk.cloudplatform.connectivity.ScpCfDestination.getKeyStore(ScpCfDestination.java:257) ~[connectivity-scp-cf-2.1.2.jar:na]
2021-04-05T22:04:24.42+0530 [APP/PROC/WEB/0] OUT ... 63 common frames omitted
2021-04-05T22:04:24.42+0530 [APP/PROC/WEB/0] OUT Caused by: java.security.NoSuchAlgorithmException: CERTIFICATE KeyStore not available
2021-04-05T22:04:24.42+0530 [APP/PROC/WEB/0] OUT at sun.security.jca.GetInstance.getInstance(GetInstance.java:159) ~[na:1.8.0_281]
2021-04-05T22:04:24.42+0530 [APP/PROC/WEB/0] OUT at java.security.Security.getImpl(Security.java:697) ~[na:1.8.0_281]
2021-04-05T22:04:24.42+0530 [APP/PROC/WEB/0] OUT at java.security.KeyStore.getInstance(KeyStore.java:848) ~[na:1.8.0_281]
2021-04-05T22:04:24.42+0530 [APP/PROC/WEB/0] OUT ... 64 common frames omitted
Looks like the issue withe providing certificate. Please help me by providing inputs to solve this issue.

The stacktrace appears to reveal that you use an outdated SAP Cloud SDK version.
It contains the jar file name connectivity-scp-cf-2.1.2.jar indicating that you use version 2.1.2.
We recommend using the SAP Cloud SDK version 3 which is a major advancement compared to the version 2. Check out the release notes for further reference.

Related

Invoke Secured (https) REST API endpoint from WSO2 Integration Studio/Micro Integrator

I am trying to invoke a secured endpoint (https) from wso2 integration studio8.0/MI 4.0. Created integration project, created an endpoint with the url with secured endpoint address, provided on header with the transport scope as required for the secured endpoint. I got the public key certificate (.p7b/.cer) and imported to the trust store using key tool utility.
keytool -import -alias aliasName -file public-key-from-browser.cer -keystore client-truststore.jks -storepass password. Provided the truststore file path in deployment.toml in integration studio/MI4.0 but getting the following exception. Please let me know how to resolve the exception.
[2022-01-17 10:28:09,696] ERROR {TargetHandler} - I/O error: General SSLEngine problem javax.net.ssl.SSLHandshakeException: General SSLEngine problem
at sun.security.ssl.Handshaker.checkThrown(Handshaker.java:1566)
at sun.security.ssl.SSLEngineImpl.checkTaskThrown(SSLEngineImpl.java:545)
at sun.security.ssl.SSLEngineImpl.writeAppRecord(SSLEngineImpl.java:1217)
at sun.security.ssl.SSLEngineImpl.wrap(SSLEngineImpl.java:1185)
at javax.net.ssl.SSLEngine.wrap(SSLEngine.java:471)
at org.apache.http.nio.reactor.ssl.SSLIOSession.doWrap(SSLIOSession.java:270)
at org.apache.http.nio.reactor.ssl.SSLIOSession.doHandshake(SSLIOSession.java:316)
at org.apache.http.nio.reactor.ssl.SSLIOSession.isAppInputReady(SSLIOSession.java:541)
at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:120)
at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276)
at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:591)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.net.ssl.SSLHandshakeException: General SSLEngine problem
at sun.security.ssl.Alerts.getSSLException(Alerts.java:198)
at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1729)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:333)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:325)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1688)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:226)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1082)
at sun.security.ssl.Handshaker$1.run(Handshaker.java:1015)
at sun.security.ssl.Handshaker$1.run(Handshaker.java:1012)
at java.security.AccessController.doPrivileged(Native Method)
at sun.security.ssl.Handshaker$DelegatedTask.run(Handshaker.java:1504)
at org.apache.http.nio.reactor.ssl.SSLIOSession.doRunTask(SSLIOSession.java:288)
at org.apache.http.nio.reactor.ssl.SSLIOSession.doHandshake(SSLIOSession.java:356)
... 9 more
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:450)
at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:317)
at sun.security.validator.Validator.validate(Validator.java:262)
at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:330)
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:289)
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:144)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1675)
Make sure that you have imported the chain of certificates. If you have already done that better to enable ssl debug logs [1] and analyse the ssl logs to identify what is the exact cause of the issue.
[1]-https://dilsichandrasena.medium.com/how-to-enable-ssl-debug-logs-for-wso2-products-6de7276ffe10

Provider is not supported, or was incorrectly entered

I have installed gerrit server setup in localhost. And after making the successful connection the Web UI has been launched. There i have registered with my gmail id in "Sign in with a Launchpad ID" option.
Its worked earlier, but now it shows the error "Provider is not supported, or was incorrectly entered." when i try to login. I had searched a lot and found some solution regarding the security issues in the installed java in the system. I have Oracle Jdk8 not OpenJdk in my system. so should i have to switch to Open Jdk. Here is my error log messages from log file.
Caused by: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
at sun.security.validator.PKIXValidator.<init>(PKIXValidator.java:90)
at sun.security.validator.Validator.getInstance(Validator.java:179)
at sun.security.ssl.X509TrustManagerImpl.getValidator(X509TrustManagerImpl.java:312)
at sun.security.ssl.X509TrustManagerImpl.checkTrustedInit(X509TrustManagerImpl.java:171)
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:184)
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1491)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:914)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
... 66 more
Caused by: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
at java.security.cert.PKIXParameters.setTrustAnchors(PKIXParameters.java:200)
at java.security.cert.PKIXParameters.<init>(PKIXParameters.java:120)
at java.security.cert.PKIXBuilderParameters.<init>(PKIXBuilderParameters.java:104)
at sun.security.validator.PKIXValidator.<init>(PKIXValidator.java:88)
... 78 more
Issue Fixed !
As i have been using Oracle Java 8, i have installed Open Jdk 7 with the following commnad.
sudo apt-get install ca-certificates-java
But issue resolved only when i have changed java home variable in gerrit.config file.
javaHome = /usr/lib/jvm/java-7-openjdk-amd64/jre
Now the issues fixed for me..

while bootstrapping a recipe on windows machine ..facing issues like Network error

Bootstrapping Chef on windows
**ERROR: Network Error: Connection refused - connect(2)
Check your knife configuration and network settings**
I have installed knife windows pluggin and also configured the winrm but after doing this also .. i am facing this issue .
I could not resolve this. Has anyone come across this problem and found a solution?

java.security.NoSuchAlgorithmException:Algorithm PBKDF2WithHmacSHA1 not available

My webserver, orion 1.5.4, run on jre 1.4.2, when I run
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
the following exception is thrown
java.security.NoSuchAlgorithmException:Algorithm PBKDF2WithHmacSHA1 not available
I google and find need to add Bouncy Castle provider, so I download bcprov-jdk14-150.jar and placed it in classpath, and download the unlimited policy files in the JVM, then when I run the program code, error thrown in line
aesCipher.init(Cipher.DECRYPT_MODE,secretKey, new IvParameterSpec(ivByte));
the error message is
Caused by: java.lang.SecurityException: Cannot set up certs for trusted CAs
at javax.crypto.SunJCE_b.(DashoA12275)
... 15 more
Caused by: java.lang.SecurityException: Jurisdiction policy files are not signed by trusted signers!
at javax.crypto.SunJCE_b.a(DashoA12275)
at javax.crypto.SunJCE_b.g(DashoA12275)
at javax.crypto.SunJCE_b.f(DashoA12275)
at javax.crypto.SunJCE_t.run(DashoA12275)
at java.security.AccessController.doPrivileged(Native Method)
... 16 more
how to solve it?
I found the problem, I download the unlimited policy files for java 1.6 wrongly, should download for java 1.4.
thanks

issue with running java me source code on emulator

I just finished installing all the necessary tools for Java ME and I am getting the following error:
Installing suite from: http://127.0.0.1:58255/Homework1.jad
*** Error ***
A problem occured during deploying application from http://127.0.0.1:58255/Homework1.jad
Reason:
Either the configuration or profile is not supported.
It can be either the configuration or profile.
Compare the Microedition Configuration (CLDC) and Microedition Profile at Application Descriptor against your Device Configurations in Project->Properties->Java ME->Edit
They should be the same.

Resources