Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create a resource for ... a registered resource factory is needed (Chapter 5) #4

Open
autohandle opened this issue Apr 17, 2015 · 2 comments

Comments

@autohandle
Copy link

Software-Engineerings-MacBook-Pro:tmp david$ ls -al ~/Documents/eclipsecon/eclipsecon2015/XText_Tutorial/ImplementingDSL/workspaces/Chapter2/org.example.entities/src/org/example/entities/Entities.xtext
-rw-r--r-- 1 david staff 503 Apr 17 13:48 /Users/david/Documents/eclipsecon/eclipsecon2015/XText_Tutorial/ImplementingDSL/workspaces/Chapter2/org.example.entities/src/org/example/entities/Entities.xtext
Software-Engineerings-MacBook-Pro:tmp david$ cat ~/Documents/eclipsecon/eclipsecon2015/XText_Tutorial/ImplementingDSL/workspaces/Chapter2/org.example.entities/src/org/example/entities/Entities.xtext
grammar org.example.entities.Entities with org.eclipse.xtext.common.Terminals

generate entities "http://www.example.org/entities/Entities"

Model:
entities+=Entity*;

Entity:
'entity' name=ID ('extends' supertype=[Entity])? '{'
attributes+=Attribute*
'}';

Attribute:
type=AttributeType name=ID ';';

AttributeType:
elementType=ElementType (array ?='[' (length=INT)? ']')?;

ElementType:
BasicType | EntityType;

BasicType:
typeName=('string'|'int'|'boolean');

EntityType:
entity=[Entity];Software-Engineeringsjava -jar entities-compiler.jar ~/Documents/eclipsecon/eclipsecon2015/XText_Tutorial/ImplementingDSL/workspaces/Chapter2/org.example.entities/src/org/example/entities/Entities.xtext
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.RuntimeException: Cannot create a resource for '/Users/david/Documents/eclipsecon/eclipsecon2015/XText_Tutorial/ImplementingDSL/workspaces/Chapter2/org.example.entities/src/org/example/entities/Entities.xtext'; a registered resource factory is needed
at org.eclipse.xtext.resource.XtextResourceSet.getResource(XtextResourceSet.java:258)
at org.eclipse.xtext.resource.SynchronizedXtextResourceSet.getResource(SynchronizedXtextResourceSet.java:24)
at org.example.entities.generator.Main.runGenerator(Main.java:49)
at org.example.entities.generator.Main.main(Main.java:31)
... 5 more
Software-Engineerings-MacBook-Pro:tmp david$

@LorenzoBettini
Copy link
Owner

Sorry, I need some more information: you're trying to call the command line compiler and it gives you this error? How did you export the jar for the command line compiler?

@autohandle
Copy link
Author

yes, i am trying to use the command line. unless i too eager and made a mistake, i exported it just like it said in the book to /tmp:
Software-Engineerings-MacBook-Pro:tmp david$ ls -l entities-compiler.jar
-rw-r--r-- 1 david wheel 26965265 Apr 17 15:29 entities-compiler.jar
at 26M, it is about the right size according to the book.

thanks for taking time to help me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants