Vatuu / discord-rpc

Java Wrapper of the Discord-RPC Library for Discord Rich Presence.
MIT License
193 stars 42 forks source link

Throwing NullPointerException & ExceptionInInitializerError when intializing #32

Closed wodxgod closed 5 years ago

wodxgod commented 5 years ago

OS: Windows 10 pro version 10.0.17134 N/A Build 17134 SDK version: v1.8.0_191

In the the start/main class: https://pastebin.com/GRYQ9fjV Stacktrace errors: https://pastebin.com/gNesPve5

DeJayDev commented 5 years ago

Are you on a 32bit device (somehow?)

Can you do me a favor and verify there is a folder titled discord-rpc in your appdata? %appdata%/discord-rpc

jaideepheer commented 5 years ago

I am facing a similar error. My code is executed on a Windows 7 (x86) version 6.1 Java Version: 1.8.0_101

Relavant part of stacktrace :-

Caused by: java.lang.NullPointerException
    at jdmcmods.custom_discordrpc.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2314)
    at jdmcmods.custom_discordrpc.apache.commons.io.IOUtils.copy(IOUtils.java:2270)
    at jdmcmods.custom_discordrpc.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2291)
    at jdmcmods.custom_discordrpc.apache.commons.io.IOUtils.copy(IOUtils.java:2246)
    at net.arikia.dev.drpc.DiscordRPC.loadDLL(DiscordRPC.java:150)
    at net.arikia.dev.drpc.DiscordRPC.<clinit>(DiscordRPC.java:22)
    ... 43 more

Code causing exception: Link to GitHub file.

Full stacktrace: Link to stacktrace.

ErdbeerbaerLP commented 5 years ago

I have pretty much the same problem. (Using JNA 4.4.0 because of Minecraft 1.13 limitations)

Latest.log (see line 48 or 81)

Source

Java version:

java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
DeJayDev commented 5 years ago

I feel like the shared problem across platforms is Windows 32bit (x86). (Though I'm not sure what @ErdbeerbaerLP is running)

The way we copy the lib (discord-rpc.dll) is we stream it's data from inside the jar to the %localappdata%/discord-rpc-java folder. On x64, this isn't an issue. The hard part is actually thinking of an alternative to this issue, because right now it's the most crossplatforming feature we have that doesn't rely on a third party lib (in our testing, actually using the Apache Commons stuff doesn't make Minecraft very happy).

Source to file copying function.

ErdbeerbaerLP commented 5 years ago

iam on 64 bit java and OS. For me it copies a 0 byte sized dll to TEMP/discord-rpc.

DeJayDev commented 5 years ago

@WodxTV Are you sure you're using the most stable release? We're on: jitpack

@jaideepheer Same goes for you, it appears that your version is still the one that bundles the Apache commons. (I'm surprised Minecraft's starting in the first place)

@ErdbeerbaerLP Change this to the actual library. https://github.com/ErdbeerbaerLP/DiscordRichPresence/blob/master/build.gradle#L77

(It should read: shade 'com.github.Vatuu:discord-rpc:1.6.1'

ErdbeerbaerLP commented 5 years ago

yeah, that won´t work because i can´t install a newer JDA, i included it in src but the latest release modified to use JDA 4.

ErdbeerbaerLP commented 5 years ago

Version 1.6.2 almost fixed it... New error: java.lang.UnsatisfiedLinkError: Native library (com/sun/jna/win32-x86-64/jnidispatch.dll) not found in resource path

DeJayDev commented 5 years ago

That one seems like it's on your end,

You stated you modified your source to use JDA 4. Remove that modification and allow discord-rpc-java to handle JNA.

ErdbeerbaerLP commented 5 years ago

Don´t need that in 1.6.2 anymore

ErdbeerbaerLP commented 5 years ago

It was an error on my side, it had jna included again. Without including JNA in the mod this error comes back. New log: https://pastebin.com/0AiCp7Ez New Crash: https://paste.dimdev.org/sasuxazezi.mccrash

DeJayDev commented 5 years ago

Please try to use the library on its own and not through a wrapper, no custom anything is needed around it. Furthermore, please contact me on Discord (DeJay#1337) and we'll look at your code together to narrow the issue.

Closing due to the original commenter being inactive.

ErdbeerbaerLP commented 5 years ago

Discord does not find you 🤔