Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext error when used as a tool plugin(An xt.linking.lazy.LazyLinkingResource error occurs when running an Xtext project as a plugin. In its standalone version it works correctly.)
Xtext error when used as a tool plugin [message #1853904] Thu, 21 July 2022 21:11 Go to next message
Julia Robles is currently offline Julia RoblesFriend
Messages: 4
Registered: April 2021
Junior Member

I'm trying to integrate a standalone project I made with Xtext and EMF as a plugin. The project (github) converts models in XMI to the textual modelling language USE and vice versa. The goal is to integrate this conversion as a plugin (github of plugins) of the USE tool (github). Regarding the import from XMI to USE there is no problem, as it does not use Xtext. The problem lies in the export. When exporting it, the following error appears:

USE version 6.0.0, Copyright (C) 1999-2021 University of Bremen
use> Filename: C:\Users\julia\Documents\use-6.0.0\examples\Others\CarRental\CarRental2.use
File: C:\Users\julia\Downloads
The USE file "CarRental2.use" will be converted to UML...
0    [AWT-EventQueue-0] ERROR xt.linking.lazy.LazyLinkingResource  - resolution of uriFragment '|26' failed.
java.lang.StringIndexOutOfBoundsException: String index out of range: 3219
        at java.lang.String.substring(
        at org.eclipse.xtext.nodemodel.impl.AbstractNode.getText(
        at org.eclipse.xtext.nodemodel.util.NodeModelUtils.getTokenText(
        at org.eclipse.xtext.linking.impl.LinkingHelper.getCrossRefNodeAsString(
        at org.eclipse.xtext.linking.impl.DefaultLinkingService.getCrossRefNodeAsString(
        at org.eclipse.xtext.linking.impl.DefaultLinkingService.getLinkedObjects(
        at org.eclipse.xtext.linking.lazy.LazyLinkingResource.getEObject(
        at org.eclipse.xtext.linking.lazy.LazyLinkingResource.getEObject(
        at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getEObject(
        at org.eclipse.emf.ecore.util.EcoreUtil.resolve(
        at org.eclipse.emf.ecore.util.EcoreUtil.resolve(
        at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eResolveProxy(
        at modelConverter.use_language.use.impl.ContextsTypeImpl.getClassname(
        at modelConverter.use_language.generator.USEGenerator.lambda$2(
        at org.eclipse.xtext.xbase.lib.internal.BooleanFunctionDelegate.apply(
        at modelConverter.use_language.generator.USEGenerator.compileClass(
        at modelConverter.use_language.generator.USEGenerator.compileType(
        at modelConverter.use_language.generator.USEGenerator.compileModel(
        at modelConverter.use_language.generator.USEGenerator.doGenerate(
        at org.eclipse.xtext.generator.GeneratorDelegate.doGenerate(
        at org.eclipse.xtext.generator.GeneratorDelegate.generate(
        at main.model.usetouml.General.generateUML(Unknown Source)
        at main.model.Generators.fromUSEtoUML(Unknown Source)
        at main.plugin.XMIHandlerPlugin.exportToXMI(Unknown Source)
        at main.plugin.gui.XMIHandlerView.initGUI(Unknown Source)
        at main.plugin.gui.XMIHandlerView.<init>(Unknown Source)
        at main.plugin.gui.ActionExportXMI.performAction(Unknown Source)
        at org.tzi.use.runtime.gui.impl.PluginAction.actionPerformed(Unknown Source)
        at javax.swing.AbstractButton.fireActionPerformed(
        at javax.swing.AbstractButton$Handler.actionPerformed(
        at javax.swing.DefaultButtonModel.fireActionPerformed(
        at javax.swing.DefaultButtonModel.setPressed(
        at javax.swing.AbstractButton.doClick(
        at javax.swing.plaf.basic.BasicMenuItemUI.doClick(
        at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(
        at java.awt.Component.processMouseEvent(
        at javax.swing.JComponent.processMouseEvent(
        at java.awt.Component.processEvent(
        at java.awt.Container.processEvent(
        at java.awt.Component.dispatchEventImpl(
        at java.awt.Container.dispatchEventImpl(
        at java.awt.Component.dispatchEvent(
        at java.awt.LightweightDispatcher.retargetMouseEvent(
        at java.awt.LightweightDispatcher.processMouseEvent(
        at java.awt.LightweightDispatcher.dispatchEvent(
        at java.awt.Container.dispatchEventImpl(
        at java.awt.Window.dispatchEventImpl(
        at java.awt.Component.dispatchEvent(
        at java.awt.EventQueue.dispatchEventImpl(
        at java.awt.EventQueue.access$500(
        at java.awt.EventQueue$
        at java.awt.EventQueue$
        at Method)
        at java.awt.EventQueue$
        at java.awt.EventQueue$
        at Method)
        at java.awt.EventQueue.dispatchEvent(
        at java.awt.EventDispatchThread.pumpOneEventForFilters(
        at java.awt.EventDispatchThread.pumpEventsForFilter(
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(
        at java.awt.EventDispatchThread.pumpEvents(
        at java.awt.EventDispatchThread.pumpEvents(

This error does NOT appear when converting the same USE file to XMI with the standalone tool, it only appears when using the plugin. The conversion is performed correctly in the standalone version.

I think it might be some kind of incompatibility of Xtext with the USE tool. I was told that USE worked better with Java 8 so I have modified everything to make the plugin work correctly in that version. However, the error persists. I saw a similar error in this forum question but I don't think it has much to do with it or I don't understand the solution.

I'm really stuck with this error and I can't figure out what it is. I hope someone can help me with this.

You can see the actual code at github. In the dist folder you have the last compilation I made of the plugin (it is added to the USE plugins folder).

Thank you in advance!
Re: Xtext error when used as a tool plugin [message #1853906 is a reply to message #1853904] Fri, 22 July 2022 04:34 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14695
Registered: July 2009
Senior Member
the code mentions USEStandaloneSetup;
as the name says it is not meant to be used inside eclipse.
in eclipse you are not allowed to use it.

here is the options you have to obtain an injector in eclipse

besides the executableextensionfactory way something like


might work.

Twitter : @chrdietrich
Blog :

[Updated on: Fri, 22 July 2022 04:37]

Report message to a moderator

Re: Xtext error when used as a tool plugin [message #1853909 is a reply to message #1853906] Fri, 22 July 2022 06:54 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7665
Registered: July 2009
Senior Member

I put


in my StandaloneSetup.doSetup to ensure that the use-in-IDE howler is avoided. (Bug 340408 might have made this problem go away, but it was WONTFIXed.)

If fixing the StandaloneSetup call doesn't help, the String index out of range: 3219 suggests that you two alternative text versions to substring and the wrong one is in use. This can occur when a concurrent Xtext activity happens, possibly via a builder. This can often be solved by correct use of the IUnitOfWork API which must be used to inhibit concurrency. If totally confused, a few 'printf's with associated System.identityHashCode calls may help you understand your two alternatives.


Ed Willink
Previous Topic:How to get parent scope for nested block?
Next Topic:Supporting method overloading
Goto Forum:

Current Time: Thu Jul 18 13:30:48 GMT 2024

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

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

Back to the top