Gradle 2.14-rc-3 generated Gradle API library causes runtime issues w/ JNA

gradle-3467

(Danny Thomas) #1

There are both standard and relocated versions of libjnidispatch.jnilib, making it impossible for plugins to use later versions of JNA:

.gradle/caches/2.14-rc-3/generated-gradle-jars/gradle-api-2.14-rc-3.jar!/com/sun/jna/darwin/libjnidispatch.jnilib
.gradle/caches/2.14-rc-3/generated-gradle-jars/gradle-api-2.14-rc-3.jar!/org/gradle/internal/impldep/com/sun/jna/darwin/libjnidispatch.jnilib
.gradle/caches/modules-2/files-2.1/net.java.dev.jna/jna/4.1.0/1c12d070e602efd8021891cdd7fd18bc129372d4/jna-4.1.0.jar!/com/sun/jna/darwin/libjnidispatch.jnilib

At runtime, this will cause:

java.lang.UnsatisfiedLinkError: Can't obtain updateLastError method for class com.sun.jna.Native

    at com.sun.jna.Native.<clinit>(Native.java:139)
    at com.jcraft.jsch.agentproxy.usocket.JNAUSocketFactory$CLibrary.<clinit>(JNAUSocketFactory.java:47)
    at com.jcraft.jsch.agentproxy.usocket.JNAUSocketFactory.open(JNAUSocketFactory.java:114)
    at com.jcraft.jsch.agentproxy.connector.SSHAgentConnector.open(SSHAgentConnector.java:93)
    at com.jcraft.jsch.agentproxy.connector.SSHAgentConnector.<init>(SSHAgentConnector.java:54)
    at com.jcraft.jsch.agentproxy.connector.SSHAgentConnector.<init>(SSHAgentConnector.java:44)
    at netflix.nebula.git.IdBasedFactory.createDefaultJSch(IdBasedFactory.groovy:37)
    at org.eclipse.jgit.transport.JschConfigSessionFactory.getJSch(JschConfigSessionFactory.java:247)
    at org.eclipse.jgit.transport.JschConfigSessionFactory.createSession(JschConfigSessionFactory.java:219)
    at org.eclipse.jgit.transport.JschConfigSessionFactory.createSession(JschConfigSessionFactory.java:175)
    at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:109)

I guess this worked previously by sheer luck of classpath ordering, as previously it came in from here:

/Users/dannyt/.gradle/wrapper/dists/gradle-2.13-bin/4xsgxlfjcxvrea7akf941nvc7/gradle-2.13/lib/jna-3.2.7.jar!/com/sun/jna/darwin/libjnidispatch.jnilib

Am I reading this correctly, and JNA is now only used on Windows?

If so, the non-Windows bindings can be removed from the generated jars to avoid these problems during development.


(Stefan Wolf) #2

Thanks for reporting. This will be fixed in 2.14-rc-4.