Home » Modeling » EMF » [CDO] Old class cast exception resurfaces(A CDO classcastexception fixed in 2012 rises again, maybe?)
[CDO] Old class cast exception resurfaces [message #1339141] |
Wed, 07 May 2014 14:37 |
David Wynter Messages: 4624 Registered: July 2009 |
Senior Member |
|
|
Hi,
We have some code that Exports our repo model into an xmi file. But in some cases it throws this exception
[ERROR 2014-05-07 15:30:36.945 BST] main:com.yambina.edm.core.utils.ErrorUtils - Failed to export to file:/Users/david/workspace/fullmodeltest.xmi
java.lang.reflect.InvocationTargetException
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:421)
at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:507)
at com.yambina.edm.validation.ExportCommandHandler.execute(ExportCommandHandler.java:54)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:290)
at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:243)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:224)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:167)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:850)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.handleWidgetSelection(HandledContributionItem.java:743)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.access$7(HandledContributionItem.java:727)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem$4.handleEvent(HandledContributionItem.java:662)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4166)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1466)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1489)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1474)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1279)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4012)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3651)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:140)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:611)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at com.yambina.mdwmui.MDWMUIApplication.start(MDWMUIApplication.java:44)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
Caused by: org.eclipse.net4j.signal.RemoteException: java.lang.ClassCastException: org.eclipse.emf.cdo.common.revision.CDORevisionUtil$Uninitialized cannot be cast to org.eclipse.emf.cdo.common.id.CDOID
at org.eclipse.net4j.signal.RequestWithConfirmation.getRemoteException(RequestWithConfirmation.java:141)
at org.eclipse.net4j.signal.RequestWithConfirmation.setRemoteException(RequestWithConfirmation.java:130)
at org.eclipse.net4j.signal.SignalProtocol.handleRemoteException(SignalProtocol.java:465)
at org.eclipse.net4j.signal.RemoteExceptionIndication.indicating(RemoteExceptionIndication.java:66)
at org.eclipse.net4j.signal.Indication.doExtendedInput(Indication.java:57)
at org.eclipse.net4j.signal.Signal.doInput(Signal.java:328)
at org.eclipse.net4j.signal.Indication.execute(Indication.java:51)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:253)
at org.eclipse.net4j.signal.Signal.run(Signal.java:149)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.ClassCastException: org.eclipse.emf.cdo.common.revision.CDORevisionUtil$Uninitialized cannot be cast to org.eclipse.emf.cdo.common.id.CDOID
at org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl$11.writeValue(CDOTypeImpl.java:242)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.LoadChunkIndication.responding(LoadChunkIndication.java:106)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndication.responding(CDOServerIndication.java:134)
at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedOutput(IndicationWithResponse.java:98)
at org.eclipse.net4j.signal.Signal.doOutput(Signal.java:298)
at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:67)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerReadIndication.execute(CDOServerReadIndication.java:36)
I saw this was fixed here https://bugs.eclipse.org/bugs/show_bug.cgi?id=369646
But not clear to me if this is different or the same cause. I am using V4.2.1 of org.eclipse.emf.cdo.server.db in Kepler SR2 using H2, on Java 7 - /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/bin/../jre/lib/server/libjvm.dylib
i.e. A Mac
Here is the code that does the clone prior to the export, it does not return from this method, but the ClassCastException is not caught in it either?
private void clone(final Collection<EObject> eObjects, final IProgressMonitor monitor) throws InvocationTargetException {
SubMonitor subMonitor = SubMonitor.convert(monitor, eObjects.size());
Object value = null;
try {
for (EObject eObject : eObjects) {
EObject eObjectClone = EDMModelFactory.eINSTANCE.create(eObject.eClass());
this.clones.put(eObject, eObjectClone);
for (EAttribute attribute : eObjectClone.eClass().getEAllAttributes()) {
if (!attribute.isDerived()) {
eObjectClone.eSet(attribute, eObject.eGet(attribute));
}
}
Collection<EObject> children = new ArrayList<EObject>();
for (EReference reference : eObjectClone.eClass().getEAllContainments()) {
try {
value = eObject.eGet(reference);
if (reference.isMany()) {
children.addAll((Collection<EObject>) value);
} else {
CollectionUtils.addIgnoreNull(children, value);
}
} catch (ObjectNotFoundException ex) {
//TODO: Remove eObject and all references to it.
throw new InvocationTargetException(ex, NLS.bind("{0}#{1} contains an object that can't be found", Utils.getFullyQualifiedName(eObject), reference.getName())); //$NON-NLS-1$
}
}
this.clone(children, subMonitor.newChild(1));
}
} catch (ClassCastException cce) {
LogPlugin.error(LOG, true, "{0} is not initialized", value.toString()); //$NON-NLS-1$
} finally {
if (monitor != null) {
monitor.done();
}
}
}
Not clear exactly where it fails as it is a large model so cannot single step it and it does not do the catch where I added the ClassCastException in the code above. Any pointers?
[Updated on: Wed, 07 May 2014 14:38] Report message to a moderator
|
|
| | | | | |
Re: [CDO] Old class cast exception resurfaces [message #1403198 is a reply to message #1402966] |
Tue, 22 July 2014 10:16 |
David Wynter Messages: 4624 Registered: July 2009 |
Senior Member |
|
|
Christophe can you drop me an email to my gmail account. My user name is stpdave there. I will have to share a rather large, and private repo with you that exhibits the issue of the corrupt repo with the class cast exception. I will also add a JUnit test case, assume you have a CDO Server implementation to connect to the H2 repo I supply.
Thx
David
[Updated on: Tue, 22 July 2014 12:51] Report message to a moderator
|
|
|
Re: [CDO] Old class cast exception resurfaces [message #1403264 is a reply to message #1403198] |
Tue, 22 July 2014 16:52 |
David Wynter Messages: 4624 Registered: July 2009 |
Senior Member |
|
|
I now have a JUnit test case and repo that have the problem. The repo is 140MB so need to share via a google drive.
...
private CDONet4jSession session;
private CDOTransaction transaction;
private final Map<EObject, EObject> clones = new HashMap<EObject, EObject>();
@Before
public void setUp() throws Exception {
IManagedContainer container = ContainerUtil.createContainer();
Net4jUtil.prepareContainer(container);
TCPUtil.prepareContainer(container);
CDONet4jUtil.prepareContainer(container);
container.activate();
IConnector connector = Net4jUtil.getConnector(container, url);
CDONet4jSessionConfiguration sessionConfiguration = CDONet4jUtil.createNet4jSessionConfiguration();
sessionConfiguration.setConnector(connector);
sessionConfiguration.setRepositoryName(repo);
PasswordCredentialsProvider credentialsProvider = new PasswordCredentialsProvider(login, password);
sessionConfiguration.setCredentialsProvider(credentialsProvider);
try {
this.session = sessionConfiguration.openNet4jSession();
session.options().setGeneratedPackageEmulationEnabled(true);
this.transaction = this.session.openTransaction();
} catch (Exception ex) {
throw new SessionException(url, login, password, repo, ex);
}
}
@After
public void tearDown() throws Exception {
if (this.transaction != null) {
this.transaction.commit();
this.transaction.close();
this.transaction = null;
}
if (this.session != null) {
this.session.close();
this.session = null;
}
}
@Test
public void test() {
CDOResource resource = this.transaction.getResource("resTR");
EList<EObject> contents = resource.getContents();
this.clone(contents);
assert(clones.size()>0);
}
private void clone(Collection<EObject> children2) {
for (EObject eObject : children2) {
EObject eObjectClone = EDMModelFactory.eINSTANCE.create(eObject.eClass());
this.clones.put(eObject, eObjectClone);
for (EAttribute attribute : eObjectClone.eClass().getEAllAttributes()) {
if (!attribute.isDerived()) {
eObjectClone.eSet(attribute, eObject.eGet(attribute));
}
}
Collection<EObject> children = new ArrayList<EObject>();
for (EReference reference : eObjectClone.eClass().getEAllContainments()) {
try {
Object value = eObject.eGet(reference);
if (reference.isMany()) {
children.addAll((Collection<EObject>) value);
} else {
CollectionUtils.addIgnoreNull(children, value);
}
} catch (ObjectNotFoundException ex) {
}
}
this.clone(children);
}
}
}
Any takers?
[Updated on: Wed, 23 July 2014 09:41] Report message to a moderator
|
|
|
Re: [CDO] Old class cast exception resurfaces [message #1404031 is a reply to message #1403264] |
Tue, 29 July 2014 09:09 |
Christophe Bouhier Messages: 937 Registered: July 2009 |
Senior Member |
|
|
On 22-07-14 18:52, David Wynter wrote:
> I now have a JUnit test case and repo that have the problem. The repo is
> 140MB so need to share via a google drive.
Hi David,
Propose you put this in a new Bug and refer to the other bug you
mentioned earlier. Also mention clearly what you observe. ("The problem"
is not enough). People like to see the concise/complete issue in one go,
not spread over multiple emails please. For example, I don't see how
this test case relates to the exception you wrote earlier about.
On the Repo, it might not be needed considering it's size, but if can
provide the details of your configuration, (the cdo-server.xml),the CDO
build you use, also the DB you use, which version etc... could prove
handy. Perhaps also mention your model and EPackages, is it legacy, have
you converted it to CDO?
I notice this:
setGeneratedPackageEmulationEnabled
I never have to set this, but it might be there for a reason? Not sure
what it does.
I also notice in your clone method, you don't really clone (make a
copy), but move objects to the new destination. For Containment
references, this implies the object will not be in the source resource
anymore.
Thank You,
Christophe
>
>
> ..
> private CDONet4jSession session;
> private CDOTransaction transaction;
> private final Map<EObject, EObject> clones = new HashMap<EObject,
> EObject>();
>
> @Before
> public void setUp() throws Exception {
> IManagedContainer container = ContainerUtil.createContainer();
> Net4jUtil.prepareContainer(container);
> TCPUtil.prepareContainer(container);
> CDONet4jUtil.prepareContainer(container);
> container.activate();
>
> IConnector connector = Net4jUtil.getConnector(container, url);
>
> CDONet4jSessionConfiguration sessionConfiguration =
> CDONet4jUtil.createNet4jSessionConfiguration();
> sessionConfiguration.setConnector(connector);
> sessionConfiguration.setRepositoryName(repo);
> PasswordCredentialsProvider credentialsProvider = new
> PasswordCredentialsProvider(login, password);
> sessionConfiguration.setCredentialsProvider(credentialsProvider);
>
> try {
> this.session = sessionConfiguration.openNet4jSession();
> session.options().setGeneratedPackageEmulationEnabled(true);
> this.transaction = this.session.openTransaction();
> } catch (Exception ex) {
> throw new SessionException(url, login, password, repo, ex);
> }
> }
>
> @After
> public void tearDown() throws Exception {
> if (this.transaction != null) {
> this.transaction.commit();
> this.transaction.close();
> this.transaction = null;
> }
> if (this.session != null) {
> this.session.close();
> this.session = null;
> }
> }
>
> @Test
> public void test() {
> CDOResource resource = this.transaction.getResource("resTR");
> EList<EObject> contents = resource.getContents();
> this.clone(contents);
>
> assert(clones.size()>0);
> }
>
> private void clone(Collection<EObject> children2) {
> for (EObject eObject : children2) {
> EObject eObjectClone =
> EDMModelFactory.eINSTANCE.create(eObject.eClass());
> this.clones.put(eObject, eObjectClone);
>
> for (EAttribute attribute :
> eObjectClone.eClass().getEAllAttributes()) {
> if (!attribute.isDerived()) {
> eObjectClone.eSet(attribute, eObject.eGet(attribute));
> }
> }
>
> Collection<EObject> children = new ArrayList<EObject>();
> for (EReference reference :
> eObjectClone.eClass().getEAllContainments()) {
> try {
> Object value = eObject.eGet(reference);
> if (reference.isMany()) {
> children.addAll((Collection<EObject>) value);
> } else {
> CollectionUtils.addIgnoreNull(children, value);
> }
> } catch (ObjectNotFoundException ex) {
> }
> }
>
> this.clone(children);
> }
> }
> }
>
>
> Any takers?
>
>
|
|
|
Re: [CDO] Old class cast exception resurfaces [message #1404033 is a reply to message #1403264] |
Tue, 29 July 2014 09:15 |
Christophe Bouhier Messages: 937 Registered: July 2009 |
Senior Member |
|
|
One more thing, I propose you use the ECoreUtil.Copier method to create
your clone. To rule out your implementation is the culprit.
On 22-07-14 18:52, David Wynter wrote:
> I now have a JUnit test case and repo that have the problem. The repo is
> 140MB so need to share via a google drive.
>
>
> ..
> private CDONet4jSession session;
> private CDOTransaction transaction;
> private final Map<EObject, EObject> clones = new HashMap<EObject,
> EObject>();
>
> @Before
> public void setUp() throws Exception {
> IManagedContainer container = ContainerUtil.createContainer();
> Net4jUtil.prepareContainer(container);
> TCPUtil.prepareContainer(container);
> CDONet4jUtil.prepareContainer(container);
> container.activate();
>
> IConnector connector = Net4jUtil.getConnector(container, url);
>
> CDONet4jSessionConfiguration sessionConfiguration =
> CDONet4jUtil.createNet4jSessionConfiguration();
> sessionConfiguration.setConnector(connector);
> sessionConfiguration.setRepositoryName(repo);
> PasswordCredentialsProvider credentialsProvider = new
> PasswordCredentialsProvider(login, password);
> sessionConfiguration.setCredentialsProvider(credentialsProvider);
>
> try {
> this.session = sessionConfiguration.openNet4jSession();
> session.options().setGeneratedPackageEmulationEnabled(true);
> this.transaction = this.session.openTransaction();
> } catch (Exception ex) {
> throw new SessionException(url, login, password, repo, ex);
> }
> }
>
> @After
> public void tearDown() throws Exception {
> if (this.transaction != null) {
> this.transaction.commit();
> this.transaction.close();
> this.transaction = null;
> }
> if (this.session != null) {
> this.session.close();
> this.session = null;
> }
> }
>
> @Test
> public void test() {
> CDOResource resource = this.transaction.getResource("resTR");
> EList<EObject> contents = resource.getContents();
> this.clone(contents);
>
> assert(clones.size()>0);
> }
>
> private void clone(Collection<EObject> children2) {
> for (EObject eObject : children2) {
> EObject eObjectClone =
> EDMModelFactory.eINSTANCE.create(eObject.eClass());
> this.clones.put(eObject, eObjectClone);
>
> for (EAttribute attribute :
> eObjectClone.eClass().getEAllAttributes()) {
> if (!attribute.isDerived()) {
> eObjectClone.eSet(attribute, eObject.eGet(attribute));
> }
> }
>
> Collection<EObject> children = new ArrayList<EObject>();
> for (EReference reference :
> eObjectClone.eClass().getEAllContainments()) {
> try {
> Object value = eObject.eGet(reference);
> if (reference.isMany()) {
> children.addAll((Collection<EObject>) value);
> } else {
> CollectionUtils.addIgnoreNull(children, value);
> }
> } catch (ObjectNotFoundException ex) {
> }
> }
>
> this.clone(children);
> }
> }
> }
>
>
> Any takers?
>
>
|
|
|
Re: [CDO] Old class cast exception resurfaces [message #1404040 is a reply to message #1404031] |
Tue, 29 July 2014 09:46 |
|
Am 29.07.2014 11:09, schrieb Christophe Bouhier:
> On 22-07-14 18:52, David Wynter wrote:
>> I now have a JUnit test case and repo that have the problem. The repo is
>> 140MB so need to share via a google drive.
> Hi David,
>
> Propose you put this in a new Bug and refer to the other bug you mentioned earlier. Also mention clearly what you
> observe. ("The problem" is not enough). People like to see the concise/complete issue in one go, not spread over
> multiple emails please. For example, I don't see how this test case relates to the exception you wrote earlier about.
>
> On the Repo, it might not be needed considering it's size, but if can provide the details of your configuration, (the
> cdo-server.xml),the CDO build you use, also the DB you use, which version etc... could prove handy. Perhaps also
> mention your model and EPackages, is it legacy, have you converted it to CDO?
David, some more questions:
1) Does this only happen when the server is used by concurrent clients?
2) How exactly do you launch your server? And how exactly do you configure your CDOSessions?
3) In particular, do you use CDOSession.Options.setCollectionLoadingPolicy()? If so, how?
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
>
> I notice this:
>
> setGeneratedPackageEmulationEnabled
>
> I never have to set this, but it might be there for a reason? Not sure what it does.
>
>
> I also notice in your clone method, you don't really clone (make a copy), but move objects to the new destination. For
> Containment references, this implies the object will not be in the source resource anymore.
>
>
> Thank You,
> Christophe
>>
>>
>> ..
>> private CDONet4jSession session;
>> private CDOTransaction transaction;
>> private final Map<EObject, EObject> clones = new HashMap<EObject,
>> EObject>();
>>
>> @Before
>> public void setUp() throws Exception {
>> IManagedContainer container = ContainerUtil.createContainer();
>> Net4jUtil.prepareContainer(container);
>> TCPUtil.prepareContainer(container);
>> CDONet4jUtil.prepareContainer(container);
>> container.activate();
>>
>> IConnector connector = Net4jUtil.getConnector(container, url);
>>
>> CDONet4jSessionConfiguration sessionConfiguration =
>> CDONet4jUtil.createNet4jSessionConfiguration();
>> sessionConfiguration.setConnector(connector);
>> sessionConfiguration.setRepositoryName(repo);
>> PasswordCredentialsProvider credentialsProvider = new
>> PasswordCredentialsProvider(login, password);
>> sessionConfiguration.setCredentialsProvider(credentialsProvider);
>>
>> try {
>> this.session = sessionConfiguration.openNet4jSession();
>> session.options().setGeneratedPackageEmulationEnabled(true);
>> this.transaction = this.session.openTransaction();
>> } catch (Exception ex) {
>> throw new SessionException(url, login, password, repo, ex);
>> }
>> }
>>
>> @After
>> public void tearDown() throws Exception {
>> if (this.transaction != null) {
>> this.transaction.commit();
>> this.transaction.close();
>> this.transaction = null;
>> }
>> if (this.session != null) {
>> this.session.close();
>> this.session = null;
>> }
>> }
>>
>> @Test
>> public void test() {
>> CDOResource resource = this.transaction.getResource("resTR");
>> EList<EObject> contents = resource.getContents();
>> this.clone(contents);
>>
>> assert(clones.size()>0);
>> }
>>
>> private void clone(Collection<EObject> children2) {
>> for (EObject eObject : children2) {
>> EObject eObjectClone =
>> EDMModelFactory.eINSTANCE.create(eObject.eClass());
>> this.clones.put(eObject, eObjectClone);
>>
>> for (EAttribute attribute :
>> eObjectClone.eClass().getEAllAttributes()) {
>> if (!attribute.isDerived()) {
>> eObjectClone.eSet(attribute, eObject.eGet(attribute));
>> }
>> }
>>
>> Collection<EObject> children = new ArrayList<EObject>();
>> for (EReference reference :
>> eObjectClone.eClass().getEAllContainments()) {
>> try {
>> Object value = eObject.eGet(reference);
>> if (reference.isMany()) {
>> children.addAll((Collection<EObject>) value);
>> } else {
>> CollectionUtils.addIgnoreNull(children, value);
>> }
>> } catch (ObjectNotFoundException ex) {
>> }
>> }
>>
>> this.clone(children);
>> }
>> }
>> }
>>
>>
>> Any takers?
>>
>>
>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
| | | |
Re: [CDO] Old class cast exception resurfaces [message #1410329 is a reply to message #1404740] |
Wed, 20 August 2014 12:47 |
David Wynter Messages: 4624 Registered: July 2009 |
Senior Member |
|
|
Christophe,
I have spoken with Eike and while he does not have time to research this problem he believes there is nothing wrong with our repository, but something in it is causing the CDO code to fail. I can share the repo with you from a google drive if you give me your email, mine is stpdave using a gmail account. What is hard to understand is we save the elements in the model as we design them in our environment and everything works for possibly 100 model elements persisted and suddenly persisting (a model element that has had same class saved many times previous) the repository ends up in this state.
To quote Eike - "... the collection size values in the attribute tables are inconsistent with the actual number of associated rows in the *_refs tables. I know that we fixed a very subtle multi-threading issue ~1 year ago that was a little similar (is your data or your server code from that time?). On the other hand, IIRC, there were only two bad states:
1) *More* reference rows than mentioned in the size column. In this case the extra rows were silently ignored. No exception, "just" possibly wrong collection values.
2) *Less* reference rows than mentioned in the size column. In this case there was an exception but it was totally different."
He also said you had a SQL script that might be used to detect errors, can you shares this?
We also switched to the EcoreUtil.copy, it made no difference, except make our code smaller and neater
Thx.
David
|
|
| |
Re: [CDO] Old class cast exception resurfaces [message #1410787 is a reply to message #1410765] |
Thu, 21 August 2014 15:58 |
David Wynter Messages: 4624 Registered: July 2009 |
Senior Member |
|
|
I am now working on the next error we have, different repository. While we can open the repository in our design tool, as soon as we try to expand part of the model in the tree viewer we get the sync error I reported elsewhere
[ERROR 2014-08-21 16:08:58.362 BST] main:com.yambina.mdwmui.MDWMUIWorkbenchAdvisor - Unhandled event loop exception
java.lang.IllegalStateException: Invalid synthetic type: -38
at org.eclipse.emf.cdo.spi.common.revision.RevisionInfo.readResult(RevisionInfo.java:315)
at org.eclipse.emf.cdo.spi.common.revision.RevisionInfo.readResult(RevisionInfo.java:298)
at org.eclipse.emf.cdo.spi.common.revision.RevisionInfo.readResult(RevisionInfo.java:166)
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:97)
at org.eclipse.net4j.signal.RequestWithConfirmation.doExtendedInput(RequestWithConfirmation.java:125)
at org.eclipse.net4j.signal.Signal.doInput(Signal.java:328)
at org.eclipse.net4j.signal.RequestWithConfirmation.doExecute(RequestWithConfirmation.java:105)
at org.eclipse.net4j.signal.SignalActor.execute(SignalActor.java:53)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:253)
at org.eclipse.net4j.signal.SignalProtocol.startSignal(SignalProtocol.java:442)
at org.eclipse.net4j.signal.RequestWithConfirmation.doSend(RequestWithConfirmation.java:89)
at org.eclipse.net4j.signal.RequestWithConfirmation.send(RequestWithConfirmation.java:75)
at org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientProtocol.send(CDOClientProtocol.java:502)
at org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientProtocol.send(CDOClientProtocol.java:535)
at org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientProtocol.loadRevisions(CDOClientProtocol.java:172)
at org.eclipse.emf.cdo.internal.common.revision.CDORevisionManagerImpl.loadRevisions(CDORevisionManagerImpl.java:387)
at org.eclipse.emf.cdo.internal.common.revision.CDORevisionManagerImpl.getRevisions(CDORevisionManagerImpl.java:292)
at org.eclipse.emf.cdo.internal.common.revision.CDORevisionManagerImpl.getRevisions(CDORevisionManagerImpl.java:282)
at org.eclipse.emf.internal.cdo.view.CDOStoreImpl.convertToEMF(CDOStoreImpl.java:652)
at org.eclipse.emf.internal.cdo.view.CDOStoreImpl.toArray(CDOStoreImpl.java:350)
at org.eclipse.emf.internal.cdo.view.CDOStoreImpl.toArray(CDOStoreImpl.java:372)
at org.eclipse.emf.ecore.impl.EStoreEObjectImpl$BasicEStoreEList.delegateToArray(EStoreEObjectImpl.java:309)
at org.eclipse.emf.common.util.DelegatingEList.toArray(DelegatingEList.java:203)
at org.eclipse.emf.ecore.util.DelegatingEcoreEList.toArray(DelegatingEcoreEList.java:338)
at com.yambina.mdwmui.ui.providers.DataContentProvider.getChildren(DataContentProvider.java:125)
at com.yambina.mdwmui.ui.providers.BaseEObjectExplorerContentProvider.getChildren(BaseEObjectExplorerContentProvider.java:142)
at com.yambina.mdwmui.ui.providers.DataContentProvider.getChildren(DataContentProvider.java:1)
at com.yambina.mdwmui.ui.providers.BaseEObjectExplorerContentProvider.hasChildren(BaseEObjectExplorerContentProvider.java:160)
at com.yambina.mdwmui.ui.providers.DataContentProvider.hasChildren(DataContentProvider.java:1)
at org.eclipse.jface.viewers.AbstractTreeViewer.isExpandable(AbstractTreeViewer.java:2146)
at org.eclipse.jface.viewers.TreeViewer.isExpandable(TreeViewer.java:588)
at org.eclipse.jface.viewers.AbstractTreeViewer.isExpandable(AbstractTreeViewer.java:2176)
at org.eclipse.jface.viewers.AbstractTreeViewer.updatePlus(AbstractTreeViewer.java:2858)
at org.eclipse.jface.viewers.TreeViewer.updatePlus(TreeViewer.java:852)
at org.eclipse.jface.viewers.AbstractTreeViewer.createTreeItem(AbstractTreeViewer.java:849)
at org.eclipse.jface.viewers.AbstractTreeViewer$1.run(AbstractTreeViewer.java:823)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.jface.viewers.AbstractTreeViewer.createChildren(AbstractTreeViewer.java:797)
at org.eclipse.jface.viewers.TreeViewer.createChildren(TreeViewer.java:644)
at org.eclipse.jface.viewers.AbstractTreeViewer.createChildren(AbstractTreeViewer.java:768)
at org.eclipse.jface.viewers.AbstractTreeViewer.handleTreeExpand(AbstractTreeViewer.java:1500)
at org.eclipse.jface.viewers.TreeViewer.handleTreeExpand(TreeViewer.java:952)
at org.eclipse.jface.viewers.AbstractTreeViewer$4.treeExpanded(AbstractTreeViewer.java:1511)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:132)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4166)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1466)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1489)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1474)
at org.eclipse.swt.widgets.TreeItem.sendExpand(TreeItem.java:1036)
at org.eclipse.swt.widgets.Tree.expandItem_expandChildren(Tree.java:1253)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5819)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:221)
at org.eclipse.swt.widgets.Widget.mouseDownSuper(Widget.java:1101)
at org.eclipse.swt.widgets.Tree.mouseDownSuper(Tree.java:2044)
at org.eclipse.swt.widgets.Widget.mouseDown(Widget.java:1093)
at org.eclipse.swt.widgets.Control.mouseDown(Control.java:2563)
at org.eclipse.swt.widgets.Tree.mouseDown(Tree.java:2012)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5556)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:221)
at org.eclipse.swt.widgets.Widget.windowSendEvent(Widget.java:2104)
at org.eclipse.swt.widgets.Shell.windowSendEvent(Shell.java:2318)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5620)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
at org.eclipse.swt.widgets.Display.applicationSendEvent(Display.java:5057)
at org.eclipse.swt.widgets.Display.applicationProc(Display.java:5206)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
at org.eclipse.swt.internal.cocoa.NSApplication.sendEvent(NSApplication.java:128)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3648)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:140)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:611)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at com.yambina.mdwmui.MDWMUIApplication.start(MDWMUIApplication.java:44)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
[Updated on: Thu, 21 August 2014 16:17] Report message to a moderator
|
|
|
Re: [CDO] Old class cast exception resurfaces [message #1413455 is a reply to message #1410787] |
Thu, 28 August 2014 14:57 |
David Wynter Messages: 4624 Registered: July 2009 |
Senior Member |
|
|
We tried the ECoreUtil.Copier method but it triggers the notify mechanism (why this occurs when you are copying I have no idea) and that causes:
Caused by: java.lang.UnsupportedOperationException: Unsupported notification received: ADD_MANY - Product.workflow
at com.yambina.edm.commons.platform.listeners.EObjectNotifyChangeListener.checkMany(EObjectNotifyChangeListener.java:247)
at com.yambina.edm.commons.platform.listeners.EObjectNotifyChangeListener.notifyChanged(EObjectNotifyChangeListener.java:88)
at com.yambina.edmmodel.impl.NotifyingAdapter.notifyChanged(NotifyingAdapter.java:56)
at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
at org.eclipse.emf.ecore.util.DelegatingEcoreEList.dispatchNotification(DelegatingEcoreEList.java:355)
at org.eclipse.emf.common.notify.impl.DelegatingNotifyingListImpl.addAllUnique(DelegatingNotifyingListImpl.java:449)
at org.eclipse.emf.common.notify.impl.DelegatingNotifyingListImpl.addAllUnique(DelegatingNotifyingListImpl.java:392)
at org.eclipse.emf.common.util.AbstractEList.addAll(AbstractEList.java:370)
at org.eclipse.emf.ecore.util.DelegatingEcoreEList.set(DelegatingEcoreEList.java:566)
at org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyContainment(EcoreUtil.java:595)
at org.eclipse.emf.ecore.util.EcoreUtil$Copier.copy(EcoreUtil.java:490)
at org.eclipse.emf.ecore.util.EcoreUtil.copy(EcoreUtil.java:357)
at com.yambina.edm.validation.RawExporter.clone(RawExporter.java:97)
at com.yambina.edm.validation.RawExporter.run(RawExporter.java:72)
Still finding the whole CDO mechanism impenetrable. Now I after reverting to our clone code I get this exception when trying to export my model to XMI.
Caused by: java.lang.ArrayStoreException
at org.eclipse.emf.ecore.util.DelegatingEcoreEList.validate(DelegatingEcoreEList.java:147)
at org.eclipse.emf.common.util.DelegatingEList.addUnique(DelegatingEList.java:334)
at org.eclipse.emf.common.notify.impl.DelegatingNotifyingListImpl.doAddUnique(DelegatingNotifyingListImpl.java:379)
at org.eclipse.emf.common.notify.impl.DelegatingNotifyingListImpl.addUnique(DelegatingNotifyingListImpl.java:275)
at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:303)
at com.yambina.edm.validation.RawExporter.maintainAssociations(RawExporter.java:152)
Here is maintainAssociations
private void maintainAssociations(final Collection<EObject> eObjects) throws InvocationTargetException {
for (EObject eObject : eObjects) {
EObject eObjectClone = this.clones.get(eObject);
assert eObjectClone != null;
Collection<EObject> children = new ArrayList<EObject>();
for (EReference reference : eObjectClone.eClass().getEAllReferences()) {
try {
Object value = eObject.eGet(reference);
if (reference.isContainment()) {
if (reference.isMany()) {
children.addAll((Collection<EObject>) value);
} else {
CollectionUtils.addIgnoreNull(children, value);
}
}
if (reference.isMany()) {
Collection<EObject> list = (Collection<EObject>) eObjectClone.eGet(reference);
for (Object object : (Collection<?>) value) {
EObject child = (EObject) object;
EObject childClone = this.clones.get(child);
assert childClone != null;
try {
list.add(childClone); // ArrayStoreException here
} catch (ArrayStoreException ase) {
}
}
} else {
EObject child = (EObject) value;
if (child != null) {
EObject childClone = this.clones.get(child);
assert childClone != null;
eObjectClone.eSet(reference, childClone);
}
}
} catch (ObjectNotFoundException ex) {
this.invalidObjects.add(eObjectClone);
LogPlugin.error(LOG, true, "{0}#{1} references an object that can't be found", Utils.getFullyQualifiedName(eObject), reference.getName()); //$NON-NLS-1$
}
}
this.maintainAssociations(children);
}
}
Here is where the error is found from line 141 of org.eclipse.emf.ecore.util.DelegtingEcoreEList
@Override
protected E validate(int index, E object)
{
super.validate(index, object);
if (object != null && !isInstance(object))
{
throw new ArrayStoreException();
}
return object;
}
protected boolean isInstance(Object object)
{
return getFeatureType().isInstance(object);
}
The featureType is set to our com.yambina.edmmodel.Resource and the object is com.yambina.edmmodel.UUIDImpl I cannot understand how this mismatch occurs.
These 2 classes related where Resource has an attribute ref which in a non containment reference to a BaseModel abstract class that has one attribute, the aforementioned UUID class. Somehow the feature of the Resource class gets set to the related UUID class. Not sure of the formality of the management of Feature related to the Class.
Jump in anyone...
|
|
|
Goto Forum:
Current Time: Thu Sep 26 00:33:02 GMT 2024
Powered by FUDForum. Page generated in 0.07578 seconds
|