[NAS-1801] Could not initialize class sun.awt.X11GraphicsEnvironment when starting Quickstart system on Fedora Created: 16/Mar/11  Updated: 29/Jul/14  Resolved: 07/Oct/11

Status: Resolved
Project: NetarchiveSuite
Component/s: Harvest Monitor
Affects Version/s: 3.15.0
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Søren Vejrup Carlsen (Inactive) Assignee: Søren Vejrup Carlsen (Inactive)
Resolution: Cannot Reproduce  
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Inspector: Mikis Seth Sørensen Mikis Seth Sørensen (Inactive)

 Description   

I get this exception when I deploy netarchivesuite on a single machine (Quickstart setup).
I deploy to test@localhost and if I log on manually with ssh to test@localhost and restart the apps using the restart.sh, the problem disappears.

SEVERE: Task threw exception:
java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
at java.util.concurrent.FutureTask.get(FutureTask.java:83)
at dk.netarkivet.common.lifecycle.PeriodicTaskExecutor.checkExecution(PeriodicTaskExecutor.java:197)
at dk.netarkivet.common.lifecycle.PeriodicTaskExecutor.access$500(PeriodicTaskExecutor.java:47)
at dk.netarkivet.common.lifecycle.PeriodicTaskExecutor$1.run(PeriodicTaskExecutor.java:176)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:68)
at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:89)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at java.awt.Toolkit$2.run(Toolkit.java:834)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:826)
at sun.swing.SwingUtilities2$AATextInfo.getAATextInfo(SwingUtilities2.java:118)
at javax.swing.plaf.metal.MetalLookAndFeel.initComponentDefaults(MetalLookAndFeel.java:1556)
at javax.swing.plaf.basic.BasicLookAndFeel.getDefaults(BasicLookAndFeel.java:130)
at javax.swing.plaf.metal.MetalLookAndFeel.getDefaults(MetalLookAndFeel.java:1591)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:514)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:554)
at javax.swing.UIManager.initializeDefaultLAF(UIManager.java:1317)
at javax.swing.UIManager.initialize(UIManager.java:1406)
at javax.swing.UIManager.maybeInitialize(UIManager.java:1394)
at javax.swing.UIManager.getDefaults(UIManager.java:633)
at javax.swing.UIManager.getColor(UIManager.java:675)
at org.jfree.chart.JFreeChart.<clinit>(JFreeChart.java:261)
at dk.netarkivet.harvester.harvesting.monitor.StartedJobHistoryChartGen.generatePngChart(StartedJobHistoryChartGen.java:445)
at dk.netarkivet.harvester.harvesting.monitor.StartedJobHistoryChartGen$ChartGen.run(StartedJobHistoryChartGen.java:197)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)



 Comments   
Comment by Søren Vejrup Carlsen (Inactive) [ 07/Oct/11 ]

As the HarvestMonitorApplication has disappeared in 3.16.0, the bug can no longer be verified.

Comment by Søren Vejrup Carlsen (Inactive) [ 30/Mar/11 ]

Considering this bug fixed, now.

Comment by Søren Vejrup Carlsen (Inactive) [ 17/Mar/11 ]

Thus the problem can be solved by including a (or updating the) deployJavaOpt line for the HarvestMonitorApplication in the deployconfiguration:

 <deployJavaOpt>-Xmx1536m -Djava.awt.headless=true</deployJavaOpt>

E.g.:

<applicationName name="dk.netarkivet.harvester.harvesting.monitor.HarvestMonitorApplication">
                <deployClassPath>lib/dk.netarkivet.harvester.jar</deployClassPath>
                <deployClassPath>lib/dk.netarkivet.monitor.jar</deployClassPath>
                <deployJavaOpt>-Xmx1536m -Djava.awt.headless=true</deployJavaOpt>
Comment by Søren Vejrup Carlsen (Inactive) [ 16/Mar/11 ]

Adding -Djava.awt.headless=true to the starting script for the HarvestMonitorApplication (conf/start_HarvestMonitorApplication.sh) does indeed solve the problem in my case!

Comment by Mikis Seth Sørensen (Inactive) [ 16/Mar/11 ]

A general solution to this problem according to Google is to set the java.awt.headless property to true, eg.

java -Djava.awt.headless=true .....
Generated at Wed Apr 24 06:17:55 CEST 2024 using Jira 9.4.15#940015-sha1:bdaa9cbecfb6791ea579749728cab771f0dfe90b.