Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facing java.lang.NoClassDefFoundError while trying to run signal-cli #655

Closed
berry-thawson opened this issue Jun 30, 2021 · 2 comments
Closed

Comments

@berry-thawson
Copy link

berry-thawson commented Jun 30, 2021

I am using ubuntu 18.04. While trying to open signal-cli from command line, I had this issue first

OpenJDK 64-Bit Server VM warning: Ignoring option MaxPermSize; support was removed in 8.0
Missing required native library dependency: libsignal-client

Referred the #517 and followed the steps in https://github.com/AsamK/signal-cli/wiki/Provide-native-lib-for-libsignal. But, for some reason, it did not take up the java.library.path. So, I used jar cf to add the .so files to the jar as follows:

zip -d ./signal-client-java-*.jar libsignal_jni.so
zip -d ./zkgroup-java-*.jar libzkgroup.so
jar cf ~/signal/signal-cli-0.8.4/zkgroup-java-0.7.0.jar ~/signal//zkgroup-0.7.3/target/release/libzkgroup.so
jar cf ~/signal/signal-client-java-0.8.1.jar ~/signal/libsignal-client-0.8.2/target/release/libsignal_jni.so

After this, if I try to run the signal-cli, I get following error:

signal-cli-0.8.4$ ./bin/signal-cli -u +XXXXXXXXXXXX register
OpenJDK 64-Bit Server VM warning: Ignoring option MaxPermSize; support was removed in 8.0
Exception in thread "main" java.lang.NoClassDefFoundError: org/whispersystems/libsignal/InvalidKeyException
	at org.asamk.signal.commands.Commands.<clinit>(Commands.java:11)
	at org.asamk.signal.App.buildArgumentParser(App.java:79)
	at org.asamk.signal.Main.main(Main.java:45)
Caused by: java.lang.ClassNotFoundException: org.whispersystems.libsignal.InvalidKeyException
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	... 3 more

Can you help me out here? I am clueless, how to proceed.

@exquo
Copy link
Contributor

exquo commented Jun 30, 2021

Try replacing your commands with

cd <..dir with libsignal_jni.so file..>
zip -u <...>/signal-cli-0.8.4/lib/signal-client-java-0.8.1.jar libsignal_jni.so

But first, restore the original .jar files from the signal-cli release. I think jar cf overwrites rather than updates the .jar files, so that now your files contain only libsignal_jni.so and libzkgroup.so.

Note that the libsignal_jni.so file should be in the current working directory (that's what the first cd command above is for). If you specify a full path (e.g. ~/soft/signal/libsignal_jni.so) as an argument to zip, it will nest the full path subdirectories inside the archive, which is not what you want.

"Missing libsignal-client" must be caused by old glibc, like #643.

@berry-thawson
Copy link
Author

That works.
Thank you @exquo . But, still I am getting a failure.

Exception in thread "main" java.lang.NullPointerException
	at org.asamk.signal.commands.RegisterCommand.handleCommand(RegisterCommand.java:30)
	at org.asamk.signal.App.handleRegistrationCommand(App.java:201)
	at org.asamk.signal.App.init(App.java:166)
	at org.asamk.signal.Main.main(Main.java:51)

It is solved if we give captcha. Though, some proper error message should be given. Everything works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants