Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Problems loading objects from a resource
[CDO] Problems loading objects from a resource [message #651989] Wed, 02 February 2011 11:18 Go to next message
Eclipse User
Originally posted by: info.dav85.de

Hi everyone,

i've got some problems while loading objects from a resource. In my case
i create a new resource with a CDOTransaction and than i add some
objects and do a commit. All works fine, i can work with the resource
and the containing objects. Then i restart my application and try load
my created resource. The resource is loaded by the CDOTransaction. After
that i will get some objects from the resource like:

resource.getContents().get(0);

and then i got the following exception:

!STACK 0
org.eclipse.emf.cdo.common.util.CDOException: Generated packages locally
not available: CDOPackageUnit[id=MY_PACKAGE_URI, state=PROXY,
type=UNKNOWN, originalType=NATIVE, timeStamp=02.02.2011 12:08:52:718]
at
org.eclipse.emf.internal.cdo.session.CDOSessionImpl.loadPack ages(CDOSessionImpl.java:503)
at
org.eclipse.emf.cdo.internal.common.model.CDOPackageUnitImpl .load(CDOPackageUnitImpl.java:250)
at
org.eclipse.emf.cdo.internal.common.model.CDOPackageUnitImpl .load(CDOPackageUnitImpl.java:239)
at
org.eclipse.emf.cdo.internal.common.model.CDOPackageInfoImpl .getEPackage(CDOPackageInfoImpl.java:118)
at
org.eclipse.emf.cdo.internal.common.model.CDOPackageInfoImpl .getEPackage(CDOPackageInfoImpl.java:105)


Is there problem with my modelconfiguration or the PackageRegistry??

Thanks a lot!
David
Re: [CDO] Problems loading objects from a resource [message #652008 is a reply to message #651989] Wed, 02 February 2011 12:07 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5522
Registered: July 2009
Senior Member
Am 02.02.2011 12:18, schrieb David Hein:
> Hi everyone,
>
> i've got some problems while loading objects from a resource. In my case i create a new resource with a CDOTransaction and than i add some objects and do a commit. All works fine, i can work with the resource and the containing objects. Then i restart my application and try load my created resource. The resource is loaded by the CDOTransaction. After that i will get some objects from the resource like:
>
> resource.getContents().get(0);
>
> and then i got the following exception:
>
> !STACK 0
> org.eclipse.emf.cdo.common.util.CDOException: Generated packages locally not available: CDOPackageUnit[id=MY_PACKAGE_URI, state=PROXY, type=UNKNOWN, originalType=NATIVE, timeStamp=02.02.2011 12:08:52:718]
> at org.eclipse.emf.internal.cdo.session.CDOSessionImpl.loadPack ages(CDOSessionImpl.java:503)
> at org.eclipse.emf.cdo.internal.common.model.CDOPackageUnitImpl .load(CDOPackageUnitImpl.java:250)
> at org.eclipse.emf.cdo.internal.common.model.CDOPackageUnitImpl .load(CDOPackageUnitImpl.java:239)
> at org.eclipse.emf.cdo.internal.common.model.CDOPackageInfoImpl .getEPackage(CDOPackageInfoImpl.java:118)
> at org.eclipse.emf.cdo.internal.common.model.CDOPackageInfoImpl .getEPackage(CDOPackageInfoImpl.java:105)
>
>
> Is there problem with my modelconfiguration or the PackageRegistry??
Both can be possible. Is your generated package properly deployed on the client? is it properly registered (proper nsURI, etc...)?

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] Problems loading objects from a resource [message #652013 is a reply to message #652008] Wed, 02 February 2011 12:26 Go to previous messageGo to next message
Eclipse User
Originally posted by: info.dav85.de

Am 02/02/2011 13:07, schrieb Eike Stepper:
> Am 02.02.2011 12:18, schrieb David Hein:
>> Hi everyone,
>>
>> i've got some problems while loading objects from a resource. In my
>> case i create a new resource with a CDOTransaction and than i add some
>> objects and do a commit. All works fine, i can work with the resource
>> and the containing objects. Then i restart my application and try load
>> my created resource. The resource is loaded by the CDOTransaction.
>> After that i will get some objects from the resource like:
>>
>> resource.getContents().get(0);
>>
>> and then i got the following exception:
>>
>> !STACK 0
>> org.eclipse.emf.cdo.common.util.CDOException: Generated packages
>> locally not available: CDOPackageUnit[id=MY_PACKAGE_URI, state=PROXY,
>> type=UNKNOWN, originalType=NATIVE, timeStamp=02.02.2011 12:08:52:718]
>> at
>> org.eclipse.emf.internal.cdo.session.CDOSessionImpl.loadPack ages(CDOSessionImpl.java:503)
>>
>> at
>> org.eclipse.emf.cdo.internal.common.model.CDOPackageUnitImpl .load(CDOPackageUnitImpl.java:250)
>>
>> at
>> org.eclipse.emf.cdo.internal.common.model.CDOPackageUnitImpl .load(CDOPackageUnitImpl.java:239)
>>
>> at
>> org.eclipse.emf.cdo.internal.common.model.CDOPackageInfoImpl .getEPackage(CDOPackageInfoImpl.java:118)
>>
>> at
>> org.eclipse.emf.cdo.internal.common.model.CDOPackageInfoImpl .getEPackage(CDOPackageInfoImpl.java:105)
>>
>>
>>
>> Is there problem with my modelconfiguration or the PackageRegistry??
> Both can be possible. Is your generated package properly deployed on the
> client? is it properly registered (proper nsURI, etc...)?
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>

Yes the model is deployed on the client and the PackageRegistry has all
my packages registered. I found all of my URIs.

If i create a new second resource with containing objects from my model
and do a commit then i'm able to load my first created resource and
objects. Do i a restart again, i can't load this two resources with
their objects.
It seems that after a commit the package are known?! What can i do that
the packages are known after a new start of my application or what does
the commit what i do not?

Thanks.
Re: [CDO] Problems loading objects from a resource [message #652016 is a reply to message #652013] Wed, 02 February 2011 12:53 Go to previous messageGo to next message
Eclipse User
Originally posted by: info.dav85.de

Am 02/02/2011 13:26, schrieb David Hein:
> Am 02/02/2011 13:07, schrieb Eike Stepper:
>> Am 02.02.2011 12:18, schrieb David Hein:
>>> Hi everyone,
>>>
>>> i've got some problems while loading objects from a resource. In my
>>> case i create a new resource with a CDOTransaction and than i add some
>>> objects and do a commit. All works fine, i can work with the resource
>>> and the containing objects. Then i restart my application and try load
>>> my created resource. The resource is loaded by the CDOTransaction.
>>> After that i will get some objects from the resource like:
>>>
>>> resource.getContents().get(0);
>>>
>>> and then i got the following exception:
>>>
>>> !STACK 0
>>> org.eclipse.emf.cdo.common.util.CDOException: Generated packages
>>> locally not available: CDOPackageUnit[id=MY_PACKAGE_URI, state=PROXY,
>>> type=UNKNOWN, originalType=NATIVE, timeStamp=02.02.2011 12:08:52:718]
>>> at
>>> org.eclipse.emf.internal.cdo.session.CDOSessionImpl.loadPack ages(CDOSessionImpl.java:503)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.common.model.CDOPackageUnitImpl .load(CDOPackageUnitImpl.java:250)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.common.model.CDOPackageUnitImpl .load(CDOPackageUnitImpl.java:239)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.common.model.CDOPackageInfoImpl .getEPackage(CDOPackageInfoImpl.java:118)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.common.model.CDOPackageInfoImpl .getEPackage(CDOPackageInfoImpl.java:105)
>>>
>>>
>>>
>>>
>>> Is there problem with my modelconfiguration or the PackageRegistry??
>> Both can be possible. Is your generated package properly deployed on the
>> client? is it properly registered (proper nsURI, etc...)?
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>
> Yes the model is deployed on the client and the PackageRegistry has all
> my packages registered. I found all of my URIs.
>
> If i create a new second resource with containing objects from my model
> and do a commit then i'm able to load my first created resource and
> objects. Do i a restart again, i can't load this two resources with
> their objects.
> It seems that after a commit the package are known?! What can i do that
> the packages are known after a new start of my application or what does
> the commit what i do not?
>
> Thanks.

I have done another tests with other models in my application. All the
other models works fine. The problem occurred only with this one model.
This model has a reference to an another model. Can this be a problem?
I will do a test wihout this reference and hope to find the mistake :)
Re: [CDO] Problems loading objects from a resource [message #652022 is a reply to message #652016] Wed, 02 February 2011 13:07 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5522
Registered: July 2009
Senior Member
Am 02.02.2011 13:53, schrieb David Hein:
>
> I have done another tests with other models in my application. All the other models works fine. The problem occurred only with this one model. This model has a reference to an another model. Can this be a problem?
I'm not aware of problems with interrelated generated packages, but that does not mean there are none.

> I will do a test wihout this reference and hope to find the mistake :)
One thing that used to create problems is a package with no concrete classes in it. CDO needs to instantiate an arbitrary class to see if the instance can be cast to InternalCDOObject.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] Problems loading objects from a resource [message #652285 is a reply to message #652022] Thu, 03 February 2011 13:13 Go to previous messageGo to next message
Eclipse User
Originally posted by: info.dav85.de

Am 02/02/2011 14:07, schrieb Eike Stepper:
> Am 02.02.2011 13:53, schrieb David Hein:
>>
>> I have done another tests with other models in my application. All the
>> other models works fine. The problem occurred only with this one
>> model. This model has a reference to an another model. Can this be a
>> problem?
> I'm not aware of problems with interrelated generated packages, but that
> does not mean there are none.
>
>> I will do a test wihout this reference and hope to find the mistake :)
> One thing that used to create problems is a package with no concrete
> classes in it. CDO needs to instantiate an arbitrary class to see if the
> instance can be cast to InternalCDOObject.
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>

Hello again

I have found the reason for this problem.

My model is not instantiated during loading objects from the resource.
If i call MYMODELPACKAGE.eInstance before i do this, all works fine and
my package is found.

At the moment it is a workaround for me. Why does not (can not) EMF
instantiate the model by itself?

Thanks.
Re: [CDO] Problems loading objects from a resource [message #652289 is a reply to message #652285] Thu, 03 February 2011 13:29 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5522
Registered: July 2009
Senior Member
Am 03.02.2011 14:13, schrieb David Hein:
>> [...]
>
>
> Hello again
>
> I have found the reason for this problem.
>
> My model is not instantiated during loading objects from the resource. If i call MYMODELPACKAGE.eInstance before i do this, all works fine and my package is found.
I'm glad to hear this.

>
> At the moment it is a workaround for me.
Not sure if that's a workaround. Without OSGI you are expected to do manually what the extension registry would do for you if you were running in OSGi.

> Why does not (can not) EMF instantiate the model by itself?
I recommend you ask this question again in a new thread without "[CDO]". More liekly that the EMF gurus see it then ;-)

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] Problems loading objects from a resource [message #736745 is a reply to message #652289] Fri, 14 October 2011 09:38 Go to previous messageGo to next message
Federico Tomassetti is currently offline Federico Tomassetti
Messages: 186
Registered: July 2009
Location: Torino
Senior Member

I have the same problem BUT the package not found is not one built by me, it seems something related to CDO:

Caused by: org.eclipse.emf.cdo.common.util.CDOException: Generated packages locally not available: CDOPackageUnit[id=http://www.eclipse.org/emf/CDO/Eresource/4.0.0, state=PROXY, type=UNKNOWN, originalType=NATIVE, timeStamp=2011-10-14 11:32:20.183]


Re: [CDO] Problems loading objects from a resource [message #736764 is a reply to message #736745] Fri, 14 October 2011 10:05 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5522
Registered: July 2009
Senior Member
Am 14.10.2011 11:38, schrieb Federico Tomassetti:
> I have the same problem BUT the package not found is not one built by me, it seems something related to CDO:
>
>
> Caused by: org.eclipse.emf.cdo.common.util.CDOException: Generated packages locally not available:
> CDOPackageUnit[id=http://www.eclipse.org/emf/CDO/Eresource/4.0.0, state=PROXY, type=UNKNOWN, originalType=NATIVE,
> timeStamp=2011-10-14 11:32:20.183]
That is a CDO system package (included in org.eclipse.emf.cdo). If that's not available your setup is probably wrong. If
you're running standalone (no extension registy available) you may have to manually register this package with the
global package registry, e.g.:

EresourcePackage.eINSTANCE.getClass();

If that works, we could consider to do that for all system packages somewhere in the client core.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] Problems loading objects from a resource [message #736770 is a reply to message #736764] Fri, 14 October 2011 10:11 Go to previous messageGo to next message
Federico Tomassetti is currently offline Federico Tomassetti
Messages: 186
Registered: July 2009
Location: Torino
Senior Member

It works now.

I will look at that because on another Eclipse installation that worked without manually register the packages.

Federico


Re: [CDO] Problems loading objects from a resource [message #736781 is a reply to message #736770] Fri, 14 October 2011 10:23 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5522
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Am 14.10.2011 12:11, schrieb Federico Tomassetti:
<blockquote cite="mid:j7915f$u9n$1@news.eclipse.org" type="cite">It
works now.
<br>
<br>
I will look at that because on another Eclipse installation that
worked without manually register the packages.
<br>
</blockquote>
Yeah, I've never heard before that manual registration of our system
packages is required. The reason is probably that the normal setup
code on a client looks like:<br>
<br>
<title></title>
<style type="text/css">
<!--code { font-family: Courier New, Courier; font-size: 10pt; margin: 0px; }-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- ======================================================== -->
<!-- = Java Sourcecode to HTML automatically converted code = -->
<!-- = Java2Html Converter 5.0 [2006-02-26] by Markus Gebhard markus@jave.de = -->
<!-- = Further information: http://www.java2html.de = -->
<div class="java" align="left">
<table bgcolor="#ffffff" border="0" cellpadding="3"
cellspacing="0">
<tbody>
<tr>
<!-- start source code --> <td align="left" nowrap="nowrap"
valign="top"> <code>
<font color="#ffffff">    </font><font color="#000000">CDOSession session = openSession</font><font
color="#000000">()</font><font color="#000000">;</font><br>
<font color="#ffffff">    </font><font color="#000000">CDOTransaction transaction = session.openTransaction</font><font
color="#000000">()</font><font color="#000000">;</font><br>
<font color="#ffffff">    </font><font color="#000000">CDOResource resource = transaction.getResource</font><font
color="#000000">(</font><font color="#2a00ff">"/my/resource"</font><font
color="#000000">)</font><font color="#000000">;</font></code>
</td>
<!-- end source code --> </tr>
</tbody>
</table>
</div>
<!-- = END of automatically generated HTML code = -->
<!-- ======================================================== -->
<br>
I guess through that sequence the Eresource package gets registered
implicitely. Can you post the exact sequence of your code that ended
in that exception?<br>
<br>
Cheers<br>
/Eike<br>
<br>
----<br>
<a class="moz-txt-link-freetext" href="http://www.esc-net.de">http://www.esc-net.de</a><br>
<a class="moz-txt-link-freetext" href="http://thegordian.blogspot.com">http://thegordian.blogspot.com</a><br>
<a class="moz-txt-link-freetext" href="http://twitter.com/eikestepper">http://twitter.com/eikestepper</a><br>
<br>
<br>
</body>
</html>
Re: [CDO] Problems loading objects from a resource [message #736796 is a reply to message #736781] Fri, 14 October 2011 10:42 Go to previous messageGo to next message
Federico Tomassetti is currently offline Federico Tomassetti
Messages: 186
Registered: July 2009
Location: Torino
Senior Member

this is the line:
CDOResource rootResource = view.getRootResource();


Stack trace:
java.lang.RuntimeException: Problem operation on view: Generated packages locally not available: CDOPackageUnit[id=http://www.eclipse.org/emf/CDO/Eresource/4.0.0, state=PROXY, type=UNKNOWN, originalType=NATIVE, timeStamp=2011-10-14 11:32:20.183]
	at it.rcpvision.cdoexamples.stockmanager.client.SessionOperator.doWithView(SessionOperator.java:34)
	at it.rcpvision.cdoexamples.stockmanager.client.NavigationPanel.updateListOfResources(NavigationPanel.java:276)
	at it.rcpvision.cdoexamples.stockmanager.client.NavigationPanel.connected(NavigationPanel.java:261)
	at it.rcpvision.cdoexamples.stockmanager.client.ClientGUI.connected(ClientGUI.java:57)
	at it.rcpvision.cdoexamples.stockmanager.client.ClientGUI.access$3(ClientGUI.java:54)
	at it.rcpvision.cdoexamples.stockmanager.client.ClientGUI$2.widgetSelected(ClientGUI.java:114)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4125)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1457)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1480)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1465)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1270)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3971)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3610)
	at it.rcpvision.cdoexamples.stockmanager.client.ClientGUI.createGUI(ClientGUI.java:83)
	at it.rcpvision.cdoexamples.stockmanager.client.ClientGUI.main(ClientGUI.java:26)
Caused by: org.eclipse.emf.cdo.common.util.CDOException: Generated packages locally not available: CDOPackageUnit[id=http://www.eclipse.org/emf/CDO/Eresource/4.0.0, state=PROXY, type=UNKNOWN, originalType=NATIVE, timeStamp=2011-10-14 11:32:20.183]
	at org.eclipse.emf.internal.cdo.session.CDOSessionImpl.loadPackages(CDOSessionImpl.java:526)
	at org.eclipse.emf.cdo.internal.common.model.CDOPackageUnitImpl.load(CDOPackageUnitImpl.java:250)
	at org.eclipse.emf.cdo.internal.common.model.CDOPackageUnitImpl.load(CDOPackageUnitImpl.java:239)
	at org.eclipse.emf.cdo.internal.common.model.CDOPackageInfoImpl.doGetEPackage(CDOPackageInfoImpl.java:123)
	at org.eclipse.emf.cdo.internal.common.model.CDOPackageInfoImpl.getEPackage(CDOPackageInfoImpl.java:110)
	at org.eclipse.emf.cdo.internal.common.model.CDOPackageInfoImpl.getEPackage(CDOPackageInfoImpl.java:105)
	at org.eclipse.emf.ecore.impl.EPackageRegistryImpl.getEPackage(EPackageRegistryImpl.java:133)
	at org.eclipse.emf.cdo.common.model.CDOClassifierRef.resolve(CDOClassifierRef.java:110)
	at org.eclipse.emf.cdo.internal.common.protocol.CDODataInputImpl.readCDOClassifierRefAndResolve(CDODataInputImpl.java:167)
	at org.eclipse.emf.cdo.spi.common.revision.BaseCDORevision.readSystemValues(BaseCDORevision.java:145)
	at org.eclipse.emf.cdo.spi.common.revision.BaseCDORevision.read(BaseCDORevision.java:131)
	at org.eclipse.emf.cdo.internal.common.protocol.CDODataInputImpl.readCDORevision(CDODataInputImpl.java:482)
	at org.eclipse.emf.cdo.spi.common.revision.RevisionInfo.readRevision(RevisionInfo.java:193)
	at org.eclipse.emf.cdo.spi.common.revision.RevisionInfo.readResult(RevisionInfo.java:145)
	at org.eclipse.emf.cdo.internal.net4j.protocol.LoadRevisionsRequest.confirming(LoadRevisionsRequest.java:143)
	at org.eclipse.emf.cdo.internal.net4j.protocol.LoadRevisionsRequest.confirming(LoadRevisionsRequest.java:1)
	at org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientRequest.confirming(CDOClientRequest.java:90)
	at org.eclipse.net4j.signal.RequestWithConfirmation.doExtendedInput(RequestWithConfirmation.java:123)
	at org.eclipse.net4j.signal.Signal.doInput(Signal.java:326)
	at org.eclipse.net4j.signal.RequestWithConfirmation.doExecute(RequestWithConfirmation.java:103)
	at org.eclipse.net4j.signal.SignalActor.execute(SignalActor.java:51)
	at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
	at org.eclipse.net4j.signal.SignalProtocol.startSignal(SignalProtocol.java:433)
	at org.eclipse.net4j.signal.RequestWithConfirmation.doSend(RequestWithConfirmation.java:87)
	at org.eclipse.net4j.signal.RequestWithConfirmation.send(RequestWithConfirmation.java:73)
	at org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientProtocol.send(CDOClientProtocol.java:496)
	at org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientProtocol.send(CDOClientProtocol.java:529)
	at org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientProtocol.loadRevisions(CDOClientProtocol.java:166)
	at org.eclipse.emf.cdo.internal.common.revision.CDORevisionManagerImpl.loadRevisions(CDORevisionManagerImpl.java:365)
	at org.eclipse.emf.cdo.internal.common.revision.CDORevisionManagerImpl.getRevisions(CDORevisionManagerImpl.java:276)
	at org.eclipse.emf.cdo.internal.common.revision.CDORevisionManagerImpl.getRevision(CDORevisionManagerImpl.java:259)
	at org.eclipse.emf.cdo.internal.common.revision.CDORevisionManagerImpl.getRevision(CDORevisionManagerImpl.java:252)
	at org.eclipse.emf.internal.cdo.view.CDOViewImpl.getRevision(CDOViewImpl.java:653)
	at org.eclipse.emf.internal.cdo.view.AbstractCDOView.createObject(AbstractCDOView.java:796)
	at org.eclipse.emf.internal.cdo.view.AbstractCDOView.getObject(AbstractCDOView.java:706)
	at org.eclipse.emf.internal.cdo.view.AbstractCDOView.getObject(AbstractCDOView.java:675)
	at org.eclipse.emf.internal.cdo.view.AbstractCDOView.getRootResource(AbstractCDOView.java:216)
	at org.eclipse.emf.internal.cdo.view.AbstractCDOView.getRootResource(AbstractCDOView.java:1)
	at it.rcpvision.cdoexamples.stockmanager.client.NavigationPanel.getOrCreateStocksResource(NavigationPanel.java:356)
	at it.rcpvision.cdoexamples.stockmanager.client.NavigationPanel.access$6(NavigationPanel.java:352)
	at it.rcpvision.cdoexamples.stockmanager.client.NavigationPanel$6.execute(NavigationPanel.java:282)
	at it.rcpvision.cdoexamples.stockmanager.client.SessionOperator.doWithView(SessionOperator.java:32)
	... 16 more


Strangely when I run some tests which write into the CDO repository everything works fine but it is probably because it is easy to have the package implicitly registered (I think it it enough that the class is loaded: there is some static initializer performing the registration).


Re: [CDO] Problems loading objects from a resource [message #736819 is a reply to message #736796] Fri, 14 October 2011 11:08 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5522
Registered: July 2009
Senior Member
Am 14.10.2011 12:43, schrieb Federico Tomassetti:
>
> at it.rcpvision.cdoexamples.stockmanager.client.NavigationPanel.getOrCreateStocksResource(NavigationPanel.java:356)
The code of this method would be interesting. I suspect the first call to CDO is made there.

>
> Strangely when I run some tests which write into the CDO repository everything works fine but it is probably because
> it is easy to have the package implicitly registered (I think it it enough that the class is loaded: there is some
> static initializer performing the registration).
Exactly.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] Problems loading objects from a resource [message #736831 is a reply to message #736819] Fri, 14 October 2011 11:19 Go to previous messageGo to next message
Federico Tomassetti is currently offline Federico Tomassetti
Messages: 186
Registered: July 2009
Location: Torino
Senior Member

Eike Stepper wrote on Fri, 14 October 2011 13:08
Am 14.10.2011 12:43, schrieb Federico Tomassetti:
>
> at it.rcpvision.cdoexamples.stockmanager.client.NavigationPanel.getOrCreateStocksResource(NavigationPanel.java:356)
The code of this method would be interesting. I suspect the first call to CDO is made there.


Yes the exception is thrown by the view.getRootResource call inside this method:

	private CDOResource getOrCreateStocksResource(CDOView view)
			throws CommitException {
		// FIXME transaction.getOrCreateResource....
		CDOResource stocksResource = null;
		CDOResource rootResource = view.getRootResource();
		for (EObject content : rootResource.getContents()) {
			if (content instanceof CDOResource) {
				CDOResource containedResource = (CDOResource) content;
				if (containedResource.getPath().equals(STOCKS_RESOURCE_PATH)) {
					stocksResource = containedResource;
				}
			}
		}
		if (null == stocksResource) {
			createResource(STOCKS_RESOURCE_PATH);
			return getOrCreateStocksResource(view);
		}
		return stocksResource;
	}



Re: [CDO] Problems loading objects from a resource [message #736833 is a reply to message #736831] Fri, 14 October 2011 11:21 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5522
Registered: July 2009
Senior Member
Am 14.10.2011 13:19, schrieb Federico Tomassetti:
> Eike Stepper wrote on Fri, 14 October 2011 13:08
>> Am 14.10.2011 12:43, schrieb Federico Tomassetti:
>> >
>> > at it.rcpvision.cdoexamples.stockmanager.client.NavigationPanel.getOrCreateStocksResource(NavigationPanel.java:356)
>> The code of this method would be interesting. I suspect the first call to CDO is made there.
>
>
> Yes the exception is thrown by the view.getRootResource call inside this method:
>
>
> private CDOResource getOrCreateStocksResource(CDOView view)
> throws CommitException {
> // FIXME transaction.getOrCreateResource....
> CDOResource stocksResource = null;
> CDOResource rootResource = view.getRootResource();
I see. Please submit a bugzilla and I'll see what I can do ;-)

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


> for (EObject content : rootResource.getContents()) {
> if (content instanceof CDOResource) {
> CDOResource containedResource = (CDOResource) content;
> if (containedResource.getPath().equals(STOCKS_RESOURCE_PATH)) {
> stocksResource = containedResource;
> }
> }
> }
> if (null == stocksResource) {
> createResource(STOCKS_RESOURCE_PATH);
> return getOrCreateStocksResource(view);
> }
> return stocksResource;
> }
>
>
icon3.gif  Re: [CDO] Problems loading objects from a resource [message #787676 is a reply to message #652285] Tue, 31 January 2012 21:28 Go to previous messageGo to next message
Alexandre Borgoltz is currently offline Alexandre Borgoltz
Messages: 14
Registered: July 2009
Location: France
Junior Member
FYI, I have encountered the exact same behaviour.

The reason was simple : I was missing the org.eclipse.emf.ecore.generated_package extension.

Or more precisely, I had it but the mentioned NS URI was wrong. (Maybe you incremented the version number in the namespace in the .ecore but forgot to update plugin.xml?)

   <extension point="org.eclipse.emf.ecore.generated_package">
      <package
            uri="http://some/wrong/URI" 
            class="my.application.MyPackage"
            genModel="model/my-model.genmodel"/>
   </extension>

HTH!

Smile

--
Alexandre
Re: [CDO] Problems loading objects from a resource [message #912392 is a reply to message #787676] Thu, 13 September 2012 13:36 Go to previous message
Mark Rowe is currently offline Mark Rowe
Messages: 23
Registered: January 2012
Junior Member
Another possibility is that the model package is not being registered in openSession().

This happened to me because I was using the QuickStartTest.java class as a boiler plate without changing the BaseTest.java class.

Specifically the line:

cdoSession.getPackageRegistry().putEPackage(CompanyPackage.eINSTANCE);


Needs to be updated to register your model package instead of "CompanyPackage".
Previous Topic:(no subject)
Next Topic:[CDO] Example cdo-server.xml for a DB store
Goto Forum:
  


Current Time: Thu Sep 18 01:39:08 GMT 2014

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

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