Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Import MyDslStandaloneSetup does not resolve
Import MyDslStandaloneSetup does not resolve [message #1836683] Tue, 12 January 2021 07:00 Go to next message
Andrej Liebert is currently offline Andrej LiebertFriend
Messages: 18
Registered: January 2021
Junior Member
hello together,

I want to load a model by using the EMF API. For that I have found a code that is mentioned in https://wiki.eclipse.org./Xtext/FAQ..

To do so I have to import the org.xtext.example.mydsl.MyDslStandaloneSetup library https://eclipseice.ornl.gov/downloads/eavp/javadoc/org/xtext/example/mydsl/package-summary.html.

the MANIFEST dependency does not resolve and I can not find the .jar file.

I incorrectly created a thread here that describes a bit more.https://www.eclipse.org/forums/index.php/m/1836676/#msg_1836676

[Updated on: Tue, 12 January 2021 07:47]

Report message to a moderator

Re: Import MyDslStandaloneSetup does not resolve [message #1836684 is a reply to message #1836683] Tue, 12 January 2021 07:31 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13994
Registered: July 2009
Senior Member
can you please describe what you are actually doing.

which project did you create with which project and dsl name.
did you run the workflow.

if the DSL comes from a third party: where and how did you resolve it.

where do you put your code to?


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Import MyDslStandaloneSetup does not resolve [message #1836686 is a reply to message #1836684] Tue, 12 January 2021 07:57 Go to previous messageGo to next message
Andrej Liebert is currently offline Andrej LiebertFriend
Messages: 18
Registered: January 2021
Junior Member
I have put a reference to my previous thread into the topic.

I have created a .tdlan2 and a .tplan2 file, which represents a model in Xtext format. Those files describe a Test Purpose and Test Description in TDL (Test Description Language).
My problem is, I do not know if it is a a third party package that has to be used or if I have to create my own MyDslStandaloneSetup project.

I did not know about a workflow. And I can't answer the last question.

Re: Import MyDslStandaloneSetup does not resolve [message #1836689 is a reply to message #1836686] Tue, 12 January 2021 08:45 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13994
Registered: July 2009
Senior Member
can you please share a screenshot of your project setup and where you do what?

i assume that e.g. in your case name will be SomethingElseStandaloneSetup
e.g TestDescriptionLanguageStandaloneSetup


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Tue, 12 January 2021 08:47]

Report message to a moderator

Re: Import MyDslStandaloneSetup does not resolve [message #1836691 is a reply to message #1836689] Tue, 12 January 2021 09:01 Go to previous messageGo to next message
Andrej Liebert is currently offline Andrej LiebertFriend
Messages: 18
Registered: January 2021
Junior Member
I have not done a StandaloneSetup, i thought it would be an importable package.

https://ibb.co/r6hzCJx
Re: Import MyDslStandaloneSetup does not resolve [message #1836694 is a reply to message #1836691] Tue, 12 January 2021 09:12 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13994
Registered: July 2009
Senior Member
the screenshot does not show the project setup where you call the standalonesetup
nor where the dsl is defined


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Import MyDslStandaloneSetup does not resolve [message #1836695 is a reply to message #1836694] Tue, 12 January 2021 09:36 Go to previous messageGo to next message
Andrej Liebert is currently offline Andrej LiebertFriend
Messages: 18
Registered: January 2021
Junior Member
I have not defined a dsl, neither do I understand what you mean with a project setup. the screen-shot also shows my MANIFEST.

https://ibb.co/1qxZMtR

please excuse me, I have not done anything with Xtext or an IDE so far.

The first picture I have showed you is a model representation of a test description. This is the file I want to load with the following code.

package loadpackage;

import java.io.ByteArrayInputStream;
import java.io.InvalidObjectException;
import java.util.HashMap;

import org.eclipse.emf.mwe.utils.*;
import org.eclipse.emf.common.util.*;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.resource.XtextResourceSet;

import org.xtext.example.mydsl.MyDslStandaloneSetup;

import com.google.inject.Injector;

public class alone {
	public static void main (String [] args) {
		new StandaloneSetup().setPlatformUri("../");
		Injector injector = new MyDslStandaloneSetup().createInjectorAndDoEMFRegistration();
		XtextResourceSet resourceSet = injector.getInstance(XtextResourceSet.class);
		resourceSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
		Resource resource = resourceSet.getResource(    
				URI.createURI("platform:/resource/org.xtext.example.mydsl/src/example.mydsl"), true);
		Model model = (Model) resource.getContents().get(0);
	}
}


Re: Import MyDslStandaloneSetup does not resolve [message #1836696 is a reply to message #1836695] Tue, 12 January 2021 09:40 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13994
Registered: July 2009
Senior Member
in your project in the manifest you should add a dependency
to the plugin that defines the dsl you use and then also use the standalone setup class of that dsl
as said before: i have serious doubts that the dsls name is mydsl


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Import MyDslStandaloneSetup does not resolve [message #1836697 is a reply to message #1836696] Tue, 12 January 2021 09:44 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13994
Registered: July 2009
Senior Member
you may open the console view, there hit the window with the plus button
and then open a new host osgi console
therein you can type
ss dsl
or ss ide
to do some guessing how the dsl plugin is called


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Import MyDslStandaloneSetup does not resolve [message #1837010 is a reply to message #1836697] Wed, 20 January 2021 23:45 Go to previous messageGo to next message
Andrej Liebert is currently offline Andrej LiebertFriend
Messages: 18
Registered: January 2021
Junior Member
Sorry for the long time without response.
In the meantime I did a bit of research and got more into EMF and Xtext.
You are right, the dsl name is TDLan2 (TDLan2StandaloneSetup).

so far I came up with a bit of code.

MANIFEST.MF:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Load
Bundle-SymbolicName: org.etsi.example.load
Bundle-Version: 1.0.0.qualifier
Automatic-Module-Name: org.etsi.example.load
Require-Bundle: org.eclipse.emf.ecore,
 org.etsi.mts.tdl.model,
 org.etsi.mts.tdl.TPLan2,
 org.etsi.mts.tdl.TDLan2,
 org.eclipse.emf.mwe.utils,
 org.eclipse.ocl.xtext.essentialocl
Bundle-RequiredExecutionEnvironment: JavaSE-11


I use a basic Test Descrition in TDLan2 format that can be opened with the Sample Ecore Model Editor, resulting in a tree-like structure with
the following URI: "platform:/resource/org.etsi.example.load/model/example.tdlan2". The code describes the interaction between a client and server (just for illustration purpose).
Package Example {

	
    Type STRING;

    
    Gate Type HTTP accepts STRING;

    
    Component Type EndPoint having {
        gate http of type HTTP;
    }

    
    Test Configuration BasicClientServer {
        create SUT server of type EndPoint;
        create Tester client of type EndPoint;
        connect server.http to client.http; 
    }     

    
    Test Description TD1 uses configuration BasicClientServer {
        client.http sends "GET /store" to server.http;
        server.http sends "200 OK" to client.http;  
    }

    Test Description TD2 uses configuration BasicClientServer {
        client.http sends "GET /users" to server.http;
        server.http sends "200 OK" to client.http;  
    }
}


Java Code:
package org.etsi.example.load.run;

import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;

import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.resource.XtextResourceSet;

import org.etsi.mts.tdl.TDLan2StandaloneSetup;

import com.google.inject.Injector;

public class exe {
		public static void main(String [] args) {
			
		//from the Xtext Wiki FAQ 
		new org.eclipse.emf.mwe.utils.StandaloneSetup().setPlatformUri("../");
		//adapted for the specific Xtext-based language implementation
		Injector injector = new TDLan2StandaloneSetup().createInjectorAndDoEMFRegistration();
		XtextResourceSet resourceSet = injector.getInstance(XtextResourceSet.class);
		resourceSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
		//adapted for the filename declared above (relative to working directory)
		Resource resource = resourceSet.getResource(URI.createURI("platform:/resource/org.etsi.example.load/model/example.tdlan2"), true);


Console:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
	at org.eclipse.emf.mwe.utils.StandaloneSetup.<init>(StandaloneSetup.java:107)
	at org.etsi.example.load.run.exe.main(exe.java:25)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	... 2 more


(StandaloneSetup.java:107)
at org.etsi.example.load.run.exe.main(exe.java:25) references
new org.eclipse.emf.mwe.utils.StandaloneSetup().setPlatformUri("../");
.
Here I do not know, if the workspace root is correctly set with this argument. As written in https://wiki.eclipse.org/Xtext/FAQ it should be.

[Updated on: Wed, 20 January 2021 23:52]

Report message to a moderator

Re: Import MyDslStandaloneSetup does not resolve [message #1837011 is a reply to message #1837010] Wed, 20 January 2021 23:47 Go to previous messageGo to next message
Andrej Liebert is currently offline Andrej LiebertFriend
Messages: 18
Registered: January 2021
Junior Member
to answer your suggestion with the console:

osgi> ss dsl
"Framework is launched."


id	State       Bundle
osgi> ss ide
"Framework is launched."


id	State       Bundle
101	RESOLVED    org.eclipse.e4.ui.ide_3.15.100.v20200323-2111
116	ACTIVE      org.eclipse.ecf.provider.filetransfer.httpclient45.win32_1.0.300.v20200816-1842
117	RESOLVED    org.eclipse.ecf.provider.filetransfer.ssl_1.0.200.v20200611-1836
	            Master=1499
708	STARTING    org.eclipse.acceleo.common.ide_3.7.10.202002210922
711	ACTIVE      org.eclipse.acceleo.ide.ui_3.7.10.202002210922
725	STARTING    org.eclipse.eef.ide.ui_2.1.5.202008270808
726	STARTING    org.eclipse.eef.ide.ui.ext.widgets.reference_2.1.5.202008270808
727	RESOLVED    org.eclipse.eef.ide.ui.properties_2.1.5.202008270808
747	STARTING    org.eclipse.emf.validation.ui.ide_1.3.0.202008210805
755	ACTIVE      org.eclipse.gmf.runtime.common.ui.action.ide_1.7.0.202004160913
761	STARTING    org.eclipse.gmf.runtime.common.ui.services.dnd.ide_1.7.0.202004160913
771	ACTIVE      org.eclipse.gmf.runtime.diagram.ui.providers_1.7.0.202004160913
772	ACTIVE      org.eclipse.gmf.runtime.diagram.ui.providers.ide_1.7.0.202004160913
775	STARTING    org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide_1.7.0.202004160913
789	STARTING    org.eclipse.gmf.runtime.notation.providers_1.7.1.202004160913
893	ACTIVE      org.eclipse.emf.compare.ide_3.4.3.202008311302
894	ACTIVE      org.eclipse.emf.compare.ide.ui_4.4.3.202008311302
1044	ACTIVE      org.etsi.mts.tdl.TDLan2.ide_1.0.0.202010091933
1047	ACTIVE      org.etsi.mts.tdl.TPLan2.ide_1.0.0.202010091933
1217	RESOLVED    org.eclipse.mylyn.bugzilla.ide_3.25.2.v20200828-1617
1219	STARTING    org.eclipse.mylyn.commons.identity.core_1.17.2.v20200813-0821
1231	STARTING    org.eclipse.mylyn.ide.ui_3.25.2.v20200828-1617
1498	ACTIVE      org.eclipse.ecf.identity_3.9.401.v20201027-0550
1499	ACTIVE      org.eclipse.ecf.provider.filetransfer_3.2.601.v20201025-0700
	            Fragments=117
1500	ACTIVE      org.eclipse.ecf.provider.filetransfer.httpclient45_1.0.301.v20201025-0700
1665	ACTIVE      org.eclipse.tips.ide_0.2.0.v20201120-1551
1675	ACTIVE      org.eclipse.ui.ide_3.18.0.v20201119-1132
	            Fragments=368
1676	ACTIVE      org.eclipse.ui.ide.application_1.3.900.v20201102-2031
1738	STARTING    org.eclipse.emf.mwe2.language.ide_2.12.1.20201222-0648
1763	ACTIVE      org.eclipse.xtend.ide_2.25.0.v20201221-0706
1764	ACTIVE      org.eclipse.xtend.ide.common_2.25.0.v20201221-0706
1782	ACTIVE      org.eclipse.xtext.ide_2.25.0.v20201218-1628
1788	STARTING    org.eclipse.xtext.purexbase.ide_2.25.0.v20201218-1629
1795	RESOLVED    org.eclipse.xtext.ui.codetemplates.ide_2.25.0.v20201221-0616
1802	ACTIVE      org.eclipse.xtext.xbase.ide_2.25.0.v20201218-1629
1809	ACTIVE      org.eclipse.xtext.xtext.ide_2.25.0.v20201218-1628
1845	STARTING    org.eclipse.sirius.common.acceleo.aql.ide_6.4.1.202012210909
1847	ACTIVE      org.eclipse.sirius.common.acceleo.mtl.ide_6.4.1.202012210909
1880	ACTIVE      org.eclipse.sirius.ext.ide_6.4.1.202012210909
Re: Import MyDslStandaloneSetup does not resolve [message #1837017 is a reply to message #1837011] Thu, 21 January 2021 05:15 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13994
Registered: July 2009
Senior Member
so org.etsi.mts.tdl.TDLan2 the dsl you wanna .
the exception

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.eclipse.emf.mwe.utils.StandaloneSetup.<init>(StandaloneSetup.java:107)
at org.etsi.example.load.run.exe.main(exe.java:25)

is quite clear:
add commons logging to the deps

and no you dont need

new org.eclipse.emf.mwe.utils.StandaloneSetup().setPlatformUri("../");

if you dont want to use fake platform:/resource/ Uris


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Thu, 21 January 2021 05:18]

Report message to a moderator

Re: Import MyDslStandaloneSetup does not resolve [message #1837022 is a reply to message #1837017] Thu, 21 January 2021 07:55 Go to previous messageGo to next message
Andrej Liebert is currently offline Andrej LiebertFriend
Messages: 18
Registered: January 2021
Junior Member
I added the deps and it worked. to make it runnable I added the following lines:
		
//+1 added package initialisation as indicated in the wiki for predefined models
tdlPackage.eINSTANCE.eClass();
			
//+2 added OCL initialisation as it is used in the TDL implementation
EssentialOCLStandaloneSetup.doSetup();


The package is must be initialised and needs to addressed at the start.
Furthermore, I ran into OCL problems that caused " resolution of uriFragment '|0' failed." - errors


Finally I want to access the (TDL)-packages and other elements in the TDL model by trying to store the first package of the list into a TDL Object.
	//adapted to root / top-level element type - Package (TDL Package, not Java Package!) 
Package p = (Package) resource.getContents().get(0);
System.out.println("Package: "+p.getName()); //a first sign of life!


Exception in thread "main" java.lang.ClassCastException: class org.etsi.mts.tdl.impl.PackageImpl cannot be cast to class java.lang.Package (org.etsi.mts.tdl.impl.PackageImpl is in unnamed module of loader 'app'; java.lang.Package is in module java.base of loader 'bootstrap')
	at org.etsi.example.load.run.exe.main(exe.java:36)




[Updated on: Thu, 21 January 2021 07:56]

Report message to a moderator

Re: Import MyDslStandaloneSetup does not resolve [message #1837027 is a reply to message #1837022] Thu, 21 January 2021 08:39 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13994
Registered: July 2009
Senior Member
org.etsi.mts.tdl.Package p = (org.etsi.mts.tdl.Package) resource.getContents().get(0);
???????


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Import MyDslStandaloneSetup does not resolve [message #1837028 is a reply to message #1837027] Thu, 21 January 2021 08:42 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13994
Registered: July 2009
Senior Member
and you need to add all models to the resourceset if there are more than one.
therefor you should also omit the resourceSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);

i also dont know what and if your dsl has a libary and what not.



Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Import MyDslStandaloneSetup does not resolve [message #1837029 is a reply to message #1837028] Thu, 21 January 2021 08:43 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13994
Registered: July 2009
Senior Member
i also wonder if the provider of your dsl does not ship any standalone tooling

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Import MyDslStandaloneSetup does not resolve [message #1837031 is a reply to message #1837028] Thu, 21 January 2021 08:52 Go to previous messageGo to next message
Andrej Liebert is currently offline Andrej LiebertFriend
Messages: 18
Registered: January 2021
Junior Member
Ah ok, it worked correctly. The thing that confused me here was that the editor has not underlined the Package p = (Package) resource.getContents().get(0); because of the conflict with Java.

just found this manual with MOF-models
https://www.etsi.org/deliver/etsi_es/203100_203199/20311901/01.04.01_60/es_20311901v010401p.pdf

[Updated on: Thu, 21 January 2021 08:55]

Report message to a moderator

Re: Import MyDslStandaloneSetup does not resolve [message #1837071 is a reply to message #1837031] Thu, 21 January 2021 15:12 Go to previous message
Andrej Liebert is currently offline Andrej LiebertFriend
Messages: 18
Registered: January 2021
Junior Member
Alright, I can navigate through the abstract syntax by using the model and its getter and setter methods.

Christian, thank you so much for your help and your patience!
Previous Topic:Java LSP client for Xtext Language Server?
Next Topic: DeclarativeScopeProvider as delegate
Goto Forum:
  


Current Time: Mon Jun 21 13:19:53 GMT 2021

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

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

Back to the top