How to disable WebHook?
mcicolella opened this issue · 7 comments
Hi all,
I'm using your echo sample but I have a problem.
I set maven parameters in my pom.xml and changed to "false" the boolean var "useWebHook" in BuildVars.java.
It compiles without errors but at runtime the following exception is raised
java.lang.NoClassDefFoundError: org/apache/http/conn/ssl/NoopHostnameVerifier
at org.telegram.telegrambots.TelegramBotsApi.setWebhook(TelegramBotsApi.java:98)
at org.telegram.telegrambots.TelegramBotsApi.setWebhook(TelegramBotsApi.java:152)
at org.telegram.telegrambots.TelegramBotsApi.registerBot(TelegramBotsApi.java:129)
Thanks
Hi @mcicolella.
it is necessary to call to setWebhook with an empty url to ensure that no webhook is running. Otherwise, if a webhook was configured before, getUpdates method will fail.
Maybe you changed something in the pom file that caused a missing library?
Hi @rubenlagus
thanks for your reply!
My code is available at https://github.com/mcicolella/freedomotic/tree/telegram/plugins/devices/telegram-bot
Hi @mcicolella ,
maybe you should try updating your TelegramBots version. You are still using 2.1 in your repo. Maybe your issue has been resolved already?
Cheers
Hi @rubenlagus
I updated the TelegramBots version but the issue hasn't been resolved. Now the exception is referred to another class
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/http/conn/ssl/NoopHostnameVerifier
at org.telegram.telegrambots.bots.AbsSender.(AbsSender.java:83)
at org.telegram.telegrambots.bots.TelegramLongPollingBot.(TelegramLongPollingBot.java:9)
at org.telegram.updateshandlers.FreedomoticBotHandlers.(FreedomoticBotHandlers.java:34)
at com.freedomotic.plugins.devices.telegrambot.TelegramBot.onStart(TelegramBot.java:93)
at com.freedomotic.api.Protocol$1.run(Protocol.java:136)
at org.apache.shiro.subject.support.SubjectRunnable.doRun(SubjectRunnable.java:120)
at org.apache.shiro.subject.support.SubjectRunnable.run(SubjectRunnable.java:108)
at com.freedomotic.api.Protocol.start(Protocol.java:154)
at com.freedomotic.jfrontend.PluginJList$1.mouseClicked(PluginJList.java:91)
Thanks
Hi @mcicolella ,
could you please check your maven dependency setup for the project? Looks like there is a version conflict for the Apache HttpClient
. TelegramBots uses version 4.5.2 so if you have a lower version polled by your parent POM or another Dependency it might cause such problems.
Cheers
Hi @Mit0x2 ,
your tip fixed the problem.
Thanks to all
Hi @mcicolella ,
glad I could help. Please make sure to close your issue once its fixed.
Cheers