This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 197411 - Should be able to log and run in headless mode
Summary: Should be able to log and run in headless mode
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Module System (show other bugs)
Version: 7.0
Hardware: PC Other
: P3 normal (vote)
Assignee: issues@platform
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-04 20:05 UTC by stoto79
Modified: 2011-04-07 08:48 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description stoto79 2011-04-04 20:05:33 UTC
In JDeveloper, which is a product using netbinox, we need to be able to run our product in headless mode. In that case, should there be any errors at startup, we get 

    [exec] java.lang.ExceptionInInitializerError
    [exec]     at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.getGTKStyleFactory(GTKLookAndFeel.java:1543)
    [exec]     at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.loadStyles(GTKLookAndFeel.java:1507)
    [exec]     at com.sun.java.swing.plaf.gtk.GTKLookAndFeel.initialize(GTKLookAndFeel.java:1394)
    [exec]     at javax.swing.UIManager.setLookAndFeel(UIManager.java:513)
    [exec]     at javax.swing.UIManager.setLookAndFeel(UIManager.java:558)
    [exec]     at org.netbeans.core.startup.NbEvents$Notifier.run(NbEvents.java:348)
    [exec]     at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
    [exec]     at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1957)
    [exec] Caused by: java.awt.HeadlessException
    [exec]     at sun.java2d.HeadlessGraphicsEnvironment.getDefaultScreenDevice(HeadlessGraphicsEnvironment.java:64)
    [exec]     at com.sun.java.swing.plaf.gtk.PangoFonts.<clinit>(PangoFonts.java:43)
    [exec]     ... 8 more
    [exec] java.lang.ClassCastException: org.openide.filesystems.Repository$MainFS cannot be cast to org.netbeans.core.startup.layers.SystemFileSystem
    [exec]     at org.netbeans.core.startup.layers.ModuleLayeredFileSystem.getUserModuleLayer(ModuleLayeredFileSystem.java:231)
    [exec]     at org.netbeans.core.startup.NbInstaller.loadLayers(NbInstaller.java:535)
    [exec]     at org.netbeans.core.startup.NbInstaller.load(NbInstaller.java:331)
    [exec]     at org.netbeans.ModuleManager.enable(ModuleManager.java:993)
    [exec]     at org.netbeans.core.startup.ModuleList.installNew(ModuleList.java:318)
    [exec]     at org.netbeans.core.startup.ModuleList.trigger(ModuleList.java:254)
    [exec]     at org.netbeans.core.startup.ModuleSystem.restore(ModuleSystem.java:286)
    [exec]     at org.netbeans.core.startup.Main.getModuleSystem(Main.java:172)
    [exec]     at org.netbeans.core.startup.Main.start(Main.java:308)
    [exec]     at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:123)
    [exec]     at java.lang.Thread.run(Thread.java:619)
Scanned 8844 files and directories in 568ms: 0 files added, 0 files removed, 0 directories added, 0 directories removed 

After some digging we saw that at line 348, org.netbeans.core.startup.NbEvents calls UIManager.setLookAndFeel().  This call should not be made when GraphicsEnvironment.isHeadless() returns true.  That seems to be the reason for the headless exception, and adding a check for isHeadless() might be all we need to do to fix it.
Comment 1 Jaroslav Tulach 2011-04-05 03:19:57 UTC
Netbinox runs in headless mode, unless dependencies of your plugins are broken. True, the error is slightly hidden, but if you fix your dependencies, then Netbinox starts ok in headless mode. I guess P3 is more appropriate priority.
Comment 2 stoto79 2011-04-05 07:46:49 UTC
Right, you only get this if there are warnings or errors on startup. Headless works fine otherwise. In our case, through the debugger, I saw it was trying to log text that went something like "WARNING: module oracle.ide cannot be loaded" but this bug was preventing it from surfacing to the user.
Comment 3 Jaroslav Tulach 2011-04-06 12:51:46 UTC
ergonomics#5ddeb01fe454
Comment 4 Quality Engineering 2011-04-07 08:48:15 UTC
Integrated into 'main-golden', will be available in build *201104070400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/5ddeb01fe454
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #197411: Check for headless mode and don't display splash or warnings