Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Mwe2 Couldn't resolve reference to JvmType(In the generator project mwe2 file have a register error)
Mwe2 Couldn't resolve reference to JvmType [message #552495] Thu, 12 August 2010 11:42 Go to next message
hachreak  is currently offline hachreak Friend
Messages: 11
Registered: December 2009
Junior Member
Hi at all,
I have create a new DSL with Xtext v1.0 and Helios.
The name of project is org.hachreak.qob.dag and the generator project is org.hachreak.qob.dag.generator.

The DagGenerator.mwe2 return a error:

11   [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher  - [XtextLinkingDiagnostic: null:19 Couldn't resolve reference to JvmType 'org.hachreak.qob.dag.DagStandaloneSetup'.]
java.lang.IllegalStateException: [XtextLinkingDiagnostic: null:19 Couldn't resolve reference to JvmType 'org.hachreak.qob.dag.DagStandaloneSetup'.]
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:66)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:74)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:35)


Why can find my org.hachreak.qob.dag.DagStandaloneSetup class?

thanks for yours response.
.hachreak.
Re: Mwe2 Couldn't resolve reference to JvmType [message #552497 is a reply to message #552495] Thu, 12 August 2010 11:45 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

welcome to Xtext.

the GenerateDag.mwe2 in your language plugin (right next to the *.xtext file) should initially create the standalonesetup.


Regards
Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Mwe2 Couldn't resolve reference to JvmType [message #552512 is a reply to message #552495] Thu, 12 August 2010 12:37 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Hachreak,

Please try to edit the mwe2 file in the generator project. The editor
will ask you for the Xtext nature which you should add to the project.
Afterwards, you'll see errors in the editor which should disappear after
you've successfully created your language.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 12.08.10 13:42, schrieb hachreak:
> Hi at all,
> I have create a new DSL with Xtext v1.0 and Helios.
> The name of project is org.hachreak.qob.dag and the generator project is
> org.hachreak.qob.dag.generator.
>
> The DagGenerator.mwe2 return a error:
>
> 11 [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher -
> [XtextLinkingDiagnostic: null:19 Couldn't resolve reference to JvmType
> 'org.hachreak.qob.dag.DagStandaloneSetup'.]
> java.lang.IllegalStateException: [XtextLinkingDiagnostic: null:19
> Couldn't resolve reference to JvmType
> 'org.hachreak.qob.dag.DagStandaloneSetup'.]
> at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runne r.java:66)
> at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runne r.java:52)
> at
> org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Lau ncher.java:74)
> at
> org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2La uncher.java:35)
>
>
> Why can find my org.hachreak.qob.dag.DagStandaloneSetup class?
>
> thanks for yours response.
> .hachreak.
Re: Mwe2 Couldn't resolve reference to JvmType [message #552847 is a reply to message #552512] Fri, 13 August 2010 18:39 Go to previous messageGo to next message
hachreak  is currently offline hachreak Friend
Messages: 11
Registered: December 2009
Junior Member
I have resolved the problem! Very Happy

But, now I have another problem:

1    [main] DEBUG        org.eclipse.xtext.mwe.Reader  - Resource Pathes : [src/model]
35   [main] INFO         org.eclipse.xpand2.Generator  - No meta models configured, using JavaBeans as default.
592  [main] DEBUG xt.validation.ResourceValidatorImpl  - Syntax check OK! Resource: file:/mnt/cdrom/hachreak/workspace-xtext/org.hachreak.qob.dag.generator/src/model/Example.dag
1470 [main] ERROR        org.eclipse.xpand2.Generator  - Error in Component  of type org.eclipse.xpand2.Generator: 
	EvaluationException : No Definition 'templates::TemplateJQuery::main for org::hachreak::dag::dag::impl::ApiImpl' found!
	[23,50] on line 1 'EXPAND templates::TemplateJQuery::main FOREACH api'


This is my Dag.xtext:

// DSL Api Generator

grammar org.hachreak.dag.Dag with org.eclipse.xtext.common.Terminals

generate dag "http://www.hachreak.org/dag/Dag"

Model:
	types+=Type*
	api+=Api*;

Api:
	'api' name=ID ':'
		blackbox+=BlackBox*
	';'	
;

BlackBox:
	('blackbox'|'bb') name=ID '{'
		methods+=Method*
	'}'
;

Method:
	Input | Output;
	
Input:
	'input' type=[Type] name=ID;
	
Output:
	'output' type=[Type] name=ID;
	
Type:
	'type' name=ID 'mapped-to' javaType=FQN;
	
FQN:
	ID ('.' ID)*;

terminal ML_COMMENT : '/*' -> '*/';


My TemplateJQuery.xpt:

«IMPORT dag»

«EXTENSION templates::Extensions»

«DEFINE main FOR Api»
«FILE name+".js"»
var «name» = Class.create({
	«EXPAND property FOREACH blackbox»
)};
«ENDFILE»
«ENDDEFINE»

«DEFINE property FOR BlackBox»
    «name»: function(){},
«ENDDEFINE»


And DagGenerator.mw2:

module workflow.DagGenerator

import org.eclipse.emf.mwe.utils.*

var targetDir = "src-gen"
var fileEncoding = "ANSI_X3.4-1968"
var modelPath = "src/model"

Workflow {

	component = org.eclipse.xtext.mwe.Reader {
		// lookup all resources on the classpath
		// useJavaClassPath = true

		// or define search scope explicitly
		path = modelPath

		// this class will be generated by the xtext generator 
		register = org.hachreak.dag.DagStandaloneSetup {}
		load = {
			slot = "api"
			type = "Api"
		}
	}

	component = org.eclipse.xpand2.Generator {
		expand = "templates::TemplateJQuery::main FOREACH api"
		outlet = {
			path = targetDir
		}
		fileEncoding = fileEncoding
	}
}
Re: Mwe2 Couldn't resolve reference to JvmType [message #552854 is a reply to message #552847] Fri, 13 August 2010 19:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

this error might be caused by wrong imports. In your template you just do import dag - which indicates to use the (dynamic emf metamodel). but the generator by default uses the JavaBeansMetamodel and thus the Java Classes of your EMF Metamodel. So the import should be something like org::hachreak::dag::dag.

To get feedback in UI and not only when running the workflow you should align workflow and ui and therefore go to your projects Xpand/Xtend Properties and activate the JavaBeansMetamodel and deactivate the (dynamic) emf one.

Now you should get Errors in the Xpand-Editor saying that the import may be wrong.

Regards
Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Mwe2 Couldn't resolve reference to JvmType [message #552856 is a reply to message #552847] Fri, 13 August 2010 19:04 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Hachreak,

the generator uses the JavaBeansMetaModel while your template uses the
default config which relies on the EmfMetamodel. Please go to the
project properties of your generator project and set the
JavaBeansMetamodel in the Xpand category. Afterwards you'll get an error
marker in your template.
You have to fix the import statement to point to
'org::hachreak::dag::dag' instead of 'dag'.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com


Am 13.08.10 20:39, schrieb hachreak:
> I have resolved the problem! :d
>
> But, now I have another problem:
>
>
> 1 [main] DEBUG org.eclipse.xtext.mwe.Reader - Resource Pathes : [src/model]
> 35 [main] INFO org.eclipse.xpand2.Generator - No meta models configured,
> using JavaBeans as default.
> 592 [main] DEBUG xt.validation.ResourceValidatorImpl - Syntax check OK!
> Resource:
> file:/mnt/cdrom/hachreak/workspace-xtext/org.hachreak.qob.da g.generator/src/model/Example.dag
>
> 1470 [main] ERROR org.eclipse.xpand2.Generator - Error in Component of
> type org.eclipse.xpand2.Generator: EvaluationException : No Definition
> 'templates::TemplateJQuery::main for
> org::hachreak::dag::dag::impl::ApiImpl' found!
> [23,50] on line 1 'EXPAND templates::TemplateJQuery::main FOREACH api'
>
>
> This is my Dag.xtext:
>
>
> // DSL Api Generator
>
> grammar org.hachreak.dag.Dag with org.eclipse.xtext.common.Terminals
>
> generate dag "http://www.hachreak.org/dag/Dag"
>
> Model:
> types+=Type*
> api+=Api*;
>
> Api:
> 'api' name=ID ':'
> blackbox+=BlackBox*
> ';'
> ;
>
> BlackBox:
> ('blackbox'|'bb') name=ID '{'
> methods+=Method*
> '}'
> ;
>
> Method:
> Input | Output;
>
> Input:
> 'input' type=[Type] name=ID;
>
> Output:
> 'output' type=[Type] name=ID;
>
> Type:
> 'type' name=ID 'mapped-to' javaType=FQN;
>
> FQN:
> ID ('.' ID)*;
>
> terminal ML_COMMENT : '/*' -> '*/';
>
>
> My TemplateJQuery.xpt:
>
>
> «IMPORT dag»
>
> «EXTENSION templates::Extensions»
>
> «DEFINE main FOR Api»
> «FILE name+".js"»
> var «name» = Class.create({
> «EXPAND property FOREACH blackbox»
> )};
> «ENDFILE»
> «ENDDEFINE»
>
> «DEFINE property FOR BlackBox»
> «name»: function(){},
> «ENDDEFINE»
>
>
> And DagGenerator.mw2:
>
>
> module workflow.DagGenerator
>
> import org.eclipse.emf.mwe.utils.*
>
> var targetDir = "src-gen"
> var fileEncoding = "ANSI_X3.4-1968"
> var modelPath = "src/model"
>
> Workflow {
>
> component = org.eclipse.xtext.mwe.Reader {
> // lookup all resources on the classpath
> // useJavaClassPath = true
>
> // or define search scope explicitly
> path = modelPath
>
> // this class will be generated by the xtext generator register =
> org.hachreak.dag.DagStandaloneSetup {}
> load = {
> slot = "api"
> type = "Api"
> }
> }
>
> component = org.eclipse.xpand2.Generator {
> expand = "templates::TemplateJQuery::main FOREACH api"
> outlet = {
> path = targetDir
> }
> fileEncoding = fileEncoding
> }
> }
>
[RESOLVED] Re: Mwe2 Couldn't resolve reference to JvmType [message #552865 is a reply to message #552856] Fri, 13 August 2010 21:33 Go to previous message
hachreak  is currently offline hachreak Friend
Messages: 11
Registered: December 2009
Junior Member
Thanks a lot! Very Happy
Now it's ok!!!

bye bye .hachreak.
Previous Topic:Customize content proposal
Next Topic:Creating compile errors(Must be doing it wrong).
Goto Forum:
  


Current Time: Thu Apr 25 10:33:42 GMT 2024

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

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

Back to the top