我在Web应用程序上写了一个机器人,然后使用Tomcat服务器 我想连接到电报机器人 但是我在Tomcat服务器上收到以下错误
ApiContextInitializer.init();
TelegramBotsApi telegramBotsApi = new TelegramBotsApi();
telegramBotsApi.registerBot(new StoreBot() );
.....
public class StoreBot extends TelegramLongPollingBot{
@Override
public String getBotToken() {
return "375....";
}
public String getBotUsername() {
return "da....";
}
public void onUpdateReceived(Update update) {
if (update.hasMessage() && update.getMessage().hasText()) {
// Set variables
String message_text = update.getMessage().getText();
long chat_id = update.getMessage().getChatId();
SendMessage message = new SendMessage() // Create a message object object
.setChatId(chat_id)
.setText(message_text);
try {
execute(message); // Sending our message object to user
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
错误是:
org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException: Error removing old webhook
at org.telegram.telegrambots.util.WebhookUtils.clearWebhook(WebhookUtils.java:79)
at org.telegram.telegrambots.bots.TelegramLongPollingBot.clearWebhook(TelegramLongPollingBot.java:25)
Caused by: org.telegram.telegrambots.meta.exceptions.TelegramApiException: Unable to execute deleteWebhook method
at org.telegram.telegrambots.bots.DefaultAbsSender.sendApiMethod(DefaultAbsSender.java:668)
Caused by: 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
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1937)
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:387)
at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292)
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:145)
请帮助我