rubenlagus / TelegramBots

Java library to create bots using Telegram Bots API
https://telegram.me/JavaBotsApi
MIT License
4.77k stars 1.22k forks source link

found bug in version 5.3.0 #997

Closed tmb-01 closed 2 years ago

tmb-01 commented 3 years ago

i am writing telegram bot in spring. when i use this package version 4.9.2 it works well. but when I upgrade it to version 5.3.0 and run spring application it gives error like this

. _ _ /\ / '_ () \ \ \ \ ( ( )\ | ' | '| | ' \/ ` | \ \ \ \ \/ _)| |)| | | | | || (| | ) ) ) ) ' |__| .|| ||| |\, | / / / / =========|_|==============|__/=//// :: Spring Boot :: (v2.5.6)

2021-11-08 16:55:57.257 INFO 21946 --- [ main] u.restaurant.kitchen.KitchenApplication : Starting KitchenApplication using Java 1.8.0_281 on maraims-MacBook-Pro.local with PID 21946 (/Users/maraim/Desktop/spring Leesons/kitchen/target/classes started by maraim in /Users/maraim/Desktop/spring Leesons/kitchen) 2021-11-08 16:55:57.259 INFO 21946 --- [ main] u.restaurant.kitchen.KitchenApplication : No active profile set, falling back to default profiles: default 2021-11-08 16:55:58.035 ERROR 21946 --- [ main] o.s.boot.SpringApplication : Application run failed

java.lang.IllegalStateException: Unable to load cache item at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:79) ~[spring-core-5.3.12.jar:5.3.12] at org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:34) ~[spring-core-5.3.12.jar:5.3.12] at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:134) ~[spring-core-5.3.12.jar:5.3.12] at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:319) ~[spring-core-5.3.12.jar:5.3.12] at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:572) ~[spring-core-5.3.12.jar:5.3.12] at org.springframework.cglib.proxy.Enhancer.createClass(Enhancer.java:419) ~[spring-core-5.3.12.jar:5.3.12] at org.springframework.context.annotation.ConfigurationClassEnhancer.createClass(ConfigurationClassEnhancer.java:137) ~[spring-context-5.3.12.jar:5.3.12] at org.springframework.context.annotation.ConfigurationClassEnhancer.enhance(ConfigurationClassEnhancer.java:109) ~[spring-context-5.3.12.jar:5.3.12] at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:447) ~[spring-context-5.3.12.jar:5.3.12] at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:268) ~[spring-context-5.3.12.jar:5.3.12] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:325) ~[spring-context-5.3.12.jar:5.3.12] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:147) ~[spring-context-5.3.12.jar:5.3.12] at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:746) ~[spring-context-5.3.12.jar:5.3.12] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:564) ~[spring-context-5.3.12.jar:5.3.12] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) [spring-boot-2.5.6.jar:2.5.6] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) [spring-boot-2.5.6.jar:2.5.6] at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) [spring-boot-2.5.6.jar:2.5.6] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) [spring-boot-2.5.6.jar:2.5.6] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) [spring-boot-2.5.6.jar:2.5.6] at uz.restaurant.kitchen.KitchenApplication.main(KitchenApplication.java:10) [classes/:na] Caused by: java.lang.NoClassDefFoundError: org/telegram/telegrambots/ApiContextInitializer at com.github.xabgesagtx.bots.TelegramBotAutoConfiguration.(TelegramBotAutoConfiguration.java:64) ~[telegram-spring-boot-starter-0.19.jar:0.19] at java.lang.Class.forName0(Native Method) ~[na:1.8.0_281] at java.lang.Class.forName(Class.java:348) ~[na:1.8.0_281] at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:593) ~[spring-core-5.3.12.jar:5.3.12] at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:363) ~[spring-core-5.3.12.jar:5.3.12] at org.springframework.cglib.proxy.Enhancer.generate(Enhancer.java:585) ~[spring-core-5.3.12.jar:5.3.12] at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:110) ~[spring-core-5.3.12.jar:5.3.12] at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:108) ~[spring-core-5.3.12.jar:5.3.12] at org.springframework.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54) ~[spring-core-5.3.12.jar:5.3.12] at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266) ~[na:1.8.0_281] at java.util.concurrent.FutureTask.run(FutureTask.java) ~[na:1.8.0_281] at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61) ~[spring-core-5.3.12.jar:5.3.12] ... 19 common frames omitted Caused by: java.lang.ClassNotFoundException: org.telegram.telegrambots.ApiContextInitializer at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_281] at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[na:1.8.0_281] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355) ~[na:1.8.0_281] at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[na:1.8.0_281] ... 31 common frames omitted

Disconnected from the target VM, address: '127.0.0.1:53301', transport: 'socket'

Process finished with exit code 1

carlopantaleo commented 2 years ago

Hey there, it’s not a bug in the library, but version 5.0.0 introduced a few breaking changes (ApiContextInitializer is one of them). Please read the guide about how to update to that version, here: https://github.com/rubenlagus/TelegramBots/wiki/How-To-Update#to-version-500

tmb-01 commented 2 years ago

solved