mojira.dev
MC-80817

Server Does Not Start - OSHI / JNA - java.lang.UnsatisfiedLinkError

Some users are unable to run the server as of 1.8.3 due to an error in utilizing the OSHI library to get processor information.
The error looks something like this:

java.lang.UnsatisfiedLinkError: Can't obtain static newInstance method for class
com.sun.jna.Structure
at com.sun.jna.Native.initIDs(Native Method)
at com.sun.jna.Native.<clinit>(Native.java:135)
at com.sun.jna.Pointer.<clinit>(Pointer.java:42)
at com.sun.jna.platform.win32.WinReg$HKEY.<init>(WinReg.java:32)
at com.sun.jna.platform.win32.WinReg.<clinit>(WinReg.java:61)
at oshi.software.os.windows.WindowsHardwareAbstractionLayer.getProcessor
s(WindowsHardwareAbstractionLayer.java:33)
at net.minecraft.server.SystemUtils.<clinit>(SourceFile:16)
java.lang.UnsatisfiedLinkError: Can't obtain static newInstance method for class
com.sun.jna.Structure
at com.sun.jna.Native.initIDs(Native Method)
at com.sun.jna.Native.<clinit>(Native.java:135)
at com.sun.jna.Pointer.<clinit>(Pointer.java:42)
at com.sun.jna.platform.win32.WinReg$HKEY.<init>(WinReg.java:32)
at com.sun.jna.platform.win32.WinReg.<clinit>(WinReg.java:61)
at oshi.software.os.windows.WindowsHardwareAbstractionLayer.getProcessor
s(WindowsHardwareAbstractionLayer.java:33)
at net.minecraft.server.SystemUtils.<clinit>(SourceFile:16)

The code however is designed to prevent this error and fall back to "<unknown>", but it is incorrectly designed to catch Exception rather than Throwable (which an UnsatisfiedLinkError is). The fix is simply to widen the catch block in the file we name as SystemUtils from Exception to Throwable.

Some additional info on this issue can be seen: https://hub.spigotmc.org/jira/browse/BUILDTOOLS-114

Linked issues

Comments 5

This is still an issue. I was able to determine that it is directly related to the Java 64-bit client. When running a Minecraft Server from Java 32-bit, this issue does not occur.
Also, the server starts fine, it crashes when any client attempts to connect.
This was tested on Java 7_80 and Java 8_51
Below is the crash log I receive every time:


Minecraft Crash Report ----
// Why did you do that?

Time: 7/20/15 3:45 PM
Description: Exception in server tick loop

java.lang.UnsatisfiedLinkError: Can't obtain static newInstance method for class com.sun.jna.Structure
at com.sun.jna.Native.initIDs(Native Method)
at com.sun.jna.Native.<clinit>(Native.java:135)
at com.sun.jna.Pointer.<clinit>(Pointer.java:42)
at com.sun.jna.platform.win32.WinReg$HKEY.<init>(WinReg.java:32)
at com.sun.jna.platform.win32.WinReg.<clinit>(WinReg.java:61)
at oshi.software.os.windows.WindowsHardwareAbstractionLayer.getProcessors(WindowsHardwareAbstractionLayer.java:33)
at g.<clinit>(SourceFile:16)
at net.minecraft.server.MinecraftServer.B(SourceFile:579)
at ko.B(SourceFile:299)
at net.minecraft.server.MinecraftServer.A(SourceFile:535)
at net.minecraft.server.MinecraftServer.run(SourceFile:451)
at java.lang.Thread.run(Unknown Source)

A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

– System Details –
Details:
Minecraft Version: 1.8.7
Operating System: Windows Server 2008 R2 (amd64) version 6.1
CPU: ~ERROR~ NoClassDefFoundError: Could not initialize class g
Java Version: 1.7.0_80, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 3761637512 bytes (3587 MB) / 4116709376 bytes (3926 MB) up to 4116709376 bytes (3926 MB)
JVM Flags: 2 total; -Xmx4G -Xms4G
IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94
Profiler Position: N/A (disabled)
Player Count: 1 / 20; [lf['roxim5'/241, l='world', x=-208.99, y=79.00, z=-222.28]]
Is Modded: Unknown (can't tell)
Type: Dedicated Server (map_server.txt)

Confirmed this to be fixed in snapshot 1.8.8 on my testing.

md_5

Nathan Adams

Community Consensus

Minecraft 1.8.3, Minecraft 1.8.4, Minecraft 1.8.5, Minecraft 1.8.6, Minecraft 1.8.7

Minecraft 1.8.8

Retrieved