0

We recently upgraded our Linux Ubuntu to 5.4.0-1058-gcp ( GCP VM )and our mobile app started to malfunction.

Is this java version going to help fix the issue?

openjdk version "11.0.13" 2021-10-19
OpenJDK Runtime Environment (build 11.0.13+8-Ubuntu-0ubuntu1.18.04)
OpenJDK 64-Bit Server VM (build 11.0.13+8-Ubuntu-0ubuntu1.18.04, mixed mode, sharing)


Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: 
sun.java2d.HeadlessGraphicsEnvironment cannot be cast to 
sun.awt.Win32GraphicsEnvironment
at sun.awt.windows.WToolkit$3.run(WToolkit.java:834)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Holger
  • 285,553
  • 42
  • 434
  • 765
Rn3l
  • 43
  • 5
  • "Headless" normally indicates pure server install without desktop, and indeed it is `OpenJDK 64-Bit Server VM`. If the Ubuntu is a desktop version (as opposed to a server version), you should be able to install a desktop (Open)JDK. Desktop meaning: having a GUI, window manager. Try a small Hello World GUI. – Joop Eggen Jan 04 '22 at 22:36
  • @JoopEggen, it's a dedicated pure server VM. Should I proceed to install the OpenJDK 64-Bit Server VM to fix the problem? – Rn3l Jan 04 '22 at 22:43
  • And still there is an AWT event queue started, a GUI? I hope you can find more in the stack trace, further below. Normally one would have assumed a transition to modular could break things, but this is weird. Did you start some server monitoring GUI? – Joop Eggen Jan 04 '22 at 22:56
  • @JoopEggen, there is no monitoring running in the GCP VM server. It's only this one java application. – Rn3l Jan 04 '22 at 23:45
  • 2
    The problem is not the headless mode, the problem is the attempt to use a *Windows* implementation of the UI framework under *Linux*. Since the line number in the stacktrace does not match the OpenJDK 11.0.13’s `WToolkit` source code, it apparently is not only the wrong toolkit for this operating system, but also not the toolkit shipped with this Java version. Seems like someone is trying really hard to mess up this environment. – Holger Jan 05 '22 at 09:12
  • @Holger thanks for jumping in. `sun.awt.windows` seems to point to non-OpenJDK, Oracle for Windows. One maybe could find something under /usr/lib/jvm, but I am not that experienced. – Joop Eggen Jan 05 '22 at 11:21
  • 1
    @JoopEggen the class `sun.awt.windows.WToolkit` does exist in OpenJDK 11, but as said, its line 834 does not contain a matching type cast to produce this `ClassCastException`. – Holger Jan 05 '22 at 11:32

0 Answers0