Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Referenced model in a jar(How do I model references to classes in another model that is not in my workspace)
Referenced model in a jar [message #1829757] Fri, 10 July 2020 09:14 Go to next message
Wernke zur Borg is currently offline Wernke zur BorgFriend
Messages: 40
Registered: December 2011
Member
I need to maintain an RCP application with an Ecore model B that is an extension of an external model A.

Model A does not exist in my workspace but in an external bundle that is in my Plug-In Dependencies. This bundle is currently not built as an Eclipse plug-in, because it is designed to run in a non-Eclipse environment. It has a Manifest and contains the *.ecore files and the genmodel in a model folder but there is no plugin.xml.

So far we have applied a workaround by copying the *.ecore files of model A out of the jar into the model folder of model B. This way we could easily create references from B to A since they were in the same folder. Then we only generate the code for model B, and at runtime the references are properly resolved to the external bundle. So far so good (or bad).

This is not a nice approach, and we are facing the second plug-in that would need to do the same copying.

I have been trying to add a plugin.xml to the external bundle with extensions to "org.eclipse.emf.ecore.generated_package", but still at genmodel load time of model B EMF cannot find the genmodel or the ecore files of model A.

What is the "correct" way of extending an Ecore model that is not in your workspace but only lives in a plug-in dependency jar?

Thank you for any hints.
Wernke

[Updated on: Fri, 10 July 2020 09:40]

Report message to a moderator

Re: Referenced model in a jar [message #1829763 is a reply to message #1829757] Fri, 10 July 2020 09:36 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7096
Registered: July 2009
Senior Member
Hi

Plugins and jars are not exclusive. A plugin is just a jar with some extra files such as .project, plugin.xml and MANIFEST.MF that make sense to Equinox. You can quite happily use them in a standalone environment too, indeed you will find that many EMF plugins are already used in that way (although extending Ecore.ecore is very strongly discouraged.) The extra bloat for the plugin files is pretty trivial. Just make sure you declare the Eclipse core plugin dependencies as optional.

Regards

Ed Willink
Re: Referenced model in a jar [message #1829764 is a reply to message #1829763] Fri, 10 July 2020 09:41 Go to previous messageGo to next message
Wernke zur Borg is currently offline Wernke zur BorgFriend
Messages: 40
Registered: December 2011
Member
Hi Ed, thank you for your answer. Does that mean, if the external bundle were a proper Eclipse plug-in, EMF would find the model and genmodel in the jar for references?
Re: Referenced model in a jar [message #1829765 is a reply to message #1829764] Fri, 10 July 2020 10:09 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31832
Registered: July 2009
Senior Member
Yes, if the thing that contains the model A were a proper normal plugin it would have the generated org.eclipse.emf.ecore.generated_package extension point and this would be used for finding references to that model. The editor calls org.eclipse.emf.ecore.plugin.EcorePlugin.computePlatformURIMap(true) to build URI mappings such that platform:/resource/<plugin-id>/ is redirected to platform:/plugin/<plugin-id>/ if the plug-in doesn't actually exist in the workspace. It builds these mappings from the org.eclipse.emf.ecore.generated_package declarations. It's important that your project-name and your plugin-id ( Bundle-SymbolicName: <plugin-id>;singleton:=true) be identical.

References to models in other projects/plugins will generally use relative references and those should resolve even if the plug-in isn't actually in the workspace...


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Referenced model in a jar [message #1829778 is a reply to message #1829765] Fri, 10 July 2020 12:46 Go to previous messageGo to next message
Wernke zur Borg is currently offline Wernke zur BorgFriend
Messages: 40
Registered: December 2011
Member
Thank you @ the other Ed for your reply as well.

To get started I extracted the external model into a workspace plug-in project and manually changed all references in my Ecore model to platform:/resource URIs. I can then load the genmodel, but EMF converts the references back to relative workspace paths. Of course, when I then close the external model plug-in project, the genmodel can no longer be loaded since the path does not exist.

In the genmodel Reload dialog I can only specify workspace locations for referenced genmodels. How could I ever specify a platform:/plugin reference? Or asked differently, how would a "correct" reference to a platform:/plugin resource look like in the Ecore file, e.g. in a eSuperTypes definition?

My problem is the migration from a relative path to a plugin reference at modelling time (runtime is not the problem).

[Updated on: Fri, 10 July 2020 12:50]

Report message to a moderator

Re: Referenced model in a jar [message #1829787 is a reply to message #1829778] Fri, 10 July 2020 14:53 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31832
Registered: July 2009
Senior Member
The resource using relative paths is fine and expected. You should not use platform:/plugin references because that presumes the plugin actually installed (which I doubt is the case so unlikely to be helpful).

That note that in the Ecore editor, you have several buttons when you do Load Resources... The first one is "Browser Target Platform Packages..." Your model A (its nsURI) must be visible there in that dialog. For it to be visible there, model A must be either in the workspace plugin or in the Plug-in Development Environment's Target Platform. But if you look at that dialog, you'll see all of the EMF-provided models are there...

If you've done nothing to populate the target platform, it will default to being identical to what's installed in the IDE. Likely you're not having success because A is not in your target platform.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Referenced model in a jar [message #1829865 is a reply to message #1829787] Mon, 13 July 2020 08:17 Go to previous messageGo to next message
Wernke zur Borg is currently offline Wernke zur BorgFriend
Messages: 40
Registered: December 2011
Member
Thank you again @Ed, this makes things much clearer for me.

My intention is indeed to load model A from the target platform at modelling time, and it is there. I can find the contained packages with the "Load Resource..." browser in the list displayed with "Browse Target Platform Packages..." but when I select a package, the text field does not display the resource URI. When I enter the resource URI manually (taking the Ecore packages as template) the model does not load. The log shows a "Resource does not exist" exception from EMF. In essence EMF can see the packages in the plug-in but fails to load the model resource.

So there must be something wrong with the plug-in in the target platform. I compared it with the Ecore plug-in org.eclipse.emf.ecore (which loads fine) to see where they differ.

Both have:
- plugin.xml with packages listed in the "org.eclipse.emf.ecore.generated_package" extension
- MANIFEST.MF with the Bundle-Name and Bundle-Symbolic-Name equal to the plug-in name and singleton:=true

Would you have an idea why EMF can see the packages in the plug-in but fails to load the model resources? Or how I could debug this further?

Stack trace:

!ENTRY org.eclipse.emf.edit.ui 2 0 2020-07-13 10:50:28.571
!MESSAGE org.eclipse.core.internal.resources.ResourceException: Resource '/esa.egscc.ldm/model/core.ecore' does not exist.
!STACK 0
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.core.internal.resources.ResourceException: Resource '/esa.egscc.ldm/model/core.ecore' does not exist.
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:319)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:278)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:406)
	at org.eclipse.emf.edit.ui.action.LoadResourceAction$LoadResourceDialog.processResources(LoadResourceAction.java:136)
	at org.eclipse.emf.common.ui.dialogs.ResourceDialog.okPressed(ResourceDialog.java:372)
	at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:468)
	at org.eclipse.jface.dialogs.Dialog.lambda$0(Dialog.java:619)
	at org.eclipse.swt.events.SelectionListener$1.widgetSelected(SelectionListener.java:84)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:252)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4175)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3988)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3587)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:823)
	at org.eclipse.jface.window.Window.open(Window.java:799)
	at org.eclipse.emf.ecore.presentation.EcoreActionBarContributor$ExtendedLoadResourceAction.run(EcoreActionBarContributor.java:135)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:474)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:579)
	at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:413)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4175)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3988)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3587)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1160)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1049)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:660)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:559)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:154)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:150)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:657)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
Caused by: org.eclipse.core.internal.resources.ResourceException: Resource '/esa.egscc.ldm/model/core.ecore' does not exist.
	at org.eclipse.core.internal.resources.Resource.checkExists(Resource.java:330)
	at org.eclipse.core.internal.resources.Resource.checkAccessible(Resource.java:204)
	at org.eclipse.core.internal.resources.File.getContents(File.java:273)
	at org.eclipse.core.internal.resources.File.getContents(File.java:266)
	at org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl$WorkbenchHelper.createPlatformResourceInputStream(PlatformResourceURIHandlerImpl.java:207)
	at org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl.createInputStream(PlatformResourceURIHandlerImpl.java:525)
	at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createInputStream(ExtensibleURIConverterImpl.java:360)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1314)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
	... 44 more
Caused by: java.lang.Exception: Resource '/esa.egscc.ldm/model/core.ecore' does not exist.
	at org.eclipse.core.internal.resources.ResourceException.provideStackTrace(ResourceException.java:42)
	at org.eclipse.core.internal.resources.ResourceException.<init>(ResourceException.java:38)
	... 54 more


index.php/fa/38563/0/
  • Attachment: ecore.png
    (Size: 10.23KB, Downloaded 209 times)

[Updated on: Mon, 13 July 2020 11:03]

Report message to a moderator

Re: Referenced model in a jar [message #1829874 is a reply to message #1829865] Mon, 13 July 2020 10:09 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31832
Registered: July 2009
Senior Member
Looking at your png, it suggests to me that you've made the model folder be also a Java package. Don't do that; putting the model in a "package" results in it being copied to the bin folder and result in it having a different relative at runtime than it does at development time.

I expect it to look like this:

index.php/fa/38564/0/

So the model folder is just a plan folder and the build.properties specifies the model folded is included in the binary plugin. The path of the *.genmodel is relative to the plugin and works that way at development time and at runtime via this same relative path.



Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Referenced model in a jar [message #1829878 is a reply to message #1829874] Mon, 13 July 2020 11:03 Go to previous messageGo to next message
Wernke zur Borg is currently offline Wernke zur BorgFriend
Messages: 40
Registered: December 2011
Member
Not sure why you think the model folder is a package. Perhaps I should have said that the picture is from the Plug-In Dependencies. When I look at the Ecore plug-in in the Plug-In Dependencies the model folder has the same symbol:

index.php/fa/38565/0/

Looking at our plug-in in the workspace gives this picture with a proper folder icon:

index.php/fa/38566/0/
  • Attachment: ecore2.png
    (Size: 17.61KB, Downloaded 206 times)
  • Attachment: ecore3.png
    (Size: 22.37KB, Downloaded 207 times)

[Updated on: Mon, 13 July 2020 11:10]

Report message to a moderator

Re: Referenced model in a jar [message #1829881 is a reply to message #1829878] Mon, 13 July 2020 11:23 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31832
Registered: July 2009
Senior Member
Without the context (root folder is jar rather than project) it wasn't clear what I was looking at. And of course it's hard to figure out things from pictures because I don't know what's in the files. E.g., my picture shows the extension point where the genModel property is declared. But you don't show that so I don't know what's in your plugin.xml. And your model folder isn't expanded in the picture so I don't know exactly what's in the folder either, though I guess it's that same stuff from the other picture. But in that picture I see no *.genmodel so it's hard to imagine how you could have registered the *.genmodel for core.ecore when there doesn't appear to be one. That would also explain why no URI can be determined, because it's computed by loading the *.genmodel and seeing how its containing GenPackage references the *.ecore.



Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Referenced model in a jar [message #1829884 is a reply to message #1829881] Mon, 13 July 2020 11:41 Go to previous messageGo to next message
Wernke zur Borg is currently offline Wernke zur BorgFriend
Messages: 40
Registered: December 2011
Member
Ok, I will try to be more complete. The .genmodel is by the way visible in my first screenshot. Sorry for not showing the root - there are too many packages in the way.

Here is another workspace view:

index.php/fa/38567/0/

And here a plugin dependency view:

index.php/fa/38568/0/

Here is the extension in plugin.xml:
index.php/fa/38569/0/

Thank you for spotting any potential issues and/or asking more questions :)

Remember the error message:
!MESSAGE org.eclipse.core.internal.resources.ResourceException: Resource '/esa.egscc.ldm/model/core.ecore' does not exist.

which indicates the correct reference of the *.ecore file but cannot find it or load it from the jar.

  • Attachment: ecore4.png
    (Size: 58.88KB, Downloaded 197 times)
  • Attachment: ecore5.png
    (Size: 104.83KB, Downloaded 193 times)
  • Attachment: ecore6.png
    (Size: 8.63KB, Downloaded 190 times)

[Updated on: Mon, 13 July 2020 12:12]

Report message to a moderator

Re: Referenced model in a jar [message #1829885 is a reply to message #1829884] Mon, 13 July 2020 12:11 Go to previous messageGo to next message
Wernke zur Borg is currently offline Wernke zur BorgFriend
Messages: 40
Registered: December 2011
Member
- erroneous reply removed -

[Updated on: Mon, 13 July 2020 12:12]

Report message to a moderator

Re: Referenced model in a jar [message #1829886 is a reply to message #1829884] Mon, 13 July 2020 12:28 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31832
Registered: July 2009
Senior Member
That all appears to be in order, so I'm running out of ideas of what's going wrong. Could you show me the contents of the MANIFEST.MF? The fact that no URI is presented suggests that computing the map from Ecore models to their locations did not actually manage to load the *.genmodel...

Can you show me the dialog where you try to load the .../core/1.5 Ecore model from the target platform?


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Referenced model in a jar [message #1829888 is a reply to message #1829886] Mon, 13 July 2020 12:48 Go to previous messageGo to next message
Wernke zur Borg is currently offline Wernke zur BorgFriend
Messages: 40
Registered: December 2011
Member
MANIFEST.MF and screen capture of Load Resource dialog are attached.

index.php/fa/38572/0/

I have to add that the problem is most likely caused by my way of manually modifying the esa.egscc.ldm jar, which was originally produced by a Maven build without the plugin.xml. I manually added the plugin.xml and plugin.properties to the jar. I will now also try to produce the jar properly from within my Eclipse workspace.
  • Attachment: MANIFEST.MF
    (Size: 42.62KB, Downloaded 25 times)
  • Attachment: ecore.gif
    (Size: 2.02MB, Downloaded 165 times)

[Updated on: Mon, 13 July 2020 12:51]

Report message to a moderator

Re: Referenced model in a jar [message #1829893 is a reply to message #1829888] Mon, 13 July 2020 13:40 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31832
Registered: July 2009
Senior Member
So everything looks fine from what you've shown, but the behavior suggests that while org.eclipse.emf.ecore.presentation.EcoreActionBarContributor.ExtendedLoadResourceAction.TargetPlatformPackageDialog.updateElements() found the org.eclipse.emf.ecore.generated_package extension for your nsURI, later on in it was not able to load the *.genmodel resource. Perhaps an exception was thrown and would be visible in the Error Log view?

Perhaps you could try to launch a self hosted workspace with all these plugins and debug what's going wrong, especially in org.eclipse.emf.ecore.plugin.EcorePlugin.PDEHelper.computeModels(Map<URI, URI>, Map<String, URI>) when it processes your extension point.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Referenced model in a jar [message #1829894 is a reply to message #1829893] Mon, 13 July 2020 13:44 Go to previous messageGo to next message
Wernke zur Borg is currently offline Wernke zur BorgFriend
Messages: 40
Registered: December 2011
Member
I will do that.

There is no exception on selecting the package from the package list.

The exception on pressing OK after filling the resource manually was shown in a previous post above, repeated here:

!ENTRY org.eclipse.emf.edit.ui 2 0 2020-07-13 14:42:50.127
!MESSAGE org.eclipse.core.internal.resources.ResourceException: Resource '/esa.egscc.ldm/model/core.ecore' does not exist.
!STACK 0
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.core.internal.resources.ResourceException: Resource '/esa.egscc.ldm/model/core.ecore' does not exist.
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:319)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:278)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:406)
	at org.eclipse.emf.edit.ui.action.LoadResourceAction$LoadResourceDialog.processResources(LoadResourceAction.java:136)
	at org.eclipse.emf.common.ui.dialogs.ResourceDialog.okPressed(ResourceDialog.java:372)
	at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:468)
	at org.eclipse.jface.dialogs.Dialog.lambda$0(Dialog.java:619)
	at org.eclipse.swt.events.SelectionListener$1.widgetSelected(SelectionListener.java:84)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:252)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4175)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3988)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3587)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:823)
	at org.eclipse.jface.window.Window.open(Window.java:799)
	at org.eclipse.emf.ecore.presentation.EcoreActionBarContributor$ExtendedLoadResourceAction.run(EcoreActionBarContributor.java:135)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:474)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:579)
	at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:413)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4175)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3988)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3587)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1160)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1049)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:660)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:559)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:154)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:150)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:657)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
Caused by: org.eclipse.core.internal.resources.ResourceException: Resource '/esa.egscc.ldm/model/core.ecore' does not exist.
	at org.eclipse.core.internal.resources.Resource.checkExists(Resource.java:330)
	at org.eclipse.core.internal.resources.Resource.checkAccessible(Resource.java:204)
	at org.eclipse.core.internal.resources.File.getContents(File.java:273)
	at org.eclipse.core.internal.resources.File.getContents(File.java:266)
	at org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl$WorkbenchHelper.createPlatformResourceInputStream(PlatformResourceURIHandlerImpl.java:207)
	at org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl.createInputStream(PlatformResourceURIHandlerImpl.java:525)
	at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createInputStream(ExtensibleURIConverterImpl.java:360)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1314)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
	... 44 more
Caused by: java.lang.Exception: Resource '/esa.egscc.ldm/model/core.ecore' does not exist.
	at org.eclipse.core.internal.resources.ResourceException.provideStackTrace(ResourceException.java:42)
	at org.eclipse.core.internal.resources.ResourceException.<init>(ResourceException.java:38)
	... 54 more

[Updated on: Mon, 13 July 2020 13:46]

Report message to a moderator

Re: Referenced model in a jar [message #1829898 is a reply to message #1829894] Mon, 13 July 2020 14:24 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31832
Registered: July 2009
Senior Member
Without debugging, I could not do anything further. The following logic is processing the locations associated with the nsURI that was selected:

https://git.eclipse.org/c/emf/org.eclipse.emf.git/tree/plugins/org.eclipse.emf.ecore.editor/src/org/eclipse/emf/ecore/presentation/EcoreActionBarContributor.java#n250

Apparently it does not throw an exception loading a *.genmodel resource, but it also doesn't find a resource with EPackage for that nsURI. So not surprising that your manually entered URI doesn't work either. It should be automatically found and what's found will be correct and will work.

I would really need to see which *.genmodel resource is being loaded and why the referenced Ecore models aren't also loaded when resolving the proxies in that *.genmodel. But I can only do that with a debugger an in environment that reproduces your problem. Or you can try to do that... If you use Debug Configurations... and create a new Eclipse Application launcher, in that workspace you can create a new *.ecore and try to use Load Resource... there.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Referenced model in a jar [message #1829922 is a reply to message #1829898] Tue, 14 July 2020 06:57 Go to previous messageGo to next message
Wernke zur Borg is currently offline Wernke zur BorgFriend
Messages: 40
Registered: December 2011
Member
I am in the middle of debugging, will get back soon.
Re: Referenced model in a jar [SOLVED] [message #1829927 is a reply to message #1829922] Tue, 14 July 2020 09:04 Go to previous messageGo to next message
Wernke zur Borg is currently offline Wernke zur BorgFriend
Messages: 40
Registered: December 2011
Member
So my debugging session was successful, the problem is solved. It was all my fault.

I had made two mistakes:

1. The plugin.xml in my own plug-in contained old generated entries for the generated_package extension point, from the time the external model had been copied into it.

EMF displayed the packages from the wrong plug-in, from which the model could not be loaded. After fixing this, the external packages were no longer listed, so some added consistency at this point.

2. The modified MANIFEST in the external plug-in had the "singleton:=true" in the wrong entry. It has to go after the Bundle-SymbolicName but was after the Bundle-Name. Things will not work when it is missing.

This caused PDE to fail registering the external plug-in as contributing to the generated_package extension point. After fixing this everything is working. Copying the external model is history.

Thank you so much @Ed for your patient support in this forum. You are incredibly helpful, please keep up this good work.

Wernke

[Updated on: Tue, 14 July 2020 09:11]

Report message to a moderator

Re: Referenced model in a jar [SOLVED] [message #1829935 is a reply to message #1829927] Tue, 14 July 2020 12:23 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 31832
Registered: July 2009
Senior Member
Thank you for sharing your findings!

Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[CDO] Store multiple large files concurrently
Next Topic:Please delete this post
Goto Forum:
  


Current Time: Tue Apr 13 21:05:01 GMT 2021

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

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

Back to the top