Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Import from XMI throws DanglingReferenceException
[CDO] Import from XMI throws DanglingReferenceException [message #1462715] Wed, 05 November 2014 21:57 Go to next message
Richard Meyer is currently offline Richard MeyerFriend
Messages: 40
Registered: June 2012
Member
Hy,

I try to import model elements from XMI in my CDO model but getting the following exception:
Caused by: org.eclipse.emf.cdo.util.DanglingReferenceException: The object "MyClass?(my.class.MyClassImpl)" is not contained in a resource

First I export parts of my model to XMI.
This parts contains references to objects in the CDO model.
The XMI File contains hrefs like this:
 <ClassA >
            <MyClass href="cdo://1ef75ed3-3465-4939-9bd9-32bceb126e7c/myResource#L5"/>
  </ClassA>

Now I want to import this XMI file to the same CDO model where it original comes from.
The target of the reference does definitely still exists.
ResourceSet resSet = new ResourceSetImpl();
Map<String, Object> m = resSet.getResourceFactoryRegistry () .getExtensionToFactoryMap () ;
m.put("*", new XMIResourceFactoryImpl());
resSet.setPackageRegistry ( getTransaction().getSession() .getPackageRegistry ()) ; 
Resource resource = resSet.getResource(URI.createURI(path), true);
ClassA clA = (ClassA) resource.getContents().get(0);


If I try to add "clA" to my CDO model the mentioned exception is raised.

Thanks for any advice

[Updated on: Wed, 05 November 2014 21:58]

Report message to a moderator

Re: [CDO] Import from XMI throws DanglingReferenceException [message #1468137 is a reply to message #1462715] Mon, 10 November 2014 16:02 Go to previous messageGo to next message
Richard Meyer is currently offline Richard MeyerFriend
Messages: 40
Registered: June 2012
Member
Solved!
The problem was that I have not set a constant CDO Server UUID.
So every time the CDO Server restarts a random UUID was generated and this of cause was not the same like in the href from the XMI file.
Re: [CDO] [message #1470352 is a reply to message #1462715] Wed, 12 November 2014 09:10 Go to previous message
Esteban Dugueperoux is currently offline Esteban DugueperouxFriend
Messages: 472
Registered: July 2009
Senior Member
Hi Richard,

Which release of CDO do you use?
If you have the bug with the last one, could you write a JUnit test to
reproduce your issue?

Best Regards.

Le 05/11/2014 22:57, Richard Meyer a écrit :
> Hy,
>
> I try to import model elements from XMI in my CDO model but getting the
> following exception:
>
> Caused by: org.eclipse.emf.cdo.util.DanglingReferenceException: The
> object "MyClass?(my.class.MyClassImpl)" is not contained in a resource
>
> First I export parts of my model to XMI. This parts contains references
> to objects in the CDO model. The XMI File contains hrefs like this:
>
> <ClassA >
> <MyClass
> href="cdo://1ef75ed3-3465-4939-9bd9-32bceb126e7c/myResource#L5"/>
> </ClassA>
>
> Now I want to import this XMI file to the same CDO model where it
> original comes from.
> The target of the reference does definitely still exists.
>
> ResourceSet resSet = new ResourceSetImpl();
> Map<String, Object> m = resSet.getResourceFactoryRegistry ()
> .getExtensionToFactoryMap () ;
> m.put("*", new XMIResourceFactoryImpl());
> resSet.setPackageRegistry ( getTransaction().getSession()
> .getPackageRegistry ()) ; Resource resource =
> resSet.getResource(URI.createURI(path), true);
> ClassA clA = (ClassA) resource.getContents().get(0);
>
>
> If I try to add "clA" to my CDO model the mentioned exception is raised.
>
> Thanks for any advice
>



--
Esteban Dugueperoux - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:EMF Edit ItemProvider getText method always returns a default string?
Next Topic:[ECP][CDO] Use CDO Provider for EMFStore in ECP
Goto Forum:
  


Current Time: Fri Apr 19 19:57:46 GMT 2024

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

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

Back to the top