I tried to build the bot connection and encountered this problem in all bot-api versions.
1.TelegramBot bot = new TelegramBot(botToken);
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
2.When I use Override X509TrustManager;------->
OkHttpClient okHttpClient = new OkHttpClient.Builder().sslSocketFactory(createSSLSocketFactory()).hostnameVerifier(new TrustAllHostnameVerifier()).build();
TelegramBot bot = new TelegramBot.Builder(botToken).okHttpClient(okHttpClient).build();
// TelegramBot bot = new TelegramBot(botToken);
//
well, NullPointerException is quite clear, but only you can see where it happens, maybe you are using null message object which can return in case of unsuccessful request.
I tried to build the bot connection and encountered this problem in all bot-api versions. 1.TelegramBot bot = new TelegramBot(botToken); 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 2.When I use Override X509TrustManager;-------> OkHttpClient okHttpClient = new OkHttpClient.Builder().sslSocketFactory(createSSLSocketFactory()).hostnameVerifier(new TrustAllHostnameVerifier()).build(); TelegramBot bot = new TelegramBot.Builder(botToken).okHttpClient(okHttpClient).build(); // TelegramBot bot = new TelegramBot(botToken); //
SendResponse sendResponse = bot.execute(request);//return null??? conlose error : Exception in thread "main" java.lang.NullPointerException at com.bl.controllers.bot.telegram.TelegramMyBot.main(TelegramMyBot.java:63)