discord-jda / JDA

Java wrapper for the popular chat & VOIP service: Discord https://discord.com
Apache License 2.0
4.33k stars 735 forks source link

Can't run the .jar on my Raspberry Pi 2 #428

Closed Niels1006 closed 7 years ago

Niels1006 commented 7 years ago

Here is the main class:

package main;

import Events.ReactionHandler;
import net.dv8tion.jda.core.AccountType;
import net.dv8tion.jda.core.JDA;
import net.dv8tion.jda.core.JDABuilder;
import net.dv8tion.jda.core.exceptions.RateLimitedException;

import javax.security.auth.login.LoginException;

public class Connection {

    public static void main(String[] args) {
        System.out.println("Start");
        JDA discord = null;
        try {
            discord = new JDABuilder(AccountType.BOT).setToken(Constants.token).buildBlocking();

        } catch (LoginException e) {
            e.printStackTrace();

        } catch (IllegalArgumentException e) {
            e.printStackTrace();

        } catch (RateLimitedException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("--Almost finished--");

        discord.addEventListener(new MessageResponder());
        discord.addEventListener(new ReactionHandler());

        //System.out.println(s);

    }

}

I compiled it with IntelliJ (I could run the .jar with the cmd on my WIndows-PC) This works fine on my PC (Windows 10), but it doesnt want to work on my Raspberry Pi 2 (Ubuntu):

niels@niels-raspi:~/DiscordJava$ java -jar Discord\ Bot.jar
Start
[04:36:53] [Fatal] [JDARequester]: Encountered an exception:
[04:36:53] [Fatal] [JDARequester]: javax.net.ssl.SSLException: java.lang.IllegalStateException
        at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
        at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1949)
        at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1906)
        at sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1889)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1410)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
        at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:281)
        at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:251)
        at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:151)
        at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:195)
        at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:121)
        at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:100)
        at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
        at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
        at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
        at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
        at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185)
        at okhttp3.RealCall.execute(RealCall.java:69)
        at net.dv8tion.jda.core.requests.Requester.execute(Requester.java:154)
        at net.dv8tion.jda.core.requests.Requester.request(Requester.java:81)
        at net.dv8tion.jda.core.requests.RestFuture.<init>(RestFuture.java:32)
        at net.dv8tion.jda.core.requests.RestAction.submit(RestAction.java:317)
        at net.dv8tion.jda.core.requests.RestAction.complete(RestAction.java:362)
        at net.dv8tion.jda.core.entities.impl.JDAImpl.verifyToken(JDAImpl.java:179)
        at net.dv8tion.jda.core.entities.impl.JDAImpl.login(JDAImpl.java:126)
        at net.dv8tion.jda.core.JDABuilder.buildAsync(JDABuilder.java:524)
        at net.dv8tion.jda.core.JDABuilder.buildBlocking(JDABuilder.java:547)
        at main.Connection.main(Connection.java:17)
Caused by: java.lang.IllegalStateException
        at sun.security.ec.ECDHKeyAgreement.deriveKey(Native Method)
        at sun.security.ec.ECDHKeyAgreement.engineGenerateSecret(ECDHKeyAgreement.java:130)
        at sun.security.ec.ECDHKeyAgreement.engineGenerateSecret(ECDHKeyAgreement.java:163)
        at javax.crypto.KeyAgreement.generateSecret(KeyAgreement.java:648)
        at sun.security.ssl.ECDHCrypt.getAgreedSecret(ECDHCrypt.java:102)
        at sun.security.ssl.ClientHandshaker.serverHelloDone(ClientHandshaker.java:1061)
        at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:348)
        at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1026)
        at sun.security.ssl.Handshaker.process_record(Handshaker.java:961)
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062)
        at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
        ... 30 more

javax.security.auth.login.LoginException: When verifying the authenticity of the provided token, Discord returned an unknown response:
HTTPException[java.lang.IllegalStateException]
        at net.dv8tion.jda.core.entities.impl.JDAImpl$1.handleResponse(JDAImpl.java:172)
        at net.dv8tion.jda.core.requests.Request.handleResponse(Request.java:166)
        at net.dv8tion.jda.core.requests.Requester.execute(Requester.java:195)
        at net.dv8tion.jda.core.requests.Requester.request(Requester.java:81)
        at net.dv8tion.jda.core.requests.RestFuture.<init>(RestFuture.java:32)
        at net.dv8tion.jda.core.requests.RestAction.submit(RestAction.java:317)
        at net.dv8tion.jda.core.requests.RestAction.complete(RestAction.java:362)
        at net.dv8tion.jda.core.entities.impl.JDAImpl.verifyToken(JDAImpl.java:179)
        at net.dv8tion.jda.core.entities.impl.JDAImpl.login(JDAImpl.java:126)
        at net.dv8tion.jda.core.JDABuilder.buildAsync(JDABuilder.java:524)
        at net.dv8tion.jda.core.JDABuilder.buildBlocking(JDABuilder.java:547)
        at main.Connection.main(Connection.java:17)
--Finished loading--
Exception in thread "main" java.lang.NullPointerException
        at main.Connection.main(Connection.java:33)

Thank you! :)

-Niels

DV8FromTheWorld commented 7 years ago

This is not a JDA error, this is a JVM error. You need to install the proper SSL certs for your JVM to use.

DuncanCasteleyn commented 7 years ago

This might help you towards solving the problem. Like said this is not a JDA issues but rather an issue with the crypto provider or JVM.

Niels1006 commented 7 years ago

I installed raspbian and it works fine ^^ Ty anyways