Home > Enterprise >  UnsatisfiedLinkError (and NoClassDefFoundError) when trying to use java.awt.Graphics on App Engine
UnsatisfiedLinkError (and NoClassDefFoundError) when trying to use java.awt.Graphics on App Engine

Time:09-07

We use Java 8 on App Engine for our application, and recently we've randomly come across errors when trying to draw images in the application. Sometimes (but not always), we get an UnsatisfiedLinkError that seems to be because App Engine cannot find the dependency. Snippet of stack trace below:

java.lang.UnsatisfiedLinkError: /base/alloc/tmpfs/dynamic_runtimes/apphosting_java_openjre8/a26d810ece7dc740/lib/amd64/libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1838)
    at java.lang.Runtime.loadLibrary0(Runtime.java:871)
    at java.lang.System.loadLibrary(System.java:1124)
    at sun.font.FontManagerNativeLibrary$1.run(FontManagerNativeLibrary.java:61)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.font.FontManagerNativeLibrary.<clinit>(FontManagerNativeLibrary.java:32)
    at sun.font.SunFontManager$1.run(SunFontManager.java:346)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.font.SunFontManager.<clinit>(SunFontManager.java:342)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at sun.font.FontManagerFactory$1.run(FontManagerFactory.java:82)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74)
    at java.awt.Font.getFont2D(Font.java:491)
    at java.awt.Font.access$000(Font.java:224)
    at java.awt.Font$FontAccessImpl.getFont2D(Font.java:228)
    at sun.font.FontUtilities.getFont2D(FontUtilities.java:180)
    at sun.java2d.SunGraphics2D.checkFontInfo(SunGraphics2D.java:669)
    at sun.java2d.SunGraphics2D.getFontInfo(SunGraphics2D.java:830)
    at sun.java2d.SurfaceData.getTextPipe(SurfaceData.java:754)
    at sun.java2d.SurfaceData.validatePipe(SurfaceData.java:652)
    at sun.java2d.SunGraphics2D.validatePipe(SunGraphics2D.java:446)
    at sun.java2d.pipe.ValidatePipe.validate(ValidatePipe.java:55)
    at sun.java2d.pipe.ValidatePipe.scaleImage(ValidatePipe.java:218)
    at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:3400)
    at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:3344)

We also get a ClassDefNotFounError that looks very similar - but my understanding is the UnsatisfiedLinkError is the underlying problem for that as well.

We haven't made any changes to the dependencies of our project. According to documentation, AWT is supported on App Engine for Java 8, and we've had no issues in the past with this - it just randomly started a couple of days ago. There are no problems running locally, only when deployed to App Engine. The truly annoying part, is that this only happens sometimes - relatively rarely in fact - but it has started to become slightly more frequent, and there is no pattern to tell when it will or won't work.

We've tried updating the App Engine Java sdk to version 1.9.98 (currently using 1.9.93), and we are already running AWT in headless mode (a suggestion I've seen in other threads). Neither have fixed the problem.

Does anyone have any ideas, or know why this is only happening sometimes?

CodePudding user response:

It has been a few days and this seems to have resolved on its own, so I can only assume that this was a problem on Google/App Engine's end. Considering this resolved.

  • Related