Avatar of ostraaten
ostraaten asked on

Eclipse headless on SLES 10 Linux org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]

Hi,
I'm trying to run Eclipse Process Framework headless on SLES 10 Linux. This fails with a message Exception in thread "Thread-2" org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]

So what I'm doing is the following: I ssh to my SLES 10 machine and then run a java command java -jar /home/user/epfc_1.5.0.2/plugins/org.eclipse.equinox.launcher_1.0.1.R33x_v20080118.jar -data /home/user/epfc_workspace -nosplash -application org.eclipse.epf.publishing.cmdline.Publish -libraryPath /home/user/tmp/epfprac/org.eclipse.epf/libraries/EPF_Practices/ -publishPath /home/usertmp/epfprac_publish -config publish.all_epf_practices -os linux -arch x86 -ws gtk

This causes the following error.
Exception in thread "Thread-2" org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]
      at org.eclipse.swt.SWT.error(SWT.java:3589)
      at org.eclipse.swt.widgets.Display.createDisplay(Display.java:836)
      at org.eclipse.swt.widgets.Display.create(Display.java:824)
      at org.eclipse.swt.graphics.Device.<init>(Device.java:152)
      at org.eclipse.swt.widgets.Display.<init>(Display.java:472)
      at org.eclipse.swt.widgets.Display.<init>(Display.java:463)
      at org.eclipse.epf.publishing.cmdline.Publish$1.run(Publish.java:77)
      at java.lang.Thread.run(Unknown Source)
org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]
      at org.eclipse.swt.SWT.error(SWT.java:3589)
      at org.eclipse.swt.widgets.Display.createDisplay(Display.java:836)
      at org.eclipse.swt.widgets.Display.create(Display.java:824)
      at org.eclipse.swt.graphics.Device.<init>(Device.java:152)
      at org.eclipse.swt.widgets.Display.<init>(Display.java:472)
      at org.eclipse.swt.widgets.Display.<init>(Display.java:463)
      at org.eclipse.swt.widgets.Display.getDefault(Display.java:1604)
      at org.eclipse.epf.library.services.SafeUpdateController.asyncExec(SafeUpdateController.java:59)
      at org.eclipse.epf.library.LibraryService.notifyListeners(LibraryService.java:659)
      at org.eclipse.epf.library.LibraryService.setCurrentMethodLibrary(LibraryService.java:455)
      at org.eclipse.epf.library.LibraryService.openMethodLibrary(LibraryService.java:230)
      at org.eclipse.epf.publishing.cmdline.Publish.run(Publish.java:105)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethod(EclipseAppContainer.java:572)
      at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:171)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:508)
      at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
      at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
      at org.eclipse.equinox.launcher.Main.main(Main.java:1148)
Internal Error

I found some info about this error https://bugs.eclipse.org/bugs/show_bug.cgi?id=106396
"Usually, if gtk_init_check() is failing, it means the DISPLAY environment
variable is not pointing at a running X server.  I would first advise you to
make absolutely sure that when you're running the tests on the command
line that the environment variables are being passed down correctly
to the command that actually runs the tests."

Before I run the Java command, it is true that DISPLAY is not set. But as I understand, but I'm not sure, Eclipse takes care, or better should take care of setting a display. For this purpose the -ws gtk switch is passed on the command line.

I suspect that it is failing to start a ws in memory. So maybe gtk is not properly installed or working but I don't know how to test this.

I tried all kinds of things and I'm getting some clues but it didn't fix the problem

For example I run

ssh -X user@myserver

Now I have a display set and when I run the java command more is happening. For instance I see a lot of
(SWT:22063): Gdk-WARNING **: Error converting from UTF-8 to STRING: Conversion from character set 'UTF-8' to 'ISO-8859-1' is not supported

And then the process ends again with a error message
org.eclipse.swt.SWTError: Not implemented [multiple displays]

So this error could imply that now I have a display set and that Eclipse is trying to set another one, and a different one (gtk?).

Any ideas on why this is not working. Any ideas on how I can run Eclipse headless under SLES Linux?

Thanks and Regards,
Onno

Editors IDEsLinux DistributionsLinux OS Dev

Avatar of undefined
Last Comment
ostraaten

8/22/2022 - Mon
ahoffmann

> ..  it is true that DISPLAY
that's the reason for the stack trace, most likely

> .. as I understand, but I'm not sure, Eclipse takes care, or better should take care of setting a display
hmm, how should it do that without programmed woodoo? It only could use the DISPLAY or SSH_* environment variables (if set proper)

> .. Gdk-WARNING **: Error converting from UTF-8 to STRING:
this is most likely a problem with your LANG and/or LC_* environment variables
As I'm not a gtk expert, I assume that you either have set UTF-8 and your application cannot handle it, or the other way arround.

> .. can run Eclipse headless ..
hmm, do you really mean that you want to run eclipse without displaying anything?
If so, is eclipse then the right tool to do that, I doubt.

If you want to run java applications headless, you may use something like:
    -Djava.awt.headless=true

(not sure what the corresponding option for gtk is, sorry)
ASKER
ostraaten

I tried the following but with the same result

user@epf:~> export JAVA_HIGH_ZIPFDS=500
user@epf:~> echo $MOZILLA_FIVE_HOME
/usr/lib/firefox
user@epf:~> java -jar /home/user/epfc_1.5.0.2/plugins/org.eclipse.equinox.launcher_1.0.1.R33x_v20080118.jar -data /home/user/epfc_workspace -nosplash -application org.eclipse.epf.publishing.cmdline.Publish -libraryPath /home/user/magweg/epfprac/org.eclipse.epf/libraries/EPF_Practices/ -publishPath /home/user/magweg/epfprac_publish -config publish.all_epf_practices -os linux -arch x86 -ws gtk
ASKER
ostraaten

What is interesting is that I can run eclipse on the remote server with the display on my laptop.

ssh -X user@epf.eclips.org

And then I only need to find the eclipse executable and execute it. Everything works I can also start the publish command from the IDE. Everything fine. This tells me that bits and pieces are installed and configured and working.

When I ssh -X to the server and execute the command I get a different message.

I get a lot of warnings of type
 (SWT:22063): Gdk-WARNING **: Error converting from UTF-8 to STRING: Conversion from character set 'UTF-8' to 'ISO-8859-1' is not supported

And then a fatal error
org.eclipse.swt.SWTError: Not implemented [multiple displays]
      at org.eclipse.swt.SWT.error(SWT.java:3589)

I read somewhere that the osgi/VM does not support multiple displays. So this restriction could be the reason that it isn't working.

The question than could be why is it trying to run multiple displays?

When I run the command locally (on Ubuntu)  it does work and the same restriction applies of course. So why does it not run multiple display when I run remotely and not when I run locally.

There could be a bug in the publish code that is revealed when used in this particular way. I saw that in the code that a thread is started and that a display is created in this thread.  Maybe this code should check that if a display exists and only create when it doesn't?

I really don't know. I'm going to try this with two Ubuntu machines, maybe then it will work.


All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
ahoffmann

> What is interesting is that I can run eclipse on the remote server with the display on my laptop

and

> When I ssh -X to the server and execute the command I get a different message.

confusing, could you please explain the difference.

---
> ... Not implemented [multiple displays]
does this mean that you have eclipse already running and then start a second one?
ASKER
ostraaten

Sorry this is confusing I agree.

No there are two ways I can use Eclipse on this server remotely. The ordinary way as an IDE (with a GUI) and in headless mode. The latter is used for integrating Eclipse stuff in build processes.

I was able to run Eclipse as an IDE on remotely on this server using ssh -X and then execute the Eclipse exe. This will display the Eclipse IDE on my local machine but of course the thing is running on the server. Pretty neat, how this just works. The GUI is a little bit different than when I run locally but everything is functional. From the IDE I can manually do a publish, also working fine.

When I try to do the publish using the command line (in headless mode) it fails with the message about the mutual displays and I don't understand why.

Hope this clarifies what I'm trying to accomplish.



ahoffmann

when you want to run eclipse headless, I'd login with
   ssh -x ...
(lowercase x) so that no DISPLAY will be set

IIRC, for running eclipse headless you need   -cp org.eclipse.core.launcher.Main
(I'm not an eclipse expert, sorry:)
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
ostraaten

Okay thanks, i will try that. What happends btw with lowercase x? Does this mean that a x process is started but not used? Free for use or something?

Another thought, in the end the idea is that the publish can be started through a web application and/or a cron job. So there won't be a ssh connection. Do I need to start an x process in my script? How?

I am going to try this regardless but maybe you have some additional ideas on how this changes things. Maybe it will just work the way I intended it to work? Stranger things have happened.
ASKER CERTIFIED SOLUTION
ahoffmann

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
ostraaten

Lowercase x fails with the no more handles message. This is caused by the fact that DISPLAY is not set. For some reason on this particular server with ssh -X, it doesn't work. I set up a virtual server using VirtualBox with SLES and it works so something is wrong with this server I think.

Anyway because I need run this from a cron job or web application I decided to use xvfb and that works fine, no error messages.