[CDO] Problems loading objects from a resource [message #651989] |
Wed, 02 February 2011 11:18 |
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 |
|
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
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 |
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 |
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 #652285 is a reply to message #652022] |
Thu, 03 February 2011 13:13 |
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 #736781 is a reply to message #736770] |
Fri, 14 October 2011 10:23 |
|
<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>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: [CDO] Problems loading objects from a resource [message #736796 is a reply to message #736781] |
Fri, 14 October 2011 10:42 |
|
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).
website: http://www.federico-tomassetti.it
|
|
|
|
Re: [CDO] Problems loading objects from a resource [message #736831 is a reply to message #736819] |
Fri, 14 October 2011 11:19 |
|
Eike Stepper wrote on Fri, 14 October 2011 13:08Am 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;
}
website: http://www.federico-tomassetti.it
|
|
|
Re: [CDO] Problems loading objects from a resource [message #736833 is a reply to message #736831] |
Fri, 14 October 2011 11:21 |
|
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;
> }
>
>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04659 seconds