Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] ClassCastException: model class cannot be cast to InternalCDORevision
[CDO] ClassCastException: model class cannot be cast to InternalCDORevision [message #431220] Thu, 02 July 2009 16:24 Go to next message
David Stastny is currently offline David StastnyFriend
Messages: 4
Registered: July 2009
Junior Member
This is a multi-part message in MIME format.
--------------040700070709030304020203
Content-Type: text/plain; charset=ISO-8859-2; format=flowed
Content-Transfer-Encoding: 7bit

Hello,
I am experiencing a ClassCastException on a model class when starting a
CDO repository. Stack trace is attached along with some sources.


My setup is Eclipse 3.5.0 (20090619-0625), CDO 3.0.0 (HEAD), Teneo
1.1.0, Hibernate 3.3.1.

Thanks in advance for any hint,
David

--------------040700070709030304020203
Content-Type: text/plain;
name="stack_trace.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="stack_trace.txt"

java.lang.ClassCastException: com.mediasol.contract.crm.impl.ContactPersonImpl cannot be cast to org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision
at org.eclipse.emf.cdo.server.internal.hibernate.HibernateUtil. getCDORevision(HibernateUtil.java:189)
at org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOSy ntheticIdPropertyHandler.get(CDOSyntheticIdPropertyHandler.j ava:58)
at org.hibernate.engine.UnsavedValueFactory.getUnsavedIdentifie rValue(UnsavedValueFactory.java:67)
at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty( PropertyFactory.java:67)
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:147)
at org.hibernate.persister.entity.AbstractEntityPersister.<init >(AbstractEntityPersister.java:457)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init >(SingleTableEntityPersister.java:131)
at org.hibernate.persister.PersisterFactory.createClassPersiste r(PersisterFactory.java:84)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:261)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1327)
at org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore .getHibernateSessionFactory(HibernateStore.java:108)
at org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Accessor.beginHibernateSession(HibernateStoreAccessor.java:1 12)
at org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Accessor.resetHibernateSession(HibernateStoreAccessor.java:9 0)
at org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Accessor.writePackageUnits(HibernateStoreAccessor.java:455)
at org.eclipse.emf.cdo.internal.server.Repository.initSystemPac kages(Repository.java:626)
at org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:592)
at org.eclipse.net4j.util.lifecycle.Lifecycle.activate(Lifecycl e.java:65)
at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:98)
at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:88)
at org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:73)
at com.mediasol.commons.modeling.server.RepositoryService.start (RepositoryService.java:46)
at com.mediasol.commons.application.MediaSolApplication.start(M ediaSolApplication.java:58)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:194)
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(EclipseS tarter.java:368)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
at org.eclipse.equinox.launcher.Main.main(Main.java:1287)

--------------040700070709030304020203
Content-Type: text/plain;
name="RepositoryService.java"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="RepositoryService.java"

package com.mediasol.commons.modeling.server;

import java.net.URL;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;

import org.apache.log4j.Logger;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.cdo.server.CDOServerUtil;
import org.eclipse.emf.cdo.server.IRepository;
import org.eclipse.emf.cdo.server.IRepository.Props;
import org.eclipse.emf.cdo.server.hibernate.CDOHibernateUtil;
import org.eclipse.emf.cdo.server.mem.MEMStoreUtil;
import org.eclipse.net4j.util.container.IPluginContainer;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceException;

import com.mediasol.commons.application.IService;
import com.mediasol.commons.modeling.server.internal.Activator;
import com.mediasol.commons.util.extension.ConfigurationElements;

public class RepositoryService implements IService {

private static final Logger log = Logger.getLogger(RepositoryService.class);

private Set<IRepository> repositories = new HashSet<IRepository>();
private boolean running = false;

public RepositoryService() {
}

@Override
public void start() throws ServiceException {
CDOServerUtil.prepareContainer(IPluginContainer.INSTANCE);

repositories.add(createTestRepository());
for (IConfigurationElement c : ConfigurationElements
.get(Activator.PLUGIN_ID, "repositories")) {
repositories.add(createHibernateRepository(c));
}

for (IRepository r : repositories) {
CDOServerUtil.addRepository(IPluginContainer.INSTANCE, r);
LifecycleUtil.activate(r);
log.info("Activated repository " + r.getName());
}

running = true;
}

private IRepository createTestRepository() {
return CDOServerUtil.createRepository("test",
MEMStoreUtil.createMEMStore(),
new HashMap<String, String>());
}

private IRepository createHibernateRepository(IConfigurationElement c) {
String name = c.getAttribute("name");

HashMap<String, String> props = new HashMap<String, String>();
props.put(Props.SUPPORTING_AUDITS, "false");
props.put(Props.VERIFYING_REVISIONS, "false");
props.put(Props.CURRENT_LRU_CAPACITY, "10000");
props.put(Props.REVISED_LRU_CAPACITY, "10000");
for (IConfigurationElement p : c.getChildren("property")) {
props.put(p.getAttribute("name"), p.getAttribute("value"));
}

HashMap<String, URL> mappings = new HashMap<String, URL>();
for (IConfigurationElement m : ConfigurationElements
.get(Activator.PLUGIN_ID, "mappings")) {
if (name.equals(m.getAttribute("repository"))) {
Bundle bundle = Platform.getBundle(m.getNamespaceIdentifier());
String path = m.getAttribute("path");
URL url = bundle.getEntry(path);
mappings.put(m.getAttribute("package"), url);
}
}
return CDOServerUtil.createRepository(name,
CDOHibernateUtil.createStore(new RepositoryMappingProvider(mappings)),
props);
}

@Override
public void stop() throws ServiceException {
for (IRepository r : repositories) {
LifecycleUtil.deactivate(r);
log.info("Deactivated repository " + r.getName());
}
running = false;
}

@Override
public boolean isStopped() {
return !running;
}
}

--------------040700070709030304020203
Content-Type: text/plain;
name="RepositoryMappingProvider.java"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="RepositoryMappingProvider.java"

LyoqDQogKiANCiAqLw0KcGFja2FnZSBjb20ubWVkaWFzb2wuY29tbW9ucy5t b2RlbGluZy5z
ZXJ2ZXI7DQoNCmltcG9ydCBqYXZhLmlvLklPRXhjZXB0aW9uOw0KaW1wb3J0 IGphdmEubmV0
LlVSTDsNCmltcG9ydCBqYXZhLnV0aWwuTWFwOw0KDQppbXBvcnQgb3JnLmFw YWNoZS5sb2c0
ai5Mb2dnZXI7DQppbXBvcnQgb3JnLmVjbGlwc2UuZW1mLmNkby5zZXJ2ZXIu aGliZXJuYXRl
LklIaWJlcm5hdGVNYXBwaW5nUHJvdmlkZXI7DQppbXBvcnQgb3JnLmVjbGlw c2UuZW1mLmNk
by5zZXJ2ZXIuaGliZXJuYXRlLklIaWJlcm5hdGVTdG9yZTsNCmltcG9ydCBv cmcuZWNsaXBz
ZS5lbWYuZWNvcmUuRVBhY2thZ2U7DQppbXBvcnQgb3JnLmhpYmVybmF0ZS5N YXBwaW5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NCgkJCX0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsNCgkJ CQlsb2cuZXJy
b3IodXJsLnRvU3RyaW5nKCksIGUpOw0KCQkJfQ0KCQkJc3RvcmUuZ2V0UmVw b3NpdG9yeSgp
LmdldFBhY2thZ2VSZWdpc3RyeSgpDQoJCQkucHV0RVBhY2thZ2UoRVBhY2th Z2UuUmVnaXN0
cnkuSU5TVEFOQ0UuZ2V0RVBhY2thZ2UodXJpKSk7DQoJCX0NCgl9DQoNCglA T3ZlcnJpZGUN
CglwdWJsaWMgdm9pZCBzZXRIaWJlcm5hdGVTdG9yZShJSGliZXJuYXRlU3Rv cmUgaGliZXJu
YXRlU3RvcmUpIHsNCgkJc3RvcmUgPSBoaWJlcm5hdGVTdG9yZTsNCgl9DQoN CgkvKioNCgkg
KiBAcmV0dXJuIHRoZSBzdG9yZQ0KCSAqLw0KCXByb3RlY3RlZCBJSGliZXJu YXRlU3RvcmUg
Z2V0SGliZXJuYXRlU3RvcmUoKSB7DQoJCXJldHVybiBzdG9yZTsNCgl9DQp9
--------------040700070709030304020203--
Re: [CDO] ClassCastException: model class cannot be cast to InternalCDORevision [message #431221 is a reply to message #431220] Thu, 02 July 2009 17:06 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6457
Registered: July 2009
Senior Member
David,

Please file a bugzilla with these infos. I'm not sure yet if it's a bug
but it's easier to track poblems there ;-)

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper



David Stastny schrieb:
> Hello,
> I am experiencing a ClassCastException on a model class when starting
> a CDO repository. Stack trace is attached along with some sources.
>
>
> My setup is Eclipse 3.5.0 (20090619-0625), CDO 3.0.0 (HEAD), Teneo
> 1.1.0, Hibernate 3.3.1.
>
> Thanks in advance for any hint,
> David


Re: [CDO] ClassCastException: model class cannot be cast to InternalCDORevision [message #431227 is a reply to message #431221] Fri, 03 July 2009 08:07 Go to previous message
David Stastny is currently offline David StastnyFriend
Messages: 4
Registered: July 2009
Junior Member
Filed as http://bugs.eclipse.org/bugs/show_bug.cgi?id=282346
Previous Topic:saving properties
Next Topic:"Cannot complete the request."
Goto Forum:
  


Current Time: Sat Dec 14 07:15:55 GMT 2019

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

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

Back to the top