Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not initialize class sun.awt.X11.XToolkit #86

Closed
wenbostar opened this issue Feb 7, 2016 · 16 comments
Closed

Could not initialize class sun.awt.X11.XToolkit #86

wenbostar opened this issue Feb 7, 2016 · 16 comments
Assignees
Labels

Comments

@wenbostar
Copy link

Hi,
Does anyone know how to solve the following problem?

The command line:
/home/test/software/jdk1.8.0_60/jre/bin/java -cp /home/test/software/SearchGUI-2.6.3/SearchGUI-2.6.3.jar eu.isas.searchgui.cmd.SearchCLI -spectrum_files test.mgf -id_params search.par -output_folder ./ -xtandem "1" -myrimatch "1" -ms_amanda 0 -msgf 0 -omssa 0 -comet 0 -tide 0 -andromeda 0 -temp_folder tmp

The OS information:
CentOS release 5.5 (Final)

The error message:
Path configuration completed.
Sun Feb 07 23:07:14 CST 2016 Validating MGF file: /home/test/mgf/test.mgf
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

Exception in thread "SwingWorker-pool-1-thread-2" Exception in thread "SwingWorker-pool-1-thread-1" java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11.XToolkit
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at java.awt.Toolkit$2.run(Toolkit.java:860)
at java.awt.Toolkit$2.run(Toolkit.java:855)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:854)
at java.awt.Toolkit.getEventQueue(Toolkit.java:1734)
at java.awt.EventQueue.isDispatchThread(EventQueue.java:1041)
at javax.swing.SwingUtilities.isEventDispatchThread(SwingUtilities.java:1361)
at javax.swing.SwingWorker.doneEDT(SwingWorker.java:740)
at javax.swing.SwingWorker.access$100(SwingWorker.java:225)
at javax.swing.SwingWorker$2.done(SwingWorker.java:302)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:384)
at java.util.concurrent.FutureTask.setException(FutureTask.java:251)
at java.util.concurrent.FutureTask.run(FutureTask.java:271)
at javax.swing.SwingWorker.run(SwingWorker.java:334)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11.XToolkit
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at java.awt.Toolkit$2.run(Toolkit.java:860)
at java.awt.Toolkit$2.run(Toolkit.java:855)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:854)
at java.awt.Toolkit.getEventQueue(Toolkit.java:1734)
at java.awt.EventQueue.isDispatchThread(EventQueue.java:1041)
at javax.swing.SwingUtilities.isEventDispatchThread(SwingUtilities.java:1361)
at javax.swing.SwingWorker.doneEDT(SwingWorker.java:740)
at javax.swing.SwingWorker.access$100(SwingWorker.java:225)
at javax.swing.SwingWorker$2.done(SwingWorker.java:302)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:384)
at java.util.concurrent.FutureTask.setException(FutureTask.java:251)
at java.util.concurrent.FutureTask.run(FutureTask.java:271)
at javax.swing.SwingWorker.run(SwingWorker.java:334)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

Best regards!
Bo

@hbarsnes hbarsnes self-assigned this Feb 7, 2016
@hbarsnes hbarsnes added the bug label Feb 7, 2016
@hbarsnes
Copy link
Member

hbarsnes commented Feb 7, 2016

Hi Bo,

Is that the complete stack trace? As there are no references to our code, just standard Java classes. The X11 error occurs when a GUI class is used in a headless environment. Which is usually easy to fix on our side, if we know which class to change. So I'm hoping that your error message is longer..?

Best regards,
Harald

@hbarsnes hbarsnes changed the title SearchGUI command line problem Could not initialize class sun.awt.X11.XToolkit Feb 7, 2016
@wenbostar
Copy link
Author

Hi Harald,
Thanks a lot. This is the complete message.
Best regards!
Bo

@hbarsnes
Copy link
Member

hbarsnes commented Feb 8, 2016

Hi Bo,

Seems like you tried to add the complete error message as an attachment to the e-mail..? But I'm afraid that does not work. You have to upload the file via the issue tracker for it to appear.

Best regards,
Harald

@wenbostar
Copy link
Author

Hi Harald,
Thanks again. Below is the complete error message:

Path configuration completed.
Sun Feb 07 23:07:14 CST 2016 Validating MGF file: /home/test/mgf/test.mgf
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

Exception in thread "SwingWorker-pool-1-thread-2" Exception in thread "SwingWorker-pool-1-thread-1" java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11.XToolkit
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at java.awt.Toolkit$2.run(Toolkit.java:860)
at java.awt.Toolkit$2.run(Toolkit.java:855)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:854)
at java.awt.Toolkit.getEventQueue(Toolkit.java:1734)
at java.awt.EventQueue.isDispatchThread(EventQueue.java:1041)
at javax.swing.SwingUtilities.isEventDispatchThread(SwingUtilities.java:1361)
at javax.swing.SwingWorker.doneEDT(SwingWorker.java:740)
at javax.swing.SwingWorker.access$100(SwingWorker.java:225)
at javax.swing.SwingWorker$2.done(SwingWorker.java:302)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:384)
at java.util.concurrent.FutureTask.setException(FutureTask.java:251)
at java.util.concurrent.FutureTask.run(FutureTask.java:271)
at javax.swing.SwingWorker.run(SwingWorker.java:334)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11.XToolkit
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at java.awt.Toolkit$2.run(Toolkit.java:860)
at java.awt.Toolkit$2.run(Toolkit.java:855)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:854)
at java.awt.Toolkit.getEventQueue(Toolkit.java:1734)
at java.awt.EventQueue.isDispatchThread(EventQueue.java:1041)
at javax.swing.SwingUtilities.isEventDispatchThread(SwingUtilities.java:1361)
at javax.swing.SwingWorker.doneEDT(SwingWorker.java:740)
at javax.swing.SwingWorker.access$100(SwingWorker.java:225)
at javax.swing.SwingWorker$2.done(SwingWorker.java:302)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:384)
at java.util.concurrent.FutureTask.setException(FutureTask.java:251)
at java.util.concurrent.FutureTask.run(FutureTask.java:271)
at javax.swing.SwingWorker.run(SwingWorker.java:334)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

Best regards!
Bo

@hbarsnes
Copy link
Member

hbarsnes commented Feb 8, 2016

Hi Bo,

Isn't that identical to the first error message above? There's really nothing more..?

Best regards,
Harald

@wenbostar
Copy link
Author

Yes~
image

@hbarsnes
Copy link
Member

hbarsnes commented Feb 8, 2016

Hi Bo,

Ok, we'll try to reproduce it on our end and get back to you.

Best regards,
Harald

@hbarsnes
Copy link
Member

hbarsnes commented Feb 8, 2016

Hi Bo,

I had a closer look at your error but I still don't understand why Xlib should be required as we don't use any GUI components in this part of the code. I also still find it very strange that there are no references to our own code, but only to general Java classes.

The only suggestion I came across was to add "-Djava.awt.headless=true" to your command line. Maybe you can check if that helps?

I will try to do some testing in a headless Linux environment later this week, but if you come across any fixes on your side please let us know.

Best regards,
Harald

@wenbostar
Copy link
Author

Hi Harald,
Thanks a lot. When I add "-Djava.awt.headless=true" to the command line, it works now.
Best regards!
Bo

@haiminhte
Copy link

Ignoring required pre-requisite failures. Continuing...
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2016-05-13_06-14-42PM. Please wait ...[oracle@dba database]$ Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11.XToolkit
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:171)
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 com.jgoodies.looks.LookUtils.isLowResolution(LookUtils.java:484)
at com.jgoodies.looks.LookUtils.(LookUtils.java:249)
at com.jgoodies.looks.plastic.PlasticLookAndFeel.(PlasticLookAndFeel.java:135)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:249)
at javax.swing.SwingUtilities.loadSystemClass(SwingUtilities.java:1852)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:557)
at oracle.install.commons.util.Application.startup(Application.java:792)
at oracle.install.commons.flow.FlowApplication.startup(FlowApplication.java:181)
at oracle.install.commons.flow.FlowApplication.startup(FlowApplication.java:198)
at oracle.install.commons.base.driver.common.Installer.startup(Installer.java:355)
at oracle.install.ivw.db.driver.DBInstaller.startup(DBInstaller.java:130)
at oracle.install.ivw.db.driver.DBInstaller.main(DBInstaller.java:161)
please help me

@hbarsnes
Copy link
Member

Ignoring required pre-requisite failures. Continuing...
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2016-05-13_06-14-42PM. Please wait ...[oracle@dba database]$ Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11.XToolkit
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:171)
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 com.jgoodies.looks.LookUtils.isLowResolution(LookUtils.java:484)
at com.jgoodies.looks.LookUtils.(LookUtils.java:249)
at com.jgoodies.looks.plastic.PlasticLookAndFeel.(PlasticLookAndFeel.java:135)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:249)
at javax.swing.SwingUtilities.loadSystemClass(SwingUtilities.java:1852)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:557)
at oracle.install.commons.util.Application.startup(Application.java:792)
at oracle.install.commons.flow.FlowApplication.startup(FlowApplication.java:181)
at oracle.install.commons.flow.FlowApplication.startup(FlowApplication.java:198)
at oracle.install.commons.base.driver.common.Installer.startup(Installer.java:355)
at oracle.install.ivw.db.driver.DBInstaller.startup(DBInstaller.java:130)
at oracle.install.ivw.db.driver.DBInstaller.main(DBInstaller.java:161)
please help me

What is it you are trying to do? I assume you are trying to run SearchGUI? But via the command line or via the graphical user interface? If running the graphical user interface please ensure that you have a X11 compatible system. Which operating system are you using?

BTW, in the future please create a new issue instead of adding to an older issue that has already been closed. As otherwise it becomes very hard for us to keep track of the currently open issues.

Best regards,
Harald

@KunathBJ
Copy link

Hello,

I have the same issue here but don't see where I should add this part in the command line:
-Djava.awt.headless=true
Can you guys tell me where/how to add it? Because I must put it wrong...

Thannks a lot,

Ben

@hbarsnes
Copy link
Member

Hi Ben,

Can you share the command line you are trying to run?

Best regards,
Harald

@KunathBJ
Copy link

KunathBJ commented May 29, 2020

Hi Harald,

Here is one of the thing I tried:

java -Xmx${MEM}G -cp $SG_DIR/SearchGUI-3.3.17.jar eu.isas.searchgui.cmd.IdentificationParametersCLI \
    -out "$OUT_DIR/${PREFIX}_params.par" \
    -db "$DB" \
    -prec_tol 10 \
    -prec_ppm 1 \
    -frag_tol 0.5 \
    -frag_ppm 0 \
    -digestion 0 \
    -enzyme "Trypsin" \
    -specificity 0 \
    -mc 1 \
    -fixed_mods "Carbamidomethylation of C" \
    -variable_mods "Oxidation of M" \
    -min_charge 2 \
    -max_charge 4 \
    -fi "b" \
    -ri "y" \
    -min_isotope 0 \
    -max_isotope 1 \
    -import_peptide_length_min 7 \
    -import_peptide_length_max 50 \
    -xtandem_noise_suppr 0 \
    -xtandem_quick_acetyl 1 \
    -xtandem_quick_pyro 1 \
    -xtandem_refine 1 \
    -msgf_instrument 1 \
    -msgf_fragmentation 1 \
    -msgf_protocol 0 \
    -msgf_min_pep_length 7 \
    -msgf_min_pep_length 50 \
    -msgf_num_ptms 3 \
    -comet_num_ptms 3

java -Xmx${MEM}G -cp $SG_DIR/SearchGUI-3.3.17.jar eu.isas.searchgui.cmd.SearchCLI \
    -spectrum_files "$MGF_DIR" \
    -output_folder "$OUT_DIR" \
    -id_params "$OUT_DIR/${PREFIX}_params.par" \
    -xtandem 1 \
    -msgf 1 \
    -comet 1 \
    -andromeda 0 \
    -threads $THREADS \
    -output_default_name "$PREFIX" \
    -output_option 0 \
    -output_data 1 \
    -output_date 1 \
    -log "$LOG" \
    -Djava.awt.headless=true

But then I receive an error saying that it's not right.
I also try to put it out of the searchgui command, but then it doesn't help and I do have the same issue than before.
Interestingly, generating the parameter file doesn't bring any issue

Thanks a lot,
Ben

@hbarsnes
Copy link
Member

Hi Ben,

If you move "-Djava.awt.headless=true" until before the "-cp" option I think it should work. That should make it into an option for the Java virtual machine and not an option for SearchGUI.

Best regards,
Harald

@KunathBJ
Copy link

Yeah. That worked just fine!
Thanks a lot!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants