java适配器注入失败,如何解决此错误“ java.security.cert.CertificateException:”;在mobilefirst中调用Java适配器时?...

I am currently working on Mobile first version 8. While creating a java adapter to call a api through the following code I m receiving error

"java.security.cert.CertificateException: PKIX path building failed mobile first java adapter error"

@GET

@Path("/unprotected")

@Produces(MediaType.TEXT_PLAIN)

@OAuthSecurity(enabled = false)

public String unprotected() {

StringBuffer content = new StringBuffer();

try {

URL url = new URL("Some Url");

HttpURLConnection con = (HttpURLConnection) url.openConnection();

con.setRequestMethod("GET");

BufferedReader in =new BufferedReader(new inputStreamReader(con.getInputStream()));

String inputLine;

while ((inputLine = in.readLine()) != null)

content.append(inputLine);

logger.info("MYFind Data" + content.toString());

in.close();

con.disconnect();

} catch (Exception e) {

logger.info("" + e.getMessage());

}

return content.toString();

}

error found in the logfile from "C:\Users\Admin\MobileFirst-8.0.0.0\mfp-server\usr\servers\mfp\logs\messages.log"

E CWPKI0022E: SSL HANDSHAKE FAILURE: A signer with SubjectDN CN=*.openweathermap.org, OU=EssentialSSL Wildcard, OU=Domain Control Validated was sent from the target host. The signer might need to be added to local trust store C:/Users/Admin/MobileFirst-8.0.0.0/mfp-server/usr/servers/mfp/resources/security/key.jks, located in SSL configuration alias defaultSSLConfig. The extended error message from the SSL handshake exception is: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

00000619 com.wether.JavaAdapterMainResource I java.security.cert.CertificateException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

解决方案

Yes i finally got the answer as uh said "SSL handshake is failing from a missing signer in your server". I just registered the my api url certificate to my mobile-first server.To do so with the software to import the certificate on server.

the path of file where to import certificate:-

C:\Users\Admin\MobileFirst-8.0.0.0\mfp-server\usr\servers\mfp\resources\security

Password:-"mobilefirst"

and just drag and drop the certificate of you api url

final setp to restart server

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值