Vatuu / discord-rpc

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

Correct shading #35

Open 1-alex98 opened 5 years ago

1-alex98 commented 5 years ago

Hi everyone could be cool if you corrected the shading of jna library and made a new release ;) I need that for my app because your version of jna is incompatible with mine...

Fixes #34

1-alex98 commented 5 years ago

Looks super good when i look at the file exactly what I expected

1-alex98 commented 5 years ago

But

Exception in Application init method
java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:473)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:372)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:941)
Caused by: java.lang.RuntimeException: Exception in Application init method
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:968)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:198)
    at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clientDiscordEventHandler' defined in file [C:\Users\alexa\IdeaProjects\downlords-faf-client\out\production\classes\com\faforever\client\discord\ClientDiscordEventHandler.class]: Bean instantiation via constructor failed; nested exception is java.lang.UnsatisfiedLinkError: net.arikia.dev.jna.Native.getNativeVersion()Ljava/lang/String;
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:303)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:284)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1308)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1154)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:846)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:771)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:139)
    at com.faforever.client.FafClientApplication.init(FafClientApplication.java:93)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:897)
    ... 2 more
Caused by: java.lang.UnsatisfiedLinkError: net.arikia.dev.jna.Native.getNativeVersion()Ljava/lang/String;
    at net.arikia.dev.jna.Native.getNativeVersion(Native Method)
    at net.arikia.dev.jna.Native.<clinit>(Native.java:192)
    at net.arikia.dev.jna.Pointer.<clinit>(Pointer.java:54)
    at net.arikia.dev.jna.Structure.<clinit>(Structure.java:2130)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:172)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:117)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:299)
    ... 20 more
1-alex98 commented 5 years ago

So it does not find some native method or probably none of them

1-alex98 commented 5 years ago

Ok no further ideas on this

DeJayDev commented 5 years ago

Shading JNA isn't as easy as classpath relocation, I'd have to pack the entire thing into discord-rpc. All that native stuff is sitting in another path of the JNA jar.

1-alex98 commented 5 years ago

Hmm ok I dont know much about jna

1-alex98 commented 5 years ago

Shading JNA isn't as easy as classpath relocation, I'd have to pack the entire thing into discord-rpc. All that native stuff is sitting in another path of the JNA jar.

Can you tell me what exactly you mean? The is of cause the native code of jna which is in the .so files, which i shifted as well. And now the java code and the so files are in a new folder so are still in the same spot relative to each other. So what would I need to move...

1-alex98 commented 5 years ago

Asked in jna forum https://groups.google.com/forum/#!topic/jna-users/CzkwEBXRzRE