Page 1 of 1

JNA version

Posted: Tue Apr 21, 2020 7:38 pm
by Isabelle
Hello,

I need to use JNA 5.3.1 in our application, but we have conflict with your patched version

Code: Select all

oxygen-patched-jna-21.1.0.2.jar:4.1.0
.
Moreover it seems there are incompatibilities between version 4.1.0 and 5.x of JNA :
https://github.com/java-native-access/j ... ng-changes

4.1.0 version of JNA seems to be an old version.
Do you plan to implement a 5.x version of JNA soon?

Regards,
Isabelle

Re: JNA version

Posted: Wed Apr 22, 2020 8:34 am
by Radu
Hi Isabelle,

I added an internal issue to look into upgrading our used JNA library but I cannot guarantee a timeline for it.
What errors do you get when you use the latest JNA library instead of ours? For the Author Component I think that we use JNA mostly for the Hunspell spell checker.
Another idea would be for you to create a separate class loader to load the newest JNA library and work with the library through this custom class loader.

Regards,
Radu

Re: JNA version

Posted: Wed Apr 22, 2020 10:51 am
by Isabelle
Hi Radu,

The last test I have made was to exclude jna-plateform from oxygen-sdk via pom maven like this :

Code: Select all

<dependency>
            <groupId>com.oxygenxml</groupId>
            <artifactId>oxygen-sdk</artifactId>
            <version>${oxygen.version}</version>           
            <exclusions>
                <exclusion>
                    <groupId>net.java.dev.jna</groupId>
                    <artifactId>jna-platform</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
And add the version 5.3.1 of jna-platform in the same pom file.

And here was the error I get :

Code: Select all

java.lang.UnsatisfiedLinkError: Can't obtain static method fromNative(Method, Object) from class com.sun.jna.Native
	at com.sun.jna.Native.initIDs(Native Method) ~[oxygen-patched-jna-21.1.0.2.jar:4.1.0 (b4)]
	at com.sun.jna.Native.<clinit>(Native.java:143) ~[oxygen-patched-jna-21.1.0.2.jar:4.1.0 (b4)]
	at com.sun.jna.Pointer.<clinit>(Pointer.java:41) ~[oxygen-patched-jna-21.1.0.2.jar:4.1.0 (b4)]
	at com.sun.jna.Structure.<clinit>(Structure.java:1949) ~[oxygen-patched-jna-21.1.0.2.jar:4.1.0 (b4)]
	at oshi.jna.platform.windows.VersionHelpers.IsWindowsVersionOrGreater(VersionHelpers.java:56) ~[oshi-core-3.13.4.jar:3.13.4]
	at oshi.jna.platform.windows.VersionHelpers.IsWindows7OrGreater(VersionHelpers.java:135) ~[oshi-core-3.13.4.jar:3.13.4]
	at oshi.software.os.windows.WindowsOperatingSystem.<clinit>(WindowsOperatingSystem.java:103) ~[oshi-core-3.13.4.jar:3.13.4]
	at oshi.SystemInfo.getOperatingSystem(SystemInfo.java:97) ~[oshi-core-3.13.4.jar:3.13.4]
	at com._4dconcept.quadrolic.asymmetric.systemid.strategy.v2.V2SystemIdStrategy.createPayload(V2SystemIdStrategy.java:36) ~[quadrolic-systemid-common-2.1.1-SNAPSHOT.jar:na]
	at com._4dconcept.quadrolic.asymmetric.systemid.strategy.v2.V2SystemIdStrategy.check(V2SystemIdStrategy.java:59) ~[quadrolic-systemid-common-2.1.1-SNAPSHOT.jar:na]
	at com._4dconcept.quadrolic.asymmetric.systemid.SystemId.check(SystemId.java:60) ~[quadrolic-systemid-common-2.1.1-SNAPSHOT.jar:na]
	at com._4dconcept.quadrolic.asymmetric.LicenseLoader.registerLicense(LicenseLoader.java:90) ~[quadrolic-asymmetric-2.1.1-SNAPSHOT.jar:na]
	at com._4dconcept.adam.author.standalone.AuthorComponentLicenseManager.checkLicense(AuthorComponentLicenseManager.java:64) ~[author-core-core-4.3.0-SNAPSHOT.jar:na]
	at com._4dconcept.adam.author.standalone.ApplicationLauncher.launch(ApplicationLauncher.java:107) ~[author-core-core-4.3.0-SNAPSHOT.jar:na]
	at com._4dconcept.adam.author.custo.adam.CustoLauncher.main(CustoLauncher.java:77) ~[classes/:na]
I made this test because of the result of

Code: Select all

mvn dependency:tree
which reveals that oxygen-sdk was the only one to get jna-platform 4.1.0.

I have already started to create a separate class loader for our need, thanks.
But it is a big development to workaround an old version of jna.

Regards,
Isabelle

Re: JNA version

Posted: Wed Apr 22, 2020 11:41 am
by Radu
Hi Isabelle,

From that stack trace it looks as if our patched JNA JAR library is still in the classpath before the newer JNA library when the application is run. Maybe you can remove it from the classpath completely when starting the application.
Also please tell me if using the custom class loader worked for you.

Regards,
Radu

Re: JNA version

Posted: Mon Apr 27, 2020 12:28 pm
by Isabelle
Hello Radu,

Sorry for the late of my response, but before to report you, I want to make deep test.

I have tested to exclude your version of jna via maven.

Code: Select all

         <dependency>
            <groupId>com.oxygenxml</groupId>
            <artifactId>oxygen-sdk</artifactId>
            <version>${oxygen.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>net.java.dev.jna</groupId>
                    <artifactId>jna-platform</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.oxygenxml</groupId>
                    <artifactId>oxygen-patched-jna</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.oxygenxml</groupId>
                    <artifactId>native-jna</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
And I have specified a dependence to jna

Code: Select all

    <dependency>
      <groupId>net.java.dev.jna</groupId>
      <artifactId>jna</artifactId>
      <version>5.3.1</version>
    </dependency>
For the moment, it seems to work fine.
I will let you know if we get issues.
Thanks.

Regards,
Isabelle