I'm trying to mock okta(using okta-jwt-helper - v0.5.0), here I need url to be like https://someUrl.com, thus I'm using karate-netty FeatureServer with ssl true. This is how I'm starting server and stopping server in @BeforeClass & @AfterClass respectively, in runner,
private static FeatureServer oktaServer;
oktaServer = FeatureServer.start(oktaMockFile, 3010, true, null);
oktaServer.stop();
Server is started and cert.pem
and key.pem
files are generated in target folder. But when I'm trying to reach https://localhost:3010/somePath
, I'm getting this error
javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
I tried using both karate 0.9.3 & 0.9.6 and I'm using java8, jdk1.8.0_261.jdk and maven3.
Solution already tried:
- I tried adding adding cert.pem to keytool but that didn't help as certificates would be replaced and generated by karate after every mvn clean install.
- I tried adding local_policy.jar and US_export_policy.jar to $JAVA_HOME/jre/lib/security/ but that too didn't help.
- I also tried adding http-client and http-core dependencies as suggested to avoid dependency conflicts.
Can someone help me out what am I doing wrong or may is there any setup required to be done to use FeatureServer with ssl boolean true?