Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cross-project-issues-dev] Issue when multiple JNA versions end up in the same IDE



If multiple versions of com.sun.jna and com.sun.jna.platform end up in the same Eclipse installation, this can result in errors like the following, which we have seen recently:


java.lang.LinkageError: loader constraint violation: when resolving interface method 'boolean com.sun.jna.platform.win32.Kernel32.ReadFile(com.sun.jna.platform.win32.WinNT$HANDLE, byte[], int, com.sun.jna.ptr.IntByReference, com.sun.jna.platform.win32.WinBase$OVERLAPPED)' the class loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @216be7ba of the current class, com/sap/adt/sapgui/ui/internal/win32/embedding/PipeHelper, and the class loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @1885dc2b for the method's defining class, com/sun/jna/platform/win32/Kernel32, have different Class objects for the type com/sun/jna/ptr/IntByReference used in the signature ( is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @216be7ba, parent loader 'platform'; com.sun.jna.platform.win32.Kernel32 is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @1885dc2b, parent loader 'platform')






This specific IDE contained

com.sun.jna (5.8.0) [jna] -- reference:file:plugins/com.sun.jna_5.8.0.jar -- ACTIVE

com.sun.jna.platform (5.8.0) [jna-platform] -- reference:file:plugins/com.sun.jna.platform_5.8.0.jar – RESOLVED

com.sun.jna (5.8.0.v20210503-0343) [Java Native Access] -- reference:file:plugins/com.sun.jna_5.8.0.v20210503-0343.jar -- ACTIVE

com.sun.jna.platform (5.8.0.v20210406-1004) [Java Native Access Platform] -- reference:file:plugins/com.sun.jna.platform_5.8.0.v20210406-1004.jar – RESOLVED



5.8.0 is the official maven central version consumed via Tycho target directly from maven and which is currently part of SimRel 2022-09/12:

5.8.0.v20210503-0343 is an Eclipse Orbit bundle, part of older SimRels:



The official one appears to be missing proper uses constraints in the OSGi metadata, which I suspect can lead to this kind of issue. I have opened a bug:



eclipse.exe -clean

was able to resolve this problem in the bug reports we have received.



Is there something we do in SimRel to prevent this from running into this situation in upgrade scenarios in the first place (other than waiting for the metadata in JNA to be corrected and consume the newer version)?



Best regards,


Back to the top