Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-699

Recover gracefully when no graphics display is available

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Won't Fix
    • 1.3.0-beta2
    • 1.3.0-beta3
    • wicket-examples
    • None

    Description

      When loading the captcha example with no graphics display, here is the error I get:

      Caused by: java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
              at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
              at sun.awt.X11GraphicsEnvironment.access$000(X11GraphicsEnvironment.java:53)
              at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:142)
              at java.security.AccessController.doPrivileged(Native Method)
              at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:131)
              at java.lang.Class.forName0(Native Method)
              at java.lang.Class.forName(Class.java:164)
              at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:68)
              at sun.font.FontManager.initSGEnv(FontManager.java:953)
              at sun.font.FontManager.findFont2D(FontManager.java:1115)
              at java.awt.Font.getFont2D(Font.java:358)
              at java.awt.Font.defaultLineMetrics(Font.java:1816)
              at java.awt.Font.getLineMetrics(Font.java:1902)
              at java.awt.font.TextLayout.fastInit(TextLayout.java:679)
              at java.awt.font.TextLayout.<init>(TextLayout.java:480)
              at org.apache.wicket.extensions.markup.html.captcha.CaptchaImageResource.<init>(CaptchaImageResource.java:192)
              at org.apache.wicket.extensions.markup.html.captcha.CaptchaImageResource.<init>(CaptchaImageResource.java:155)
              at org.apache.wicket.examples.captcha.Captcha$CaptchaForm.<init>(Captcha.java:53)
              at org.apache.wicket.examples.captcha.Captcha.<init>(Captcha.java:116)
      

      We could intercept this and recover gracefully, to instruct users in the wicket example page how to setup the server for making this work.

      Similar issue on images example:

      java.lang.NoClassDefFoundError
      	at java.lang.Class.forName0(Native Method)
      	at java.lang.Class.forName(Class.java:164)
      	at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:68)
      	at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1141)
      	at java.awt.image.BufferedImage.getGraphics(BufferedImage.java:1131)
      	at org.apache.wicket.examples.images.Home$1.newResource(Home.java:109)
      	at org.apache.wicket.ResourceReference.bind(ResourceReference.java:148)
      	at org.apache.wicket.markup.html.image.resource.LocalizedImageResource.bind(LocalizedImageResource.java:184)
      	at org.apache.wicket.markup.html.image.resource.LocalizedImageResource.setResourceReference(LocalizedImageResource.java:239)
      	at org.apache.wicket.markup.html.image.Image.setImageResourceReference(Image.java:177)
      	at org.apache.wicket.markup.html.image.Image.(Image.java:101)
      	at org.apache.wicket.markup.html.image.Image.(Image.java:76)
      	at org.apache.wicket.examples.images.Home.(Home.java:82)
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            jbq Jean-Baptiste Quenot
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: