Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Error when deleting a resource from the root
[CDO] Error when deleting a resource from the root [message #1027070] Tue, 26 March 2013 10:21 Go to next message
Marc Gil is currently offline Marc Gil
Messages: 81
Registered: July 2009
Member
Hi,

I'm getting an exception when try to delete a resource from the root (not contained into any CDOResourceFolder, directly from the root). I'm using the default CDO Sessions view.

[ERROR] org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta$1 cannot be cast to org.eclipse.emf.cdo.eresource.CDOResourceNode
java.lang.ClassCastException: org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta$1 cannot be cast to org.eclipse.emf.cdo.eresource.CDOResourceNode
	at org.eclipse.emf.internal.cdo.view.AbstractCDOView$ContainerAdapter.notifyChanged(AbstractCDOView.java:1836)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
	at org.eclipse.emf.common.notify.impl.NotificationChainImpl.dispatch(NotificationChainImpl.java:98)
	at org.eclipse.emf.common.notify.impl.NotificationChainImpl.dispatch(NotificationChainImpl.java:86)
	at org.eclipse.emf.internal.cdo.view.CDOViewImpl.sendDeltaNotifications(CDOViewImpl.java:980)
	at org.eclipse.emf.internal.cdo.view.CDOViewImpl.doInvalidate(CDOViewImpl.java:857)
	at org.eclipse.emf.internal.cdo.view.CDOViewImpl$InvalidationRunnable.run(CDOViewImpl.java:1591)
	at org.eclipse.net4j.util.concurrent.QueueRunner.work(QueueRunner.java:26)
	at org.eclipse.net4j.util.concurrent.QueueRunner.work(QueueRunner.java:1)
	at org.eclipse.net4j.util.concurrent.QueueWorker.doWork(QueueWorker.java:88)
	at org.eclipse.net4j.util.concurrent.QueueWorker.work(QueueWorker.java:79)
	at org.eclipse.net4j.util.concurrent.Worker$WorkerThread.run(Worker.java:206)


I'm also using PostgreSQL 9.1 as database server, and CDO version 4.2-M5 (S20130205-0640)

Thanks,
Marc Gil
Re: [CDO] Error when deleting a resource from the root [message #1027114 is a reply to message #1027070] Tue, 26 March 2013 11:17 Go to previous messageGo to next message
Marc Gil is currently offline Marc Gil
Messages: 81
Registered: July 2009
Member
This error also occurs in the 4.2-M6 version of CDO.
Re: [CDO] Error when deleting a resource from the root [message #1027620 is a reply to message #1027114] Wed, 27 March 2013 03:33 Go to previous messageGo to next message
Marc Gil is currently offline Marc Gil
Messages: 81
Registered: July 2009
Member
As far as I detect, this error occurs due to the listeners added to the CDOView. When removing doing some actions to the CDOResources, a CDOTransaction is created to execute the changes, and when do the commit this listeners capture some events and provokes this error.

But it's curious that the error is thrown only when deleting a resource from the root, but if you delete a resource contained into a folder, there is no error...

Marc

[Updated on: Wed, 27 March 2013 03:34]

Report message to a moderator

Re: [CDO] Error when deleting a resource from the root [message #1031028 is a reply to message #1027070] Mon, 01 April 2013 00:32 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5481
Registered: July 2009
Senior Member
Am 26.03.2013 15:21, schrieb Marc Gil:
> Hi,
>
> I'm getting an exception when try to delete a resource from the root (not contained into any CDOResourceFolder,
> directly from the root). I'm using the default CDO Sessions view.
>
>
> [ERROR] org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta$1 cannot be cast to
> org.eclipse.emf.cdo.eresource.CDOResourceNode
> java.lang.ClassCastException: org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta$1 cannot be cast to
> org.eclipse.emf.cdo.eresource.CDOResourceNode
> at org.eclipse.emf.internal.cdo.view.AbstractCDOView$ContainerAdapter.notifyChanged(AbstractCDOView.java:1836)
> at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
> at org.eclipse.emf.common.notify.impl.NotificationChainImpl.dispatch(NotificationChainImpl.java:98)
> at org.eclipse.emf.common.notify.impl.NotificationChainImpl.dispatch(NotificationChainImpl.java:86)
> at org.eclipse.emf.internal.cdo.view.CDOViewImpl.sendDeltaNotifications(CDOViewImpl.java:980)
> at org.eclipse.emf.internal.cdo.view.CDOViewImpl.doInvalidate(CDOViewImpl.java:857)
> at org.eclipse.emf.internal.cdo.view.CDOViewImpl$InvalidationRunnable.run(CDOViewImpl.java:1591)
> at org.eclipse.net4j.util.concurrent.QueueRunner.work(QueueRunner.java:26)
> at org.eclipse.net4j.util.concurrent.QueueRunner.work(QueueRunner.java:1)
> at org.eclipse.net4j.util.concurrent.QueueWorker.doWork(QueueWorker.java:88)
> at org.eclipse.net4j.util.concurrent.QueueWorker.work(QueueWorker.java:79)
> at org.eclipse.net4j.util.concurrent.Worker$WorkerThread.run(Worker.java:206)
This stack trace does not apply exactly anymore to M6. Can you please provide a more recent stack trace?

A test case that reproduces your problem would even be nicer.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] Error when deleting a resource from the root [message #1031031 is a reply to message #1027620] Mon, 01 April 2013 00:38 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5481
Registered: July 2009
Senior Member
Am 27.03.2013 08:33, schrieb Marc Gil:
> As far as I detect, this error occurs due to the listeners
What listeners?

> added to the CDOView. When removing doing some actions to the CDOResources, a CDOTransaction is created to execute the
> changes, and when do the commit this listeners capture some events and provokes this error.
I'm sorry but I've got no clue what this is supposed to mean. Maybe you can reword it? A test case might help me to
understand.

> But it's curious that the error is thrown when deleting a resource from the root, but if you delete a resource
> contained into a folder, there is no error...
I've added this test case to org.eclipse.emf.cdo.tests.ResourceTest and it succeeds:

@CleanRepositoriesBefore
public void testDeleteResourceFromRoot() throws Exception
{
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();

Product1 p = getModel1Factory().createProduct1();
p.setName("Product1");
p.setVat(VAT.VAT0);

CDOResource resource = transaction.createResource("/res-" + System.currentTimeMillis());
resource.getContents().add(p);

CDOID resourceID = resource.cdoID();

CDOObject object = CDOUtil.getCDOObject(resource.getContents().get(0));
CDOID objectID = object.cdoID();

transaction.commit();
resource.delete(null);
transaction.commit();
transaction.close();

CDOView view = session.openView();
assertEquals(false, view.hasResource(getResourcePath("/resource1")));

try
{
view.getResourceNode("/resource1");
fail("Exception expected");
}
catch (Exception expected)
{
}

try
{
view.getResource(getResourcePath("/resource1"));
fail("Exception expected");
}
catch (Exception expected)
{
}

try
{
view.getObject(resourceID);
fail("ObjectNotFoundException expected");
}
catch (ObjectNotFoundException expected)
{
}

try
{
view.getObject(objectID);
fail("ObjectNotFoundException expected");
}
catch (ObjectNotFoundException expected)
{
}

session.close();
}

You may want to play with it and submit a bugzilla with a new test case if you can make it fail.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] Error when deleting a resource from the root [message #1031768 is a reply to message #1031031] Tue, 02 April 2013 02:56 Go to previous messageGo to next message
Marc Gil is currently offline Marc Gil
Messages: 81
Registered: July 2009
Member
Hi Eike,

Maybe the your test case works, but it's not the same scenario that the following one:
1. Open the CDO Sessions view.
2. Open a new Session to the repository (using MySQL DB)
3. Open a new Transacion
4. Create a resource, for instance a folder
5. Remove this resource

The exception is raised:
java.lang.ClassCastException: org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta$1 cannot be cast to org.eclipse.emf.cdo.eresource.CDOResourceNode
	[b]at org.eclipse.emf.internal.cdo.view.AbstractCDOView$ContainerAdapter.notifyChanged(AbstractCDOView.java:1852)[/b]
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
	at org.eclipse.emf.common.notify.impl.NotificationChainImpl.dispatch(NotificationChainImpl.java:98)
	at org.eclipse.emf.common.notify.impl.NotificationChainImpl.dispatch(NotificationChainImpl.java:86)
	at org.eclipse.emf.internal.cdo.view.CDOViewImpl.sendDeltaNotifications(CDOViewImpl.java:983)
	at org.eclipse.emf.internal.cdo.view.CDOViewImpl.doInvalidate(CDOViewImpl.java:860)
	at org.eclipse.emf.internal.cdo.view.CDOViewImpl$InvalidationRunnable.run(CDOViewImpl.java:1604)
	at org.eclipse.net4j.util.concurrent.QueueRunner.work(QueueRunner.java:26)
	at org.eclipse.net4j.util.concurrent.QueueRunner.work(QueueRunner.java:1)
	at org.eclipse.net4j.util.concurrent.QueueWorker.doWork(QueueWorker.java:88)
	at org.eclipse.net4j.util.concurrent.QueueWorker.work(QueueWorker.java:79)
	at org.eclipse.net4j.util.concurrent.Worker$WorkerThread.run(Worker.java:206)


Forget what I said about the listeners, cause I was wrong.
Does this example works for you?

Cheers,
Marc
Re: [CDO] Error when deleting a resource from the root [message #1034334 is a reply to message #1031768] Fri, 05 April 2013 06:05 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5481
Registered: July 2009
Senior Member
Hi Marc,

I've tried exactly the steps you've listed and it works perfectly here. I can delete top level resources, folders and
resources from folders. But I tried with H2 because Mysql is a little more effort here. Before I test with Mysql, can
you pease confirm that it works for you with H2 (just to exclude other differences in your setup)?

Cheers
/Eike

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


Am 02.04.2013 08:56, schrieb Marc Gil:
> Hi Eike,
>
> Maybe the your test case works, but it's not the same scenario that the following one:
> 1. Open the CDO Sessions view.
> 2. Open a new Session to the repository (using MySQL DB)
> 3. Open a new Transacion
> 4. Create a resource, for instance a folder
> 5. Remove this resource
>
> The exception is raised:
>
> java.lang.ClassCastException: org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta$1 cannot be cast to
> org.eclipse.emf.cdo.eresource.CDOResourceNode
> at org.eclipse.emf.internal.cdo.view.AbstractCDOView$ContainerAdapter.notifyChanged(AbstractCDOView.java:1852)
> at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
> at org.eclipse.emf.common.notify.impl.NotificationChainImpl.dispatch(NotificationChainImpl.java:98)
> at org.eclipse.emf.common.notify.impl.NotificationChainImpl.dispatch(NotificationChainImpl.java:86)
> at org.eclipse.emf.internal.cdo.view.CDOViewImpl.sendDeltaNotifications(CDOViewImpl.java:983)
> at org.eclipse.emf.internal.cdo.view.CDOViewImpl.doInvalidate(CDOViewImpl.java:860)
> at org.eclipse.emf.internal.cdo.view.CDOViewImpl$InvalidationRunnable.run(CDOViewImpl.java:1604)
> at org.eclipse.net4j.util.concurrent.QueueRunner.work(QueueRunner.java:26)
> at org.eclipse.net4j.util.concurrent.QueueRunner.work(QueueRunner.java:1)
> at org.eclipse.net4j.util.concurrent.QueueWorker.doWork(QueueWorker.java:88)
> at org.eclipse.net4j.util.concurrent.QueueWorker.work(QueueWorker.java:79)
> at org.eclipse.net4j.util.concurrent.Worker$WorkerThread.run(Worker.java:206)
>
>
> Forget what I said about the listeners, cause I was wrong.
> Does this example works for you?
>
> Cheers,
> Marc
Re: [CDO] Error when deleting a resource from the root [message #1036846 is a reply to message #1034334] Mon, 08 April 2013 18:23 Go to previous messageGo to next message
Marc Gil is currently offline Marc Gil
Messages: 81
Registered: July 2009
Member
Eike,

Following the steps, if you remove a root element sometimes the exception is not raised, but you can see how the element is marked as Invalid in the CDO View, and if you try to operate with this resource, you only get a lot of exceptions. This does not happen if the removed element is contained into a folder. Maybe you don't get this exception cause the code is treating the exception, but it is raised.

I try it with MySQL 5.5.27, PostgreSQL 9.1.8 and PostgreSQL 9.2.3. I'll try it with H2 as soon as possible and I will tell you the results, but I thing that it will be the same...

Cheers,
Marc
Re: [CDO] Error when deleting a resource from the root [message #1037454 is a reply to message #1036846] Tue, 09 April 2013 11:17 Go to previous messageGo to next message
Marc Gil is currently offline Marc Gil
Messages: 81
Registered: July 2009
Member
Eike,

I try it using an H2 database, and the problem is reproduced like using MySQL and PostgreSQL. Check that you have the Error Log view opened in Eclipse, and try to reproduce the steps. I get this exception...

Cheers,
Marc
Re: [CDO] Error when deleting a resource from the root [message #1038675 is a reply to message #1037454] Thu, 11 April 2013 02:53 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5481
Registered: July 2009
Senior Member
Am 09.04.2013 17:17, schrieb Marc Gil:
> Eike,
>
> I try it using an H2 database, and the problem is reproduced like using MySQL and PostgreSQL. Check that you have the
> Error Log view opened in Eclipse, and try to reproduce the steps. I get this exception...
In any case, if you still get unexpected exceptions can you please try to reproduce them in a test case based on
AbstractCDOTest? There are lots of examples in org.eclipse.emf.cdo.tests

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] Error when deleting a resource from the root [message #1038871 is a reply to message #1038675] Thu, 11 April 2013 09:03 Go to previous messageGo to next message
Marc Gil is currently offline Marc Gil
Messages: 81
Registered: July 2009
Member
Hi Eike,

I'm not able to have the plugin org.eclipse.emf.cdo.tests loaded. I have imported the M6 version of this plugin into my workspace, and I have 2 errors:
- One error in the MANIFEST.MF, in the Imported Package org.apache.derby.jdbc. You're indicating that the version of this package needs to be between 10.0.0 and 11.0.0. The version I have for this plugin, is the 10.5.1.1, but in its manifest exports this package without specifying any version (I have this plugin cause I have installed BIRT 3.7.2). Maybe you can remove the minimum and maximum version for this package...
- The other error is in the class org.eclipse.emf.cdo.tests.EMFCompareTest. In the line 186 "EMFCompare comparator = EMFCompare.builder().setMatchEngine(matchEngine).build();". The version of EMF Compare I have installed is the last 2.1.0 M6. You're specifying in the org.eclipse.emf.cdo.compare plugin that it has a dependency to org.eclipse.emf.compare from [3.0.0 to 4.0.0), but something is wrong here. Maybe you're using another version of EMF Compare...

Cheers,
Marc
Re: [CDO] Error when deleting a resource from the root [message #1043792 is a reply to message #1038871] Thu, 18 April 2013 02:08 Go to previous message
Eike Stepper is currently offline Eike Stepper
Messages: 5481
Registered: July 2009
Senior Member
Am 11.04.2013 15:03, schrieb Marc Gil:
> Hi Eike,
>
> I'm not able to have the plugin org.eclipse.emf.cdo.tests loaded. I have imported the M6 version of this plugin into
> my workspace, and I have 2 errors:
> - One error in the MANIFEST.MF, in the Imported Package org.apache.derby.jdbc. You're indicating that the version of
> this package needs to be between 10.0.0 and 11.0.0. The version I have for this plugin, is the 10.5.1.1, but in its
> manifest exports this package without specifying any version (I have this plugin cause I have installed BIRT 3.7.2).
> Maybe you can remove the minimum and maximum version for this package...
Good point! I've now removed all DB dependencies from the core tests:

405933: [Releng] Remove DB dependencies from cdo.tests
https://bugs.eclipse.org/bugs/show_bug.cgi?id=405933

> - The other error is in the class org.eclipse.emf.cdo.tests.EMFCompareTest. In the line 186 "EMFCompare comparator =
> EMFCompare.builder().setMatchEngine(matchEngine).build();". The version of EMF Compare I have installed is the last
> 2.1.0 M6. You're specifying in the org.eclipse.emf.cdo.compare plugin that it has a dependency to
> org.eclipse.emf.compare from [3.0.0 to 4.0.0), but something is wrong here. Maybe you're using another version of EMF
> Compare...
Yes, indeed. There was a confusion with Compare's p2 repos that caused us to build against a wrong version. Our more
recent I-builds fix that.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Previous Topic:[CDO] Get access only the readable resources in a view
Next Topic:Creating a model-instance from .xml-file
Goto Forum:
  


Current Time: Sat Jul 26 01:16:30 EDT 2014

Powered by FUDForum. Page generated in 0.41752 seconds