telegram-s / telegram-api-old

Telegram Api library for java
MIT License
138 stars 64 forks source link

Null pointer exception while calling api.switchToDc(destDC) #47

Closed vaibhavthapliyal closed 8 years ago

vaibhavthapliyal commented 8 years ago

Hi everyone, I am trying to call the auth.checkPhone function from the JAVA API. While doing that I get the PHONE_MIGRATE_5 error. So on reading the documentation and some code examples I use the function api.switchToDc(5) to switch the datacenters. But using that function gives me the following exception: Exception in thread "main" java.lang.NullPointerException at org.telegram.actors.ActorSystem.close(ActorSystem.java:97) at org.telegram.mtproto.MTProto.close(MTProto.java:221) at org.telegram.api.engine.TelegramApi.switchToDc(TelegramApi.java:158) at com.telegram.api.TestTelegramAPI.main(TestTelegramAPI.java:76)

Any help will be appreciated. Thanks! Vaibhav

vaibhavthapliyal commented 8 years ago

I would like to add that this error occurs when I shift to production server from test server. I was able to replicate the same error using the telegram-bots project with the same behaviour.

Thanks Vaibhav

vaibhavthapliyal commented 8 years ago

Hi, It seems that it was an issue with the production ip-address.

Using this ip as the production ip works for me: "149.154.171.5".

You can try the following ip-addresses from here if this doesn't work for you:https://github.com/telegramdesktop/tdesktop/blob/master/Telegram/SourceFiles/config.h#L221