Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » No more handles [gtk_init_check() failed]
No more handles [gtk_init_check() failed] [message #190335] Fri, 30 May 2008 16:01 Go to next message
Jimmy Royer is currently offline Jimmy RoyerFriend
Messages: 16
Registered: July 2009
Junior Member
Hi all,

We are trying to get our Eclipse plugin built in a headless fashion, i.e.
from the command-line without the usage of the Eclipse GUI. So far, we`ve
been able to build most of it using PDE build (the Eclipse tooling for
building plugins).

We're using GMF in our project and we do use its code generation feature.
The GMF codegen part depends upon the SWT class (it looks like in the
code, GMF codegen depends on it because it simply tries to get the name of
the SWT class), which requires the SWT OSGi bundle to load. This means
that the whole SWT libraries are trying to initialize for what is just a
code generation process.

On windows it works fine. On linux, it fails with the following output:

[modex.GMFGenerator] org.osgi.framework.BundleException: Exception in
org.eclipse.jdt.internal.ui.JavaPlugin.start() o\
f bundle org.eclipse.jdt.ui.
[modex.GMFGenerator] at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl\
java:1018)
[modex.GMFGenerator] at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:974\
)
[modex.GMFGenerator] at
org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
[modex.GMFGenerator] at
org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:260)
[modex.GMFGenerator] at
org.eclipse.osgi.framework.util.SecureAction$21.run(SecureAc tion.java:406)
[modex.GMFGenerator] at
java.security.AccessController.doPrivileged(Native Method)
[modex.GMFGenerator] at
org.eclipse.osgi.framework.util.SecureAction.start(SecureAct ion.java:404)
[modex.GMFGenerator] at
org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter .postFindLocalClass(EclipseLazy\
Starter.java:111)
...
...
[modex.GMFGenerator] Caused by: org.eclipse.swt.SWTError: No more handles
[gtk_init_check() failed]
[modex.GMFGenerator] at org.eclipse.swt.SWT.error(SWT.java:3589)
[modex.GMFGenerator] at
org.eclipse.swt.widgets.Display.createDisplay(Display.java:8 36)
[modex.GMFGenerator] at
org.eclipse.swt.widgets.Display.create(Display.java:824)
[modex.GMFGenerator] at
org.eclipse.swt.graphics.Device.<init>(Device.java:152)
[modex.GMFGenerator] at
org.eclipse.swt.widgets.Display.<init>(Display.java:472)
[modex.GMFGenerator] at
org.eclipse.swt.widgets.Display.<init>(Display.java:463)
[modex.GMFGenerator] at
org.eclipse.swt.widgets.Display.getDefault(Display.java:1604 )
[modex.GMFGenerator] at
org.eclipse.jface.preference.PreferenceConverter.<clinit>(PreferenceConverter.java:80)
[modex.GMFGenerator] at
org.eclipse.jdt.ui.PreferenceConstants.setDefaultAndFireEven t(PreferenceConstants.java:4016\
)
...
...


I found some work around for this specific problem here:
http://www.eclipse.org/tptp/home/downloads/releasenotes/rele asenotes4_3_0.html#4_CTI_4

After reading this release note, I've tried to start a X server before
launching the build:

#!/bin/ksh

# Start the X server on display 33
Xvfb :33 -ac -screen 0 1024x768x8 &
export DISPLAY=:33

# Start a ant task testing the GMF code generation running in an Eclipse
instance java -jar
/pathToEclipseLibs/org.eclipse.equinox.launcher_1.0.1.R33x_v 20070828.jar
-ws gtk -application org.eclipse.ant.core.antRunner -buildfile test.xml
-verbose -debug -consoleLog -clean -data /pathToWorkspace


Starting a X server didn't help though. And now I am stucked here. Do you
see anything wrong or missing from what I described? Did anyone went
through the same issues?

An alternate solution for us would be to pre-generate the GMF generated
code, submit it in our VCS and use it during our build but that is
suboptimal.

Thanks,
Jimmy
Re: No more handles [gtk_init_check() failed] [message #190518 is a reply to message #190335] Mon, 02 June 2008 12:19 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Jimmy,

Currently GMF Generator class resides in org.eclipse.gmf.codegen plugin without
any dependencies to *UI eclipse plugins, so SWT should not be required to
execute code generation. Can you please point me to exact place in the code
of GMf code generator where SWT is loaded?

-----------------
Alex Shatalin
Re: No more handles [gtk_init_check() failed] [message #190543 is a reply to message #190518] Mon, 02 June 2008 14:48 Go to previous messageGo to next message
Jimmy Royer is currently offline Jimmy RoyerFriend
Messages: 16
Registered: July 2009
Junior Member
Hi Alex,

I'll give you the stack trace showing where the SWT class is loaded during
the GMF code generation. I'll also put the complete GMF plugins/feature I
have installed locally for my Eclipse 3.3, just in case. Tell me if you
need any more information or if I am simply doing something wrong here.

Thanks!
Jimmy

---
Thread [main] (Suspended (breakpoint at line 140 in
PackageReferencesCollector))
PackageReferencesCollector.initializeDefaultHardcodedTypes(C ollection <String>)
line: 140
PackageReferencesCollector.getHardcodedTypes() line: 134
PackageReferencesCollector.hackRecognizeTypesAndPackagesForT heirLettersCase(QualifiedName)
line: 105
PackageReferencesCollector.typeRefFound(Name) line: 83
PackageReferencesCollector.visit(SimpleType) line: 161
SimpleType.accept0(ASTVisitor) line: 134
SimpleType(ASTNode).accept(ASTVisitor) line: 2476
TypeDeclaration(ASTNode).acceptChild(ASTVisitor, ASTNode) line: 2523
TypeDeclaration.accept0(ASTVisitor) line: 481
TypeDeclaration(ASTNode).accept(ASTVisitor) line: 2476
CompilationUnit(ASTNode).acceptChildren(ASTVisitor, ASTNode$NodeList)
line: 2546
CompilationUnit.accept0(ASTVisitor) line: 213
CompilationUnit(ASTNode).accept(ASTVisitor) line: 2476
PackageReferencesCollector.collect(ASTNode, Collection<Name>,
Collection<SimpleName>, Collection<String>) line: 36
OrganizeImportsPostprocessor.organizeImports(CompilationUnit , String[],
IProgressMonitor) line: 170
OrganizeImportsPostprocessor.organizeImports(ICompilationUni t, String[],
IProgressMonitor) line: 105
Generator(GeneratorBase).doGenerateJavaClass(TextEmitter, String, String,
Object...) line: 364
Generator.generateExternalizationSupport() line: 891
Generator.customRun() line: 93
GeneratorBase$1.run(IProgressMonitor) line: 466
Workspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor)
line: 1797
Workspace.run(IWorkspaceRunnable, IProgressMonitor) line: 1779
Generator(GeneratorBase).doRun() line: 463
Generator(GeneratorBase).run() line: 96
TestGmfGenerator.testCodeGeneration() line: 34
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 585
TestGmfGenerator(TestCase).runTest() line: 164
TestGmfGenerator(TestCase).runBare() line: 130
TestResult$1.protect() line: 106
TestResult.runProtected(Test, Protectable) line: 124
TestResult.run(TestCase) line: 109
TestGmfGenerator(TestCase).run(TestResult) line: 120
TestSuite.runTest(Test, TestResult) line: 230
TestSuite.run(TestResult) line: 225
JUnit3TestReference.run(TestExecution) line: 130
TestExecution.run(ITestReference[]) line: 38
RemotePluginTestRunner(RemoteTestRunner).runTests(String[], String,
TestExecution) line: 460
RemotePluginTestRunner(RemoteTestRunner).runTests(TestExecut ion) line:
673
RemotePluginTestRunner(RemoteTestRunner).run() line: 386
RemotePluginTestRunner.main(String[]) line: 58
CoreTestApplication.run(Object) line: 24
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 585
EclipseAppContainer.callMethod(Object, String, Class[], Object[]) line:
572
EclipseAppHandle.run(Object) line: 171
EclipseAppLauncher.runApplication(Object) line: 106
EclipseAppLauncher.start(Object) line: 76
EclipseStarter.run(Object) line: 363
EclipseStarter.run(String[], Runnable) line: 176
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 585
Main.invokeFramework(String[], URL[]) line: 508
Main.basicRun(String[]) line: 447
Main.run(String[]) line: 1173
Main.main(String[]) line: 1148

---
GMF installed features:
org.eclipse.gmf.europa_2.0.1.v20070809-0000-7X77__EIn-hz0YSf Ry8HJNAMTFfk
org.eclipse.gmf.runtime.thirdparty_1.0.0.v20070809-0000-7G8D -ED-z0UWCVxojl60L
org.eclipse.gmf_1.0.100.v20070921-0000-7d-ETjEYjiMWQYLSEejlR jypkm71

GMF installed plugins:
org.eclipse.gmf.bridge.ui.dashboard_2.0.0.v20070809-0000.jar
org.eclipse.gmf.bridge.ui_1.1.0.v20070809-0000.jar
org.eclipse.gmf.bridge_1.1.0.v20070809-0000.jar
org.eclipse.gmf.codegen.edit_2.0.1.v20070921-0000.jar
org.eclipse.gmf.codegen.ui_1.1.0.v20070809-0000.jar
org.eclipse.gmf.codegen_2.0.1.v20070928-0000.jar
org.eclipse.gmf.common_1.1.0.v20070809-0000.jar
org.eclipse.gmf.doc.ui_1.1.0.v20070809-0000.jar
org.eclipse.gmf.doc_1.0.0.v20070809-0000.jar
org.eclipse.gmf.ecore.editor_2.0.0.v20070928-0000.jar
org.eclipse.gmf.graphdef.codegen.ui_1.0.100.v20070809-0000.j ar
org.eclipse.gmf.graphdef.codegen_2.0.0.v20070809-0000.jar
org.eclipse.gmf.graphdef.edit_2.0.0.v20070809-0000.jar
org.eclipse.gmf.graphdef_2.0.0.v20070809-0000.jar
org.eclipse.gmf.map.edit_2.0.0.v20070809-0000.jar
org.eclipse.gmf.map_2.0.0.v20070809-0000.jar
org.eclipse.gmf.runtime.common.core_1.0.100.v20070809-0000.j ar
org.eclipse.gmf.runtime.common.ui.action.ide_1.0.1.v20070809 -0000.jar
org.eclipse.gmf.runtime.common.ui.action_1.0.100.v20070809-0 000.jar
org.eclipse.gmf.runtime.common.ui.printing.win32_1.0.2.v2007 0809-0000.jar
org.eclipse.gmf.runtime.common.ui.printing_1.0.1.v20070809-0 000.jar
org.eclipse.gmf.runtime.common.ui.services.action_1.0.100.v2 0070809-0000.jar
org.eclipse.gmf.runtime.common.ui.services.dnd.ide_1.0.1.v20 070809-0000.jar
org.eclipse.gmf.runtime.common.ui.services.dnd_1.0.1.v200708 09-0000.jar
org.eclipse.gmf.runtime.common.ui.services.properties_1.0.1. v20070809-0000.jar
org.eclipse.gmf.runtime.common.ui.services_1.0.100.v20070809 -0000.jar
org.eclipse.gmf.runtime.common.ui_1.0.101.v20070921-0000.jar
org.eclipse.gmf.runtime.diagram.core_1.0.101.v20070915-0000. jar
org.eclipse.gmf.runtime.diagram.ui.actions_1.0.100.v20070809 -0000.jar
org.eclipse.gmf.runtime.diagram.ui.dnd_1.0.1.v20070809-0000. jar
org.eclipse.gmf.runtime.diagram.ui.geoshapes_1.0.1.v20070809 -0000.jar
org.eclipse.gmf.runtime.diagram.ui.printing.render_1.0.1.v20 070809-0000.jar
org.eclipse.gmf.runtime.diagram.ui.printing_1.0.100.v2007080 9-0000.jar
org.eclipse.gmf.runtime.diagram.ui.properties_1.0.101.v20070 915-0000.jar
org.eclipse.gmf.runtime.diagram.ui.providers.ide_1.0.1.v2007 0809-0000.jar
org.eclipse.gmf.runtime.diagram.ui.providers_1.0.100.v200708 09-0000.jar
org.eclipse.gmf.runtime.diagram.ui.render_1.0.100.v20070809- 0000.jar
org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide_1.0. 3.v20070809-0000.jar
org.eclipse.gmf.runtime.diagram.ui.resources.editor_1.0.3.v2 0070809-0000.jar
org.eclipse.gmf.runtime.diagram.ui_1.0.101.v20070915-0000.ja r
org.eclipse.gmf.runtime.draw2d.ui.render.awt_1.0.100.v200709 28-0000.jar
org.eclipse.gmf.runtime.draw2d.ui.render_1.0.100.v20070809-0 000.jar
org.eclipse.gmf.runtime.draw2d.ui_1.0.101.v20070928-0000.jar
org.eclipse.gmf.runtime.emf.clipboard.core_1.0.100.v20070809 -0000.jar
org.eclipse.gmf.runtime.emf.commands.core_1.0.3.v20070809-00 00.jar
org.eclipse.gmf.runtime.emf.core_1.0.100.v20070809-0000.jar
org.eclipse.gmf.runtime.emf.type.core_1.0.100.v20070809-0000 .jar
org.eclipse.gmf.runtime.emf.type.ui_1.0.1.v20070809-0000.jar
org.eclipse.gmf.runtime.emf.ui.properties_1.0.2.v20070809-00 00.jar
org.eclipse.gmf.runtime.emf.ui_1.0.100.v20070809-0000.jar
org.eclipse.gmf.runtime.gef.ui_1.0.1.v20070809-0000.jar
org.eclipse.gmf.runtime.notation.edit_1.0.1.v20070809-0000.j ar
org.eclipse.gmf.runtime.notation.providers_1.0.1.v20070809-0 000.jar
org.eclipse.gmf.runtime.notation_1.0.100.v20070809-0000.jar
org.eclipse.gmf.sdk_1.0.0.v20070809-0000.jar
org.eclipse.gmf.tooldef.edit_2.0.0.v20070809-0000.jar
org.eclipse.gmf.tooldef_2.0.0.v20070809-0000.jar
org.eclipse.gmf.validate_1.1.0.v20070809-0000.jar
org.eclipse.gmf.xpand_1.0.1.v20070921-0000.jar
org.eclipse.gmf_1.0.0.v20070809-0000.jar
Re: No more handles [gtk_init_check() failed] [message #190551 is a reply to message #190543] Mon, 02 June 2008 15:47 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Jimmy,

Ok. Looks like org.eclipse.gmf.common using UI intensively...
So, unfortunately for now you have to generate code manually and put it to
the VCS (or add UI plugins to allow code geneation to access them).

-----------------
Alex Shatalin
Re: No more handles [gtk_init_check() failed] [message #190596 is a reply to message #190551] Mon, 02 June 2008 17:59 Go to previous messageGo to next message
Jimmy Royer is currently offline Jimmy RoyerFriend
Messages: 16
Registered: July 2009
Junior Member
Alex Shatalin wrote:

> Hello Jimmy,

Hi Alex,

Will an issue be opened addressing this usage of UI components during code
generation? Should I open one?

I'll probably add the generated code to our VCS as I haven't found any
solution to the SWT 'handle' problem, which is specific to linux in my
case. I thought that maybe some folks around here also had this problem in
the past.

Regards,
Jimmy
Re: No more handles [gtk_init_check() failed] [message #190620 is a reply to message #190596] Tue, 03 June 2008 08:33 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Jimmy,

> code generation? Should I open one?
Yes, please.

-----------------
Alex Shatalin
Previous Topic:Set Location of a Node
Next Topic:Pasting something from clipboard to diagram
Goto Forum:
  


Current Time: Fri Apr 26 22:51:09 GMT 2024

Powered by FUDForum. Page generated in 0.03696 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top