error missing X11 on a headless server when running qualimap bamqc 0.7.1 via command line

1,200 views
Skip to first unread message

Wim S

unread,
May 13, 2013, 5:24:35 AM5/13/13
to qual...@googlegroups.com
I am using qualimap in a NGS pipeline for QC and I want to run qualimap from the command line on a server were I the X11 environment is not available. Running qualimap bamqc from the commandline should not be dependent on a X11 environment.

I get this problem with qualimap version 0.7.1. I did not have this problem with older versions. Somewhere in qualimap 0.7.1 a Swing JPanel is made which I guess is not needed for just making a PDF.

See the error below.  Below that is the command I entered to run qualimap.


Computing report...
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:186)
        at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:82)
        at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:106)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:186)
        at java.awt.Toolkit$2.run(Toolkit.java:849)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:841)
        at sun.swing.SwingUtilities2$AATextInfo.getAATextInfo(SwingUtilities2.java:121)
        at javax.swing.plaf.metal.MetalLookAndFeel.initComponentDefaults(MetalLookAndFeel.java:1564)
        at javax.swing.plaf.basic.BasicLookAndFeel.getDefaults(BasicLookAndFeel.java:147)
        at javax.swing.plaf.metal.MetalLookAndFeel.getDefaults(MetalLookAndFeel.java:1599)
        at javax.swing.UIManager.setLookAndFeel(UIManager.java:528)
        at javax.swing.UIManager.setLookAndFeel(UIManager.java:568)
        at javax.swing.UIManager.initializeDefaultLAF(UIManager.java:1318)
        at javax.swing.UIManager.initialize(UIManager.java:1405)
        at javax.swing.UIManager.maybeInitialize(UIManager.java:1393)
        at javax.swing.UIManager.getUI(UIManager.java:989)
        at javax.swing.JPanel.updateUI(JPanel.java:126)
        at javax.swing.JPanel.<init>(JPanel.java:86)
        at javax.swing.JPanel.<init>(JPanel.java:109)
        at javax.swing.JPanel.<init>(JPanel.java:117)
        at org.bioinfo.ngs.qc.qualimap.gui.utils.GraphicImagePanel.<init>(GraphicImagePanel.java:34)
        at org.bioinfo.ngs.qc.qualimap.gui.utils.TabPropertiesVO.<init>(TabPropertiesVO.java:120)
        at org.bioinfo.ngs.qc.qualimap.main.BamQcTool.execute(BamQcTool.java:220)
        at org.bioinfo.ngs.qc.qualimap.main.NgsSmartTool.run(NgsSmartTool.java:166)
        at org.bioinfo.ngs.qc.qualimap.main.NgsSmartMain.main(NgsSmartMain.java:94)

~/qualimap_v0.7.1/qualimap bamqc  -bam merged.bam -outdir ./ -outformat PDF -nt 8 --java-mem-size=20G

Konstantin Okonechnikov

unread,
May 13, 2013, 5:43:58 AM5/13/13
to qual...@googlegroups.com
Hi,

thanks for the report!

Actually we didn't introduce any major changes in 0.7 which could
result in such problem and our tests in server environment without X11
work fine.
Which was the older version that was working for you?

This also might be a problem related to Java virtual machine and
server configuration. Please refer to the solution in F.A.Q in
Qualimap documentation:
http://qualimap.bioinfo.cipf.es/doc_html/faq.html#command-line

Let us know if this worked for you.

--
Konstantin
> --
> You received this message because you are subscribed to the Google Groups
> "QualiMap" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to qualimap+u...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Wim S

unread,
May 13, 2013, 8:10:25 AM5/13/13
to qual...@googlegroups.com, k.okone...@gmail.com
Logging in with ssh -X to the server and then running the qualimap shell script fixed the problem.

I also looked at the Display variable. When I log in to the server without -X and execute printenv the DISPLAY variable is not listed.  Running qualimap gives the missing X11 error.

Logging in without -X and doing export DISPLAY=:0 givens makes DISPLAY=:0 listed in my my environment. Executing qualimap still fails with the missing X11 error.

Logging in without -X and doing unset DISPLAY work even though DISPLAY was not listed in my environment.

I still think it is  kind of strange that Swing is being called from a command line program and that the Display variable needs to be unset. However I am happy that I have a solution and can use qualimap from my NGS pipeline.

Konstantin Okonechnikov

unread,
May 13, 2013, 11:56:07 AM5/13/13
to qual...@googlegroups.com
Great, glad to know that it worked!

Anyway, you are right, Swing components should not be called from a
command line application, we will further investigate and, hopefully,
fix this issue in future releases.

--
Konstantin

rupeshkumar....@universitadipavia.it

unread,
Oct 23, 2013, 10:53:11 AM10/23/13
to qual...@googlegroups.com, k.okone...@gmail.com
HI,

I faced similar problem and did the same what you did for (Logging in without -X and doing unset DISPLAY work even though DISPLAY was not listed in my environment) but STILL NOT SOLVED MY PROBLEM.

Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.
        at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
        at sun.awt.X11GraphicsEnvironment.access$100(Unknown Source)
        at sun.awt.X11GraphicsEnvironment$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.awt.X11GraphicsEnvironment.<clinit>(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(Unknown Source)
        at java.awt.Window.init(Unknown Source)
        at java.awt.Window.<init>(Unknown Source)
        at java.awt.Frame.<init>(Unknown Source)
        at javax.swing.JFrame.<init>(Unknown Source)
        at org.bioinfo.ngs.qc.qualimap.gui.frames.HomeFrame.<init>(HomeFrame.java:151)
        at org.bioinfo.ngs.qc.qualimap.main.NgsSmartMain.launchGUI(NgsSmartMain.java:150)
        at org.bioinfo.ngs.qc.qualimap.main.NgsSmartMain.main(NgsSmartMain.java:48)


help me please

Konstantin Okonechnikov

unread,
Oct 23, 2013, 12:21:15 PM10/23/13
to qual...@googlegroups.com
Hi!

What was the command that you run? Did you try setting export DISPLAY=:0 ?

Can you perhaps try installing the latest Qualimap snapshot?
https://www.dropbox.com/sh/0zpbl8b2yw5doxp/yxCagUtQi7/qualimap-build-11-09-13.tar.gz

I have not been able to reproduce this bug in our server environment, but I think we have removed any code dependency for X11 components in the latest version.

rupeshkumar....@universitadipavia.it

unread,
Nov 4, 2013, 6:21:29 AM11/4/13
to qual...@googlegroups.com, k.okone...@gmail.com
thank you for your kind reply...

i just changed my directory of cd qualimap_v0.7.1

and ran by ./qualimap

Note: before run this command i already fixed the value by terminal

export DISPLAY=:0

or

unset DISPLAY

but its not worked, GOT SAME ERROR AS PREVIOUSLY MENTIONED.

thank you and looking forward for solution

rupeshkumar....@universitadipavia.it

unread,
Nov 4, 2013, 7:18:49 AM11/4/13
to qual...@googlegroups.com, k.okone...@gmail.com
I tried with latest version (QualiMap v.0.8-dev) but error remain same...

Alexander Peltzer

unread,
Jul 25, 2014, 4:11:36 AM7/25/14
to qual...@googlegroups.com
Unfortunately this is an issue for me here, too. I tried running QualiMap using "unset DISPLAY" or "export DISPLAY=.." as suggested in the FAQ and it works, however this is a "workaround" that has some dependencies for me in my pipeline that I develop using Java, that I can't circumvent in all cases. So it would be much better to fix this upstream (e.g. in QualiMap) other than relying on users to implement "hacks" in order to execute scripts prior to executing your tool. Maybe it would be great if you could include the unset ... method in your ./qualimap script, checking if a user really wants to execute the CLI version as you do for other variables, too inside this script. 


Konstantin Okonechnikov

unread,
Aug 12, 2014, 8:28:17 AM8/12/14
to qual...@googlegroups.com
Dear Alexander,

one possible solution could be adding a wrapper script which is adapted for server environment. The problem is that I could not reproduce this bug on our servers, so we are limited in testing the implementation.

ankit arora

unread,
Dec 10, 2014, 11:11:45 AM12/10/14
to qual...@googlegroups.com
Respected sir,

I am getting this type of error when I am running qualimap :

Java memory size is set to 1200M
Launching application...

Exception in thread "main" java.lang.NoClassDefFoundError: org/bioinfo/ngs/qc/qualimap/main/NgsSmartMain
Caused by: java.lang.ClassNotFoundException: org.bioinfo.ngs.qc.qualimap.main.NgsSmartMain
        at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: org.bioinfo.ngs.qc.qualimap.main.NgsSmartMain. Program will exit.


I do have Java installed with version  Java : java version "1.6.0_24" .


Thanks

Regards
Ankit

Alexander Peltzer

unread,
Dec 28, 2014, 7:29:06 AM12/28/14
to qual...@googlegroups.com
Unfortunately, I can confirm this issue as well. I did the following:

- Unpack latest (v2.0) qualimap to /opt/qualimap
- "ln -s /usr/bin/qualimap /opt/qualimap/qualimap"
- Added the following to work around the X11 issues I had:

Beginning of "qualimap" execution script:

tmpDISPLAY=$DISPLAY
unset DISPLAY

End of "qualimap" execution script:

DISPLAY=$tmpDisplay

(to get my DISPLAY variable back to what it was prior to executing qualimap).

Calling qualimap by running "qualimap" using a login shell now works flawlessly, unfortunately it doesn't when calling using e.g. Python or Java ProcessBuilders. 
Here I get the message:

Error: Could not find or load main class org.bioinfo.ngs.qc.qualimap.main.NgsSmartMain
Reply all
Reply to author
Forward
0 new messages