Git Product home page Git Product logo

tdlight-team / tdlight-java Goto Github PK

View Code? Open in Web Editor NEW
242.0 242.0 41.0 4.05 MB

Complete Bot and Userbot Telegram library based on TDLib

Home Page: https://t.me/TDLight

License: GNU Lesser General Public License v3.0

Java 100.00%
java mtproto tdlib tdlib-java telegram telegram-api telegram-bot telegram-bot-api telegram-bot-example telegram-bot-framework telegram-bots telegram-bots-api telegram-java-api telegram-userbot telegrambot

tdlight-java's People

Contributors

bildcraft1 avatar cavallium avatar dhina17 avatar yarmoiseev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tdlight-java's Issues

GLIBC_2.29' not found

Hello,
My env. is CentOS 8 with latest updates. And latest GLIBC is 2.28.

Maven pom is:

<dependency>
            <groupId>it.tdlight</groupId>
            <artifactId>tdlight-java</artifactId>
            <version>4.171.101</version>
        </dependency>
       
        <dependency>
            <groupId>it.tdlight</groupId>
            <artifactId>tdlight-natives-linux-amd64</artifactId>
            <version>3.3.28</version>
        </dependency>

I got:

Caused by: java.lang.UnsatisfiedLinkError: /opt/client/.cache/version-tdlight-4.171.101-3.3.28/tdjni/tdjni.so: /lib64/libm.so.6:version `GLIBC_2.29' not found (required by /opt/client/.cache/version-tdlight-4.171.101-3.3.28/tdjni/tdjni.so)

Is it possible to compile tdlight-natives-linux-amd64 with GLIBC 2.28?

Miss resources on 3.168.4

I'm trying to use the release 3.168.4 using the it.tdlight tdlib dependency.
On init method, it cannot find the library libeay32.dll and the other required libs on internal resources.

Internally it looking for path:
/libs/win/amd64/libeay32.dll

Where are the libraries to extract?

Can't find class [it/tdlight/jni/TdApi$BotInfo]

Using the following dependency and the example program
repositories {
mavenCentral()
maven { url "https://mvn.mchv.eu/repository/mchv/" }
}

dependencies {
implementation 'it.tdlight:tdlight-java:4.171.126'
implementation 'it.tdlight:tdlight-natives-windows-amd64:3.3.51'
}

I test the example on Windows 10, But there is error:

[ 1][t 0][1625280421.779124259][tl_jni_object.cpp:39]	Can't find class [it/tdlight/jni/TdApi$BotInfo]

Please help me.
Thanks!

[Question] No update handler for error

Hello.

I successfully initialize client and then call:

client.send(TdApi.GetStickerSet(123456L), { println("Test: "+it) }, { println("Exception: "+it) })

Assuming that id is invalid and I want to get error (in update handler with "Test: " I guess), but I didn't get any response. Neither in update nor in error,
Is this expected behavior? If I set log level to 3, then in debug output I see:

[ 3][t 5][1618056339.245123624][NetQuery.h:322][#1][!Session:3:main][&net_query]	Got error [Query:[id:589824][tl:0x2619a90e][state:Query]] [Error : 400 : STICKERSET_INVALID]
[ 3][t 5][1618056339.245144367][NetQuery.h:244][#1][!Session:3:main][&net_query]	[Query:[id:589824][tl:0x2619a90e][state:Error][Error : 400 : STICKERSET_INVALID]] [state:sent to callback]
[ 3][t 5][1618056339.245156049][NetQuery.h:244][#1][!Td][&net_query]	[Query:[id:589824][tl:0x2619a90e][state:Error][Error : 400 : STICKERSET_INVALID]] [state:Td: received from DcManager]
[ 3][t 5][1618056339.245162010][Td.cpp:3533][#1][!Td][&net_query]	Receive result of [Query:[id:589824][tl:0x2619a90e][state:Error][Error : 400 : STICKERSET_INVALID]]
[ 3][t 5][1618056339.245182037][StickersManager.cpp:696][#1][!Td]	Receive error for GetStickerSetQuery: [Error : 400 : STICKERSET_INVALID]

but no response in callback. Can you please check?
Thanks)

Dependency version:
tdlight-java:4.171.87
tdlight-natives-windows-amd64:3.3.17

UnsatisfiedLinkError: 'TdApi$Object.toString()'

When calls toString() on TdApi.Object, an UnsatisfiedLinkError occurs. Simple code to reproduce:

TdApi.TdlibParameters parameters = new TdApi.TdlibParameters();
System.out.println(parameters);

An error occurred:

Exception in thread "main" java.lang.UnsatisfiedLinkError: 'java.lang.String it.tdlight.jni.TdApi$Object.toString()'
	at it.tdlight.jni.TdApi$Object.toString(Native Method)
	at com.demkom58.testgram.Main.main(Main.java:9)

Can't find field [offsetOrder] with signature [J]

macos
artifactId:tdlight-java
version:1.7.7.0
artifactId:tdlight-natives-osx-amd64
version:3.3.129

init error

telegram-transport init...
[ 1][t 0][1632736701.648375034][tl_jni_object.cpp:39]	Can't find field [offsetOrder] with signature [J]
FATAL ERROR in native method: Can't find field [offsetOrder] with signature [J]
	at java.lang.ClassLoader$NativeLibrary.load0([email protected]/Native Method)
	at java.lang.ClassLoader$NativeLibrary.load([email protected]/ClassLoader.java:2430)
	at java.lang.ClassLoader$NativeLibrary.loadLibrary([email protected]/ClassLoader.java:2487)
	- locked <0x000000070c337828> (a java.util.HashSet)
	at java.lang.ClassLoader.loadLibrary0([email protected]/ClassLoader.java:2684)
	at java.lang.ClassLoader.loadLibrary([email protected]/ClassLoader.java:2617)
	at java.lang.Runtime.load0([email protected]/Runtime.java:765)
	- locked <0x00000007004d4ce0> (a java.lang.Runtime)
	at java.lang.System.load([email protected]/System.java:1835)
	at it.tdlight.common.utils.LoadLibrary.loadJarLibrary(LoadLibrary.java:189)
	at it.tdlight.common.utils.LoadLibrary.loadLibrary(LoadLibrary.java:83)
	at it.tdlight.common.utils.LoadLibrary.load(LoadLibrary.java:66)
	at it.tdlight.common.Init.start(Init.java:44)
	- locked <0x000000070fedf9e8> (a java.lang.Class for it.tdlight.common.Init)
	at com.wind.telegram.transport.Main.main(Main.java:75)
Disconnected from the target VM, address: '127.0.0.1:62478', transport: 'socket'

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

Can't find class [it/tdlight/tdnative/NativeClient] on Ubuntu 20.04 and Centos 7

I used dependencies on cestos 7 and ubuntu 20.04, but get error:
FATAL ERROR in native method: Can't find class [it/tdlight/tdnative/NativeClient]
Please help me,
Thank you.

        <dependency>
            <groupId>it.tdlight</groupId>
            <artifactId>tdlib-java</artifactId>
            <version>4.171.78</version>
        </dependency>
        <dependency>
            <groupId>it.tdlight</groupId>
            <artifactId>tdlib-natives-windows-amd64</artifactId>
            <version>3.3.14</version>
        </dependency>
        <dependency>
            <groupId>it.tdlight</groupId>
            <artifactId>tdlib-natives-linux-amd64</artifactId>
            <version>3.3.55</version>
        </dependency>

it.tdlight:tdlght-api sources

Where do I find the sources for said module?
IntelliJ Idea maven plugin fails to load them and I can't find them manually in the repos either

Downloaded MessageDocument are corrupted

I'm trying to handling the TdApi.UpdateNewMessage.CONSTRUCTOR event, after the request to download a document message (it is a zip file).
The downloaded document results as corrupted file.
I requested to download the MessageDocument catching the TdApi.UpdateNewMessage event filtering the message content of type TdApi.MessageDocument

TdApi.UpdateNewMessage.CONSTRUCTOR: 
TdApi.UpdateNewMessage updateNewMessage = (TdApi.UpdateNewMessage) object;
if (updateNewMessage.message.content instanceof TdApi.MessageDocument) {
int fileId = ((TdApi.MessageDocument) updateNewMessage.message.content).document.document.id;
int fileSize = 0;
int priority = 10;
new TdApi.DownloadFile(fileId, priority, 0, fileSize, false),
        updatesDocumentHandler,
        new ErrorCallback() {
          @Override
          public void onError(Response error) {
            log.error(error.getObject().toString());
          }
        });
}


// then when document is downloaded I catch the file path: 
case TdApi.UpdateFile.CONSTRUCTOR:
          // global on result
          TdApi.UpdateFile updateFile = (TdApi.UpdateFile) object;
if ((updateFile).file.local.isDownloadingCompleted) {
          String filePath = updateFile.file.local.path;
.... 
}

I look the downloaded file inside the folder named "secret" of the database directory. I'm using a secret chat.

Note. When I try to download files with a size less of 64kb the zip file download is not corrupted!

Libraries binaries

You need to have tdlib binaries for all architectures. Otherwise, LoadLibrary throws exception. It's not a good idea when I have application only for one architecure.

TDLight Java with official TDLib stuck during startup

I've tried the latest TDLight Java with official TDLib

<dependency>
   <groupId>it.tdlight</groupId>
   <artifactId>tdlib-java</artifactId>
   <version>3.168.11</version>
</dependency>

While retrieving AuthorizationStateWaitTdlibParameters the application is stuck.

[ 3][t 0][1599717803.865743160][Client.cpp:220][&td_requests]	Begin to wait for updates with timeout 1.000000
[ 3][t 4][1599717803.866245985][Td.cpp:4490][#1][!Td][&td_requests]	Sending update: UpdateOption {
  name = "version"
  value = OptionValueString {
    value = "1.6.8"
  }
}
[ 3][t 4][1599717803.866277933][Td.cpp:4490][#1][!Td][&td_requests]	Sending update: UpdateAuthorizationState {
  authorizationState = AuthorizationStateWaitTdlibParameters {
  }
}
[ 3][t 0][1599717803.866286277][Client.cpp:226][&td_requests]	End to wait for updates, returning object 0 0x7f9a0ee99890
[ 3][t 0][1599717803.866729021][Client.cpp:220][&td_requests]	Begin to wait for updates with timeout 1.000000
[ 3][t 0][1599717803.866753101][Client.cpp:226][&td_requests]	End to wait for updates, returning object 0 0x7f9a0ee99950

During bebugging the following lock cannot be aquired
it.tdlight.tdlight.Client#stateLock.writeLock().lock()

At the same time, TDLight Java with optimized TDLight with the same version works well.

any thought?
thx.

gcs shows no chats after jvm restart

I started the sample application, logged in via my telephone number and executed gcs. Everything works as expected. I get a list of my chats. I also can send messages or get details to a specific chat via gc command.

But after i restart my java app, i get into the following behaviour: I am still logged in. The "me" command returns my user including name and telephone number. But unfortunately the "gcs" command doesn't give me a response any more. Also "gc" doesn't work for the same chat-id that worked in the session in which i logged in.

This is the output of "gcs"

Enter command (gcs - GetChats, gc <chatId> - GetChat, me - GetMe, sm <chatId> <message> - SendMessage, lo - LogOut, q - Quit): 
gcs

First 20 chat(s) out of 0 known chat(s):

This is the output of "gc"

Error {
  code = 6
  message = "Invalid chat identifier specified"
}

Anything i did wrong or can do to fix this?

Bot creating

Hi!

Is it possible to use this library to create Telegram bot?
If so, could you please provide examples of bot creating and recieving/sending messages?

Thanks!

Cannot create a Secret chat

I'm trying to make a secret chat without success.

I'm executing the command
new TdApi.CreateNewSecretChat(userId)

but into the log with verbosity 5 is not logged anything.

Cannot run the library

When i added to maven:

  <dependencies>
    <dependency>
      <groupId>it.tdlight</groupId>
      <artifactId>tdlib-java</artifactId>
      <version>4.171.78</version>
    </dependency>
    <dependency>
      <groupId>it.tdlight</groupId>
      <artifactId>tdlib-natives-windows-amd64</artifactId>
      <version>3.3.14</version>
    </dependency>
  </dependencies>

And I run Example class - i got the issuse here. How to resolve it?

Exception in thread "main" it.tdlight.common.utils.CantLoadLibrary: FATAL: Init failled when load tdlib library, execution can't continue
	at it.tdlight.common.utils.LoadLibrary.loadLibrary(LoadLibrary.java:88)
	at it.tdlight.common.utils.LoadLibrary.load(LoadLibrary.java:66)
	at it.tdlight.common.Init.start(Init.java:44)
	at Example.main(Example.java:300)
Caused by: java.io.IOException: Native libraries for platform win-amd64 not found!
	at it.tdlight.common.utils.LoadLibrary.loadJarLibrary(LoadLibrary.java:177)
	at it.tdlight.common.utils.LoadLibrary.loadLibrary(LoadLibrary.java:83)
	... 3 more

GraalVM Native Image Support

I am trying to make tdlight work with graalvm narive image.
In intelij everything works flawlessly, error occurs when I compile code to native image using graal.
I am getting this error when code starts tdlight client:

[ 1][t 0][1625332068.895975351][tl_jni_object.cpp:39]      Can't find class [it/tdlight/tdnative/NativeClient]
Fatal error reported via JNI: Can't find class [it/tdlight/tdnative/NativeClient]

I am including tdlight like this

    implementation 'it.tdlight:tdlight-java:4.171.128'
    implementation 'it.tdlight:tdlight-natives-windows-amd64:3.3.55'

Any help appreciated.

Unable to load Maven meta-data from https://mvn.mchv.eu/repository/mchv/it/tdlight/tdlight-java/maven-metadata.xml

I just can't download TDLight dependency.
It looks like a very strange bug.

This URLs:

https://mvn.mchv.eu/repository/mchv/it/tdlight/tdlight-java/maven-metadata.xml
http://mvn.mchv.eu/repository/mchv/it/tdlight/tdlight-java/maven-metadata.xml

are really not accessible at this moment.
I already tried using another internet connection and TOR browser, but the result is the same.

The build completed normally a few days ago with exactly the same build.gradle.

Screenshot_20210120_180311

How to release the memory of multiple clients

App requires multiple accounts to switch frequently, I will call client.send(new TdApi.Close()) when switching accounts, However, the memory usage is very high after multiple switching, and the memory does not decrease after switching.

TDLibException cannot be resolved to a type

Using the following dependency and the example program, TDLibException cannot be resolved.

<dependency>
  <groupId>it.tdlight</groupId>
  <artifactId>tdlight-java</artifactId>
  <version>3.171.31</version>
</dependency>
<dependency>
  <groupId>it.tdlight</groupId>
  <artifactId>tdlight-natives-linux-amd64</artifactId>
  <version>3.2.31</version>
</dependency>

Is anything missing?

Where can i find version for jdk8?

I have an issue by using JDK 8 to latest versions.

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: it/tdlight/common/utils/CantLoadLibrary has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
	at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
	at java.lang.Class.getMethod0(Class.java:3018)
	at java.lang.Class.getMethod(Class.java:1784)
	at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:650)
	at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:632)

Process finished with exit code 1

how can i fix it? i assume that issue came because of the latest version of TDLight only supports JDK >= 11
But i can't find fit version of Tdligt from anywhere...

The I / O load on the client is extremely high

When 20 accounts are logged in at the same time on my computer, my I/O : write is 20m/s and read / is 200kb/s
I didn't do anything else, just log in. About 100 supergroups have been added to each account
Is there a way to mitigate?

How to download a file asynchorously?

downloadFile.synchronous = false I have assign it to false for this field but still I can't receive updates through result handler more than one time. I receive the updates only one time after the download has been started. It will be helpful if someone tells my mistake.

`DownloadFile downloadFile = new DownloadFile();
downloadFile.fileId = remoteFileId;
downloadFile.offset = 0;
downloadFile.limit = 0;
downloadFile.synchronous = false;
downloadFile.priority = 1;
Client.client.send(downloadFile, new ResultHandler(){

  @Override
  public void onResult(Object object) {
     System.out.println(object); // It runs only for the first time
     UpdateFile updateFile = (UpdateFile) object;
     System.out.println("Downloaded: "+ updateFile.file.local.downloadedSize); // It didn't run ever
     if(updateFile.file.local.isDownloadingCompleted) // It didn''t run ever
       System.out.println("File downloaded"); 
  }

});`

Note: File downloaded fine, But I can't receive the update

RegisterNatives failed for nativeClientReceive with signature (J[J[Lit/tdlight/tdlib/TdApi$Object;DZZ)I

hey guys,

while running tdlib-java on macOS the following exception is thrown

FATAL ERROR in native method: RegisterNatives failed for nativeClientReceive with signature (J[J[Lit/tdlight/tdlib/TdApi$Object;DZZ)I
	at java.lang.ClassLoader$NativeLibrary.load0([email protected]/Native Method)
	at java.lang.ClassLoader$NativeLibrary.load([email protected]/ClassLoader.java:2452)
	at java.lang.ClassLoader$NativeLibrary.loadLibrary([email protected]/ClassLoader.java:2508)
	- locked <0x0000000700432650> (a java.util.HashSet)
	at java.lang.ClassLoader.loadLibrary0([email protected]/ClassLoader.java:2704)
	at java.lang.ClassLoader.loadLibrary([email protected]/ClassLoader.java:2637)
	at java.lang.Runtime.load0([email protected]/Runtime.java:745)
	at java.lang.System.load([email protected]/System.java:1871)
	at it.tdlight.tdlight.utils.LoadLibrary.loadJarLibrary(LoadLibrary.java:134)
	at it.tdlight.tdlight.utils.LoadLibrary.loadLibrary(LoadLibrary.java:80)
	at it.tdlight.tdlight.utils.LoadLibrary.load(LoadLibrary.java:63)
	at it.tdlight.tdlight.Init.start(Init.java:46)
	- locked <0x00000007032c9558> (a java.lang.Class for it.tdlight.tdlight.Init)
	at it.tdlight.tdlight.Client.<init>(Client.java:31)
[ 1][t 0][1599679723.491142034][tl_jni_object.cpp:37]	RegisterNatives failed for nativeClientReceive with signature (J[J[Lit/tdlight/tdlib/TdApi$Object;DZZ)I
<dependency>
   <groupId>it.tdlight</groupId>
   <artifactId>tdlib-java</artifactId>
   <version>3.168.11</version>
</dependency>

Init failled when load tdlib library, execution can't continue

When i run project in mac os 64 bit, it's throw exception:

Exception in thread "main" it.tdlight.common.utils.CantLoadLibrary: FATAL: Init failled when load tdlib library, execution can't continue
at it.tdlight.common.utils.LoadLibrary.loadLibrary(LoadLibrary.java:87)
at it.tdlight.common.utils.LoadLibrary.load(LoadLibrary.java:65)
at it.tdlight.common.Init.start(Init.java:44)
at Example.main(Example.java:307)
Caused by: java.io.IOException: Native libraries for platform osx-amd64 not found!
at it.tdlight.common.utils.LoadLibrary.loadJarLibrary(LoadLibrary.java:150)
at it.tdlight.common.utils.LoadLibrary.loadLibrary(LoadLibrary.java:82)
... 3 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at it.tdlight.common.utils.LoadLibrary.loadJarLibrary(LoadLibrary.java:148)
... 4 more
Caused by: java.lang.NoSuchMethodError: java.lang.Class.getPackageName()Ljava/lang/String;
at it.tdlight.jni.tdlight.osx.amd64.LoadLibrary.getOsName(LoadLibrary.java:13)
at it.tdlight.jni.tdlight.osx.amd64.LoadLibrary.getLibraryAsStream(LoadLibrary.java:9)
... 9 more

Errors while loading native tdlight-java libraries on Ubuntu 16.04.7 LTS

hey guys

Can you please assist with the following error:

Caused by: java.lang.UnsatisfiedLinkError: ../.tdlight-libs-cache/version-3.168.13/tdjni/tdjni.so: libssl.so.1.1: cannot open shared object file: No such file or directory
	at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
	at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2452)
	at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2508)
	at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2704)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2637)
	at java.base/java.lang.Runtime.load0(Runtime.java:745)
	at java.base/java.lang.System.load(System.java:1871)
	at it.tdlight.tdlight.utils.LoadLibrary.loadJarLibrary(LoadLibrary.java:134)
	at it.tdlight.tdlight.utils.LoadLibrary.loadLibrary(LoadLibrary.java:80)
	... 61 common frames omitted
        <dependency>
            <groupId>it.tdlight</groupId>
            <artifactId>tdlight-java</artifactId>
            <version>3.168.13</version>
        </dependency>
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.7 LTS
Release:	16.04
Codename:	xenial

Regards,

Anton

Shutdown

How to close client correctly ? When I just finish application, JVM catches SIGSEGV:

A fatal error has been detected by the Java Runtime Environment:

SIGSEGV (0xb) at pc=0x00007f95c110adbc, pid=16485, tid=16516

JRE version: Java(TM) SE Runtime Environment (15.0.1+9) (build 15.0.1+9-18)
Java VM: Java HotSpot(TM) 64-Bit Server VM (15.0.1+9-18, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-md64)
Problematic frame:
C [tdjni.so+0xa5edbc] td::Td::clear()+0x38c

Stack: [0x00007f9589ffe000,0x00007f958a7fd000], sp=0x00007f958a7fb3f8, free space=8180k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [tdjni.so+0xa5edbc] td::Td::clear()+0x38c
C [tdjni.so+0xaa4d2c] td::detail::LambdaPromise<td::tl::unique_ptrtd::telegram_api::help_PromoData, td::Td::on_alarm_timeout(long)::$_8, td::PromiseCreator::Ignore>::~LambdaPromise()+0x4c
C [tdjni.so+0xaa5bc6] td::GetPromoDataQuery::~GetPromoDataQuery()+0x26
C [tdjni.so+0xaa6092] std::_Sp_counted_deleter<td::GetPromoDataQuery*, std::__shared_ptr<td::GetPromoDataQuery, (__gnu_cxx::_Lock_policy)2>::_Deleter<std::allocatortd::GetPromoDataQuery >, std::allocatortd::GetPromoDataQuery, (__gnu_cxx::_Lock_policy)2>::_M_dispose()+0x12
C [tdjni.so+0xa5edea] td::Td::clear()+0x3ba
C [tdjni.so+0xa5d22c] td::Td::dec_request_actor_refcnt()+0x14c
C [tdjni.so+0x167af5f] td::Scheduler::do_event(td::ActorInfo*, td::Event&&)+0x24f
C [tdjni.so+0x167c273] void td::Scheduler::flush_mailbox<void ()(td::ActorInfo), td::Event ()()>(td::ActorInfo, void (* const&)(td::ActorInfo*), td::Event (* const&)())+0x113
C [tdjni.so+0x167c05f] td::Scheduler::run_mailbox()+0x14f
C [tdjni.so+0x167c7d8] td::Scheduler::run_events()+0x198
C [tdjni.so+0x167c61a] td::Scheduler::run_no_guard(td::Timestamp)+0xaa
C [tdjni.so+0x16778af] td::ConcurrentScheduler::run_main(td::Timestamp)+0x4f
C [tdjni.so+0x929579] td::LambdaDestructor<td::detail::ThreadPthread::ThreadPthread<td::MultiImpl::MultiImpl(std::shared_ptrtd::NetQueryStats)::{lambda()#1}>(td::MultiImpl::MultiImpl(std::shared_ptrtd::NetQueryStats)::{lambda()#1}&&)::{lambda()#1}>::~LambdaDestructor()+0x39
C [tdjni.so+0x929460] td::detail::ThreadPthread::run_thread(void*)+0x20

Can't load library in Spring Boot

When i wrote Init.start() and built spring application, then i got exception:

[ 1][t 0][1620245307.392618656][tl_jni_object.cpp:38]	Can't find field [userId] with signature [I]
FATAL ERROR in native method: Can't find field [userId] with signature [I]
	at java.lang.ClassLoader$NativeLibrary.load0([email protected]/Native Method)
	at java.lang.ClassLoader$NativeLibrary.load([email protected]/ClassLoader.java:2430)
	at java.lang.ClassLoader$NativeLibrary.loadLibrary([email protected]/ClassLoader.java:2487)
	- locked <0x0000000712b07658> (a java.util.HashSet)
	at java.lang.ClassLoader.loadLibrary0([email protected]/ClassLoader.java:2684)
	at java.lang.ClassLoader.loadLibrary([email protected]/ClassLoader.java:2617)
	at java.lang.Runtime.load0([email protected]/Runtime.java:765)
	- locked <0x0000000712b07ab8> (a java.lang.Runtime)
	at java.lang.System.load([email protected]/System.java:1835)
	at it.tdlight.common.utils.LoadLibrary.loadJarLibrary(LoadLibrary.java:189)
	at it.tdlight.common.utils.LoadLibrary.loadLibrary(LoadLibrary.java:83)
	at it.tdlight.common.utils.LoadLibrary.load(LoadLibrary.java:66)
	at it.tdlight.common.Init.start(Init.java:44)
	- locked <0x00000007122c46e8> (a java.lang.Class for it.tdlight.common.Init)
	at com.example.teeeest.TeeeestApplication.main(TeeeestApplication.java:12)

pom.xml

  <repositories>
    <repository>
      <id>mchv-release</id>
      <name>MCHV Release Apache Maven Packages</name>
      <url>https://mvn.mchv.eu/repository/mchv</url>
    </repository>
    <repository>
      <id>mchv-snapshot</id>
      <name>MCHV Snapshot Apache Maven Packages</name>
      <url>https://mvn.mchv.eu/repository/mchv-snapshot</url>
    </repository>
  </repositories>
  <dependencies>
    <dependency>
      <groupId>it.tdlight</groupId>
      <artifactId>tdlight-java</artifactId>
      <version>4.171.110</version>
    </dependency>
    <dependency>
      <groupId>it.tdlight</groupId>
      <artifactId>tdlight-natives-windows-amd64</artifactId>
      <version>3.3.28</version>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter</artifactId>
    </dependency>
          .........
          ....
          ...
  <dependencies>

How to load Library in Application:

@SpringBootApplication
public class TeeeestApplication {

  static {
    try {
      Init.start();
    } catch (CantLoadLibrary cantLoadLibrary) {
      cantLoadLibrary.printStackTrace();
    }
  }

    public static void main(String[] args) throws CantLoadLibrary {
    SpringApplication.run(TeeeestApplication.class, args);
  }

}

This with any app, what to do?

Error: Receive is called after Client destroy, or simultaneously from different threads

I want to create a multi-threaded system that uses TDLib.
I wrote a Runnable class where I create a tdlib client and set an updates handler.
Each thread has its own TelegramClient and its own updates handler. Each class manages its own telegram account.

If I run only 1 thread, all works good, but if I run 2 or more threads, I got this error after the second TelegramClient was created:

[ 0][t 0][1612181768.710582017][Client.cpp:279] Receive is called after Client destroy, or simultaneously from different threads

I should use 1 global updates handler for all clients?

Probably this issue is tied to this one: tdlib/td#1242

[Question] Support for Android

Hello, thank you for your fantastic work!

I searched carefully for any information in your git repository, but did not find an answer to the question, can tdlight be used on Android?
If not, maybe I can use wrapper with the official library?

I have not worked with native libraries before, thanks in advance for the clarification)

`GLIBC_2.29' not found

Exception in thread "main" it.tdlight.common.utils.CantLoadLibrary: FATAL: Init failled when load tdlib library, execution can't continue
	at it.tdlight.common.utils.LoadLibrary.loadLibrary(LoadLibrary.java:88)
	at it.tdlight.common.utils.LoadLibrary.load(LoadLibrary.java:66)
	at it.tdlight.common.Init.start(Init.java:44)
	at com.wind.telegram.transport.Main.main(Main.java:75)
Caused by: java.lang.UnsatisfiedLinkError: /root/.cache/version-tdlight-1.7.7.0-3.3.129/tdjni/tdjni.so: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /root/.cache/version-tdlight-1.7.7.0-3.3.129/tdjni/tdjni.so)
	at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
	at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2430)
	at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2487)
	at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2684)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2617)
	at java.base/java.lang.Runtime.load0(Runtime.java:765)
	at java.base/java.lang.System.load(System.java:1835)
	at it.tdlight.common.utils.LoadLibrary.loadJarLibrary(LoadLibrary.java:189)
	at it.tdlight.common.utils.LoadLibrary.loadLibrary(LoadLibrary.java:83)
	... 3 more

Unable to build via jitpack.io

While building artifact via jitpack.io the following issue has appeared:

curl -s https://gist.githubusercontent.com/ErnyTech/5ab454bbb0150a38bed8355bf9cb0e05/raw/c0487edd8d8d91b878b34b0a5699e4c29db72c78/jitpack.sh | bash -s;export JAVA_HOME="$(pwd)/jdk-10.0.2";export PATH=$JAVA_HOME/bin:$PATH
--2020-08-04 14:14:27--  http://download.oracle.com/otn-pub/java/jdk/10.0.2+13/19aef61b38124481863b1413dce1855f/jdk-10.0.2_linux-x64_bin.tar.gz
Resolving download.oracle.com (download.oracle.com)... 23.57.80.43
Connecting to download.oracle.com (download.oracle.com)|23.57.80.43|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/10.0.2+13/19aef61b38124481863b1413dce1855f/jdk-10.0.2_linux-x64_bin.tar.gz [following]
--2020-08-04 14:14:27--  https://edelivery.oracle.com/otn-pub/java/jdk/10.0.2+13/19aef61b38124481863b1413dce1855f/jdk-10.0.2_linux-x64_bin.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 23.35.125.32, 2a02:26f0:a1:5b7::366, 2a02:26f0:a1:5a8::366
Connecting to edelivery.oracle.com (edelivery.oracle.com)|23.35.125.32|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/10.0.2+13/19aef61b38124481863b1413dce1855f/jdk-10.0.2_linux-x64_bin.tar.gz?AuthParam=1596550588_d882e6934374a7372345f48860eac36e [following]
--2020-08-04 14:14:28--  http://download.oracle.com/otn-pub/java/jdk/10.0.2+13/19aef61b38124481863b1413dce1855f/jdk-10.0.2_linux-x64_bin.tar.gz?AuthParam=1596550588_d882e6934374a7372345f48860eac36e
Connecting to download.oracle.com (download.oracle.com)|23.57.80.43|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://download.oracle.com/otn-pub/java/jdk/10.0.2+13/19aef61b38124481863b1413dce1855f/jdk-10.0.2_linux-x64_bin.tar.gz?AuthParam=1596550588_d882e6934374a7372345f48860eac36e [following]
--2020-08-04 14:14:28--  https://download.oracle.com/otn-pub/java/jdk/10.0.2+13/19aef61b38124481863b1413dce1855f/jdk-10.0.2_linux-x64_bin.tar.gz?AuthParam=1596550588_d882e6934374a7372345f48860eac36e
Connecting to download.oracle.com (download.oracle.com)|23.57.80.43|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2020-08-04 14:14:29 ERROR 404: Not Found.

Looks like the jitpack.sh should be updated to download jdk successfully

Starting application from JAR

Hi, I have a problem with starting application from a JAR:
java -jar TgClient-1.0-SNAPSHOT.jar

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: it/tdlight/jni/TdApi$Function
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
        at java.lang.Class.privateGetMethodRecursive(Unknown Source)
        at java.lang.Class.getMethod0(Unknown Source)
        at java.lang.Class.getMethod(Unknown Source)
        at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: it.tdlight.jni.TdApi$Function
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 7 more

I am able to start the application inside Intellij Idea without any problems.
Could you please help me with that?
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.