Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Re: [xtext] "EPackage is used twice" or How to import several packages of the same ecore m
Re: [xtext] "EPackage is used twice" or How to import several packages of the same ecore m [message #537034] Tue, 01 June 2010 02:24 Go to next message
Eclipse UserFriend
(replying to eclipse.modeling.tmf, which is where Xtext is discussed)

Frank Kuehnlenz schrieb:
> Hi,
>
> My existing ecore model has several packages:
> - root_package
> -- package_A
> -- package_B
> -- package_C
>
> and within package A classes from package B and C are referenced.
>
> Now I used the project creation wizard "Xtext Project From Existing
> Ecore Models" with the root_package as default package.

If you can split them up, i.e. one file per EPackage, I strongly suggest
to do so. Nested packages tend to complicate things.

>
> The generated xtext file contains now three imports:
>
> import "platform:/resource/testProject/test.ecore" as package_A
> import "platform:/resource/testProject/test.ecore" as package_B
> import "platform:/resource/testProject/test.ecore" as package_C

That's a bug in the wizard (please file a bug report).
You need to add the fragment part to the URIs. They should looke like
this:

platform:/resource/testProject/test.ecore#//package_A

Sven

--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: [xtext] "EPackage is used twice" or How to import several packages of the same ecore m [message #537152 is a reply to message #537034] Tue, 01 June 2010 09:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kuehnlenz.informatik.hu-berlin.de

> (replying to eclipse.modeling.tmf, which is where Xtext is discussed)
Sure. Sorry.

>> My existing ecore model has several packages:
>> - root_package
>> -- package_A
>> -- package_B
>> -- package_C
>>
>> and within package A classes from package B and C are referenced.
>>
>> Now I used the project creation wizard "Xtext Project From Existing
>> Ecore Models" with the root_package as default package.
>
> If you can split them up, i.e. one file per EPackage, I strongly suggest
> to do so. Nested packages tend to complicate things.
Thank you for this hint. I will have a look and try it. Maybe this is
related to my current problem (see below).

>
>>
>> The generated xtext file contains now three imports:
>>
>> import "platform:/resource/testProject/test.ecore" as package_A
>> import "platform:/resource/testProject/test.ecore" as package_B
>> import "platform:/resource/testProject/test.ecore" as package_C
>
> That's a bug in the wizard (please file a bug report).
OK, reported as Bug 315193.


> You need to add the fragment part to the URIs. They should looke like
> this:
>
> platform:/resource/testProject/test.ecore#//package_A
Thanks, that works. The xtext file is now free of error markers.

But I have now a problem on executing the MWE workflow:

15 [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher - Problems
instantiating module expl.TextEditor:
java.lang.reflect.InvocationTargetException
java.lang.RuntimeException: Problems instantiating module
expl.TextEditor: java.lang.reflect.InvocationTargetException
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runne r.java:73)
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)
Caused by: org.eclipse.emf.common.util.WrappedException:
java.lang.reflect.InvocationTargetException
at
org.eclipse.emf.mwe2.language.factory.SettingProviderImpl$1$ 1.setValue(SettingProviderImpl.java:56)
at
org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.in ternalApplyAssignments(Mwe2ExecutionEngine.java:127)
at
org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.in Case(Mwe2ExecutionEngine.java:102)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.eclipse.xtext.util.PolymorphicDispatcher.invoke(Polymorp hicDispatcher.java:259)
at
org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.in ternalSwitch(Mwe2ExecutionEngine.java:56)
at
org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.in ternalApplyAssignments(Mwe2ExecutionEngine.java:126)
at
org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.in Case(Mwe2ExecutionEngine.java:102)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.eclipse.xtext.util.PolymorphicDispatcher.invoke(Polymorp hicDispatcher.java:259)
at
org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.in ternalSwitch(Mwe2ExecutionEngine.java:56)
at
org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.in Case(Mwe2ExecutionEngine.java:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.eclipse.xtext.util.PolymorphicDispatcher.invoke(Polymorp hicDispatcher.java:259)
at
org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.in ternalSwitch(Mwe2ExecutionEngine.java:56)
at
org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.cr eate(Mwe2ExecutionEngine.java:52)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runne r.java:71)
... 3 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.eclipse.emf.mwe2.language.factory.SettingProviderImpl$1$ 1.setValue(SettingProviderImpl.java:54)
... 28 more
Caused by: org.eclipse.emf.mwe.core.ConfigurationException: Couldn't
find an interface ExperimentationLanguage.ExperimentationLanguagePackage
at
org.eclipse.emf.mwe.utils.StandaloneSetup.addRegisterGenerat edEPackage(StandaloneSetup.java:160)
... 33 more

All the best,
Frank
Re: [xtext] "EPackage is used twice" or How to import several packages of the same ecore m [message #537159 is a reply to message #537152] Tue, 01 June 2010 09:58 Go to previous messageGo to next message
Eclipse UserFriend
Frank Kuehnlenz schrieb:
> Caused by: org.eclipse.emf.mwe.core.ConfigurationException: Couldn't
> find an interface ExperimentationLanguage.ExperimentationLanguagePackage
> at
> org.eclipse.emf.mwe.utils.StandaloneSetup.addRegisterGenerat edEPackage(StandaloneSetup.java:160)
> ... 33 more

The cause of the extension states that it can't find the interface you
configured for
StanaloneSetup {
registerGeneratedEPackage =
"ExperimentalLanguage.ExperimentalLanguagePackage"
}

Does that interface exist?

Sven


--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: [xtext] "EPackage is used twice" or How to import several packages of the same ecore m [message #537191 is a reply to message #537159] Tue, 01 June 2010 10:52 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kuehnlenz.informatik.hu-berlin.de

Hi Sven,

>> Caused by: org.eclipse.emf.mwe.core.ConfigurationException: Couldn't
>> find an interface ExperimentationLanguage.ExperimentationLanguagePackage
>> at
>> org.eclipse.emf.mwe.utils.StandaloneSetup.addRegisterGenerat edEPackage(StandaloneSetup.java:160)
>>
>> ... 33 more
>
> The cause of the extension states that it can't find the interface you
> configured for
> StanaloneSetup {
> registerGeneratedEPackage =
> "ExperimentalLanguage.ExperimentalLanguagePackage"
> }
>
> Does that interface exist?

well, at the moment I don't really see, how things are related.
What is the schema for the value of registerGeneratedEPackage?
Is it the Namespace prefix extended by the name and "Package"?

In my simple example 'ExperimentationLanguage' would be the root_package.

Assuming the schema above and this relation, than the part of the
configuration for the MWE workflow for my example classes would look
like this:

Workflow {
bean = StandaloneSetup {
platformUri = "${runtimeProject}/.."
registerGeneratedEPackage = "root_package.Root_packagePackage"
registerGeneratedEPackage = "root_package.package_A.Package_APackage"
registerGeneratedEPackage = "root_package.package_B.Package_BPackage"
registerGeneratedEPackage = "root_package.package_C.Package_CPackage"
}


I just removed the line 'registerGeneratedEPackage =
"root_package.Root_packagePackage"' from this configuration and now the
workflow can be executed and it generates the editor.

But using the editor causes now the following error:

An internal error occurred during: "XtextReconcilerJob".
java.lang.IllegalStateException: Unresolved proxy
http:///root_package.package_A.ecore#//package_A/SomeClassIn A Make sure
the EPackage has been registered.

All the best,
Frank
Re: [xtext] "EPackage is used twice" or How to import several packages of the same ecore m [message #537224 is a reply to message #537191] Tue, 01 June 2010 11:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kuehnlenz.informatik.hu-berlin.de

Addition and correction:
> But using the editor causes now the following error:
>
> An internal error occurred during: "XtextReconcilerJob".
> java.lang.IllegalStateException: Unresolved proxy
> http:///root_package/package_B.ecore#//package_A/SomeClassIn A Make sure
> the EPackage has been registered.

Having a closer look: There is something more strange, because the URI
contains different package names.
There is a use-relation between the classes in the packages: package_A
uses package_B.

Caused by: java.lang.IllegalStateException: Unresolved proxy
http:///root_package/package_B.ecore#//package_A/SomeClassIn A Make sure
the EPackage has been registered.
at
org.eclipse.xtext.parser.DefaultEcoreElementFactory.create(D efaultEcoreElementFactory.java:55)
at
expl.parser.antlr.internal.InternalTextEditorParser.ruleAntS criptTask(InternalTextEditorParser.java:152)
at
expl.parser.antlr.internal.InternalTextEditorParser.entryRul eAntScriptTask(InternalTextEditorParser.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.eclipse.xtext.parser.antlr.AbstractInternalAntlrParser.p arse(AbstractInternalAntlrParser.java:492)
... 15 more
Re: [xtext] "EPackage is used twice" or How to import several packages of the same ecore m [message #537341 is a reply to message #537191] Wed, 02 June 2010 02:15 Go to previous messageGo to next message
Eclipse UserFriend
Frank Kuehnlenz schrieb:
> Hi Sven,
>
>>> Caused by: org.eclipse.emf.mwe.core.ConfigurationException: Couldn't
>>> find an interface ExperimentationLanguage.ExperimentationLanguagePackage
>>> at
>>> org.eclipse.emf.mwe.utils.StandaloneSetup.addRegisterGenerat edEPackage(StandaloneSetup.java:160)
>>>
>>> ... 33 more
>> The cause of the extension states that it can't find the interface you
>> configured for
>> StanaloneSetup {
>> registerGeneratedEPackage =
>> "ExperimentalLanguage.ExperimentalLanguagePackage"
>> }
>>
>> Does that interface exist?
>
> well, at the moment I don't really see, how things are related.
> What is the schema for the value of registerGeneratedEPackage?
> Is it the Namespace prefix extended by the name and "Package"?
>

It should be the qualified name of the generated Java interface for your
EPackage.

Sven


--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: [xtext] "EPackage is used twice" or How to import several packages of the same ecore m [message #537342 is a reply to message #537224] Wed, 02 June 2010 02:16 Go to previous messageGo to next message
Eclipse UserFriend
Frank Kuehnlenz schrieb:
> Addition and correction:
>> But using the editor causes now the following error:
>>
>> An internal error occurred during: "XtextReconcilerJob".
>> java.lang.IllegalStateException: Unresolved proxy
>> http:///root_package/package_B.ecore#//package_A/SomeClassIn A Make sure
>> the EPackage has been registered.
>
> Having a closer look: There is something more strange, because the URI
> contains different package names.
> There is a use-relation between the classes in the packages: package_A
> uses package_B.
>
> Caused by: java.lang.IllegalStateException: Unresolved proxy
> http:///root_package/package_B.ecore#//package_A/SomeClassIn A Make sure
> the EPackage has been registered.

The cross references between the Ecore packages shouldn't be done using
nsURIs but platform:/resource uris. How did you create the ecore model?

Sven

--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: [xtext] "EPackage is used twice" or How to import several packages of the same ecore m [message #537439 is a reply to message #537342] Wed, 02 June 2010 09:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kuehnlenz.informatik.hu-berlin.de

Am 02.06.2010 08:16, schrieb Sven Efftinge:
> Frank Kuehnlenz schrieb:
>> Addition and correction:
>>> But using the editor causes now the following error:
>>>
>>> An internal error occurred during: "XtextReconcilerJob".
>>> java.lang.IllegalStateException: Unresolved proxy
>>> http:///root_package/package_B.ecore#//package_A/SomeClassIn A Make sure
>>> the EPackage has been registered.
>>
>> Having a closer look: There is something more strange, because the URI
>> contains different package names.
>> There is a use-relation between the classes in the packages: package_A
>> uses package_B.
>>
>> Caused by: java.lang.IllegalStateException: Unresolved proxy
>> http:///root_package/package_B.ecore#//package_A/SomeClassIn A Make sure
>> the EPackage has been registered.
>
> The cross references between the Ecore packages shouldn't be done using
> nsURIs but platform:/resource uris. How did you create the ecore model?
I create my ecore-model out of an UML source (exported by MagicDraw) by
using the UML2 Extender SDK that integrates into the EMF Project
creation wizard.
(The ecore model is also used for CDO and has maybe some additional
properties)

Cheers,
Frank
Re: [xtext] "EPackage is used twice" or How to import several packages of the same ecore m [message #537592 is a reply to message #537439] Thu, 03 June 2010 00:30 Go to previous messageGo to next message
Eclipse UserFriend
It is very untypical to use nsURIs to reference other EPackages.
You might be able to colve this by registering all (sub)packages using
the StandaloneSetup class.

Sven

Frank Kuehnlenz schrieb:
> Am 02.06.2010 08:16, schrieb Sven Efftinge:
>> Frank Kuehnlenz schrieb:
>>> Addition and correction:
>>>> But using the editor causes now the following error:
>>>>
>>>> An internal error occurred during: "XtextReconcilerJob".
>>>> java.lang.IllegalStateException: Unresolved proxy
>>>> http:///root_package/package_B.ecore#//package_A/SomeClassIn A Make sure
>>>> the EPackage has been registered.
>>> Having a closer look: There is something more strange, because the URI
>>> contains different package names.
>>> There is a use-relation between the classes in the packages: package_A
>>> uses package_B.
>>>
>>> Caused by: java.lang.IllegalStateException: Unresolved proxy
>>> http:///root_package/package_B.ecore#//package_A/SomeClassIn A Make sure
>>> the EPackage has been registered.
>> The cross references between the Ecore packages shouldn't be done using
>> nsURIs but platform:/resource uris. How did you create the ecore model?
> I create my ecore-model out of an UML source (exported by MagicDraw) by
> using the UML2 Extender SDK that integrates into the EMF Project
> creation wizard.
> (The ecore model is also used for CDO and has maybe some additional
> properties)
>
> Cheers,
> Frank


--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: [xtext] "EPackage is used twice" or How to import several packages of the same ecore m [message #538358 is a reply to message #537592] Mon, 07 June 2010 09:02 Go to previous message
Eclipse UserFriend
Originally posted by: kuehnlenz.informatik.hu-berlin.de

Am 03.06.2010 06:30, schrieb Sven Efftinge:
> It is very untypical to use nsURIs to reference other EPackages.
> You might be able to colve this by registering all (sub)packages using
> the StandaloneSetup class.
It's just generated stuff out of the MagicDraw export.

I tried to register the EPackage classes manually using this way (maybe
wrong) without a positive effect:

public class TextEditorStandaloneSetup extends
TextEditorStandaloneSetupGenerated{

public static void doSetup() {
new TextEditorStandaloneSetup().createInjectorAndDoEMFRegistrati on();

EPackage.Registry.INSTANCE.put("http:///root_package/package_A.ecore#//package_A/",
root_package.package_A.Package_APackage.eINSTANCE);

EPackage.Registry.INSTANCE.put("http:///root_package/package_B.ecore#//package_B/",
root_package.package_B.Package_BPackage.eINSTANCE);

EPackage.Registry.INSTANCE.put("http:///root_package/package_C.ecore#//package_C/",
root_package.package_C.Package_CPackage.eINSTANCE);

}


However, if I do not use any subpackages in my ecore-model and therefore
have a flat hierarchy, than it's working fine.

All the best,
Frank

> Frank Kuehnlenz schrieb:
>> Am 02.06.2010 08:16, schrieb Sven Efftinge:
>>> Frank Kuehnlenz schrieb:
>>>> Addition and correction:
>>>>> But using the editor causes now the following error:
>>>>>
>>>>> An internal error occurred during: "XtextReconcilerJob".
>>>>> java.lang.IllegalStateException: Unresolved proxy
>>>>> http:///root_package/package_B.ecore#//package_A/SomeClassIn A Make
>>>>> sure
>>>>> the EPackage has been registered.
>>>> Having a closer look: There is something more strange, because the URI
>>>> contains different package names.
>>>> There is a use-relation between the classes in the packages: package_A
>>>> uses package_B.
>>>>
>>>> Caused by: java.lang.IllegalStateException: Unresolved proxy
>>>> http:///root_package/package_B.ecore#//package_A/SomeClassIn A Make
>>>> sure
>>>> the EPackage has been registered.
>>> The cross references between the Ecore packages shouldn't be done using
>>> nsURIs but platform:/resource uris. How did you create the ecore model?
>> I create my ecore-model out of an UML source (exported by MagicDraw) by
>> using the UML2 Extender SDK that integrates into the EMF Project
>> creation wizard.
>> (The ecore model is also used for CDO and has maybe some additional
>> properties)
>>
>> Cheers,
>> Frank
>
>
Previous Topic:left recursion
Next Topic:Deactivate backslash as escape character?
Goto Forum:
  


Current Time: Fri Sep 26 00:12:17 EDT 2025

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

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

Back to the top