Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » [CDO-Teneo-Hibernate] Experience report and errors: Migrating from classic MySQLAdapter-backed store
[CDO-Teneo-Hibernate] Experience report and errors: Migrating from classic MySQLAdapter-backed store [message #119871] |
Thu, 24 April 2008 15:26 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Stefan Winkler![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=stefan%40winklerweb.net) Messages: 307 Registered: July 2009 Location: Germany |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------090702010608040506070406
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Hi,
since I had to convince some of the components of working together, I'll
report my steps and experiences here:
Since I did not have any official guide on how to set up everything, I
just did trial and error. So please comment, if there is any easier or
more conformant way of getting CDO-Hibernate to run...
- Downloaded Eclipse-3.4M6-modeling
- [added my favourite plugins - subversive, java2html, keepresident]
- [Create a working set for the sources of CDO etc. to keep them in one
place]
- CVS checkout of everything in
:pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
org.eclipse.emf.cdo > plugins
- CVS checkout of everything in
:pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
org.eclipse.emf.cdo > hibernate
[@Eike: there are two (conflicting) folders
org.eclipse.emf.cdo.server.hibernate one in plugins, one in hibernate]
- CVS checkout of everything in
:pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
org.eclipse.emf.cdo > tests
- CVS checkout of everything in
:pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
org.eclipse.emf.net4j > plugins
- CVS checkout of following projects in
:pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
org.eclipse.emf.teneo > plugins
* org.eclipse.emf.teneo
* org.eclipse.emf.teneo.annotations
* org.eclipse.emf.teneo.hibernate.mapper
- get hold of these libraries:
* hibernate3.jar
* asm.jar
* cglib-2.1.3.jar
* commons-collections-2.1.1.jar
* commons-logging-1.0.4.jar
* dom4j-1.6.1.jar
* jta.jar
* mysql-connector-java-5.1.5-bin.jar
* hsqldb.jar
- copy hsqldb.jar to org.eclipse.net4j.db.hsqldb/lib
- copy mysql-connector-java-5.1.5-bin.jar to org.eclipse.net4j.db.mysql/lib
- copy mysql-connector-java-5.1.5-bin.jar to
org.eclipse.emf.cdo.tests.hibernate
- copy the following libraries to
org.eclipse.emf.cdo.server.hibernate.libraries/lib
* hibernate3.jar
* asm.jar
* cglib-2.1.3.jar
* commons-collections-2.1.1.jar
* commons-logging-1.0.4.jar
* dom4j-1.6.1.jar
* jta.jar
* hsqldb.jar
- copy the following libraries to org.eclipse.emf.teneo.hibernate.mapper:
* hibernate3.jar
* dom4j-1.6.1.jar
- Try out new store with small test case:
|IManagedContainer container = IPluginContainer.INSTANCE;
acceptor = JVMUtil.getAcceptor(container, "default");
store = *new *HibernateStore(*new *TeneoHibernateMappingProvider());
Map<String, String> props = *new *HashMap<String, String>();
props.put(Props.PROP_OVERRIDE_UUID, "f8188187-65de-4c8a-8e75-e0ce5949837a");
props.put(Props.PROP_SUPPORTING_AUDITS, "false");
props.put(Props.PROP_SUPPORTING_REVISION_DELTAS, "false");
props.put(Props.PROP_VERIFYING_REVISIONS, "false");
props.put(Props.PROP_CURRENT_LRU_CAPACITY, "10000");
props.put(Props.PROP_REVISED_LRU_CAPACITY, "10000");
props.put("hibernate.connection.autocommit","true");
props.put("hibernate.cache.provider_class","=org.hibernate.cache.HashtableCacheProvider ");
props.put("hibernate.connection.driver_class","com.mysql.jdbc.Driver ");
props.put("hibernate.connection.url","jdbc:mysql://localhost:3306/" + DB_NAME);
props.put("hibernate.connection.username", DB_USER);
props.put("hibernate.connection.password", DB_PASS);
props.put("hibernate.dialect","org.hibernate.dialect.MySQLInnoDBDialect ");
repository = CDOServerUtil.createRepository(repositoryName, store,
props);
CDOServerUtil.addRepository(container, repository);
connector = JVMUtil.getConnector(container, "default");
session = CDOUtil.openSession(connector, repositoryName,
*true*);
transaction = session.openTransaction();
session.getPackageRegistry().putEPackage(ArtifactBasePackage .eINSTANCE);
session.getPackageRegistry().putEPackage(RequipsePackage.eIN STANCE);
session.getPackageRegistry().putEPackage(WeightedLinksPackag e.eINSTANCE);
resource = transaction.getOrCreateResource(RESOURCE_PATH);
// etc ... (put stuff into repository)
|
=> I can't get hibernate to find the mysql driver class. Tried putting
mysql-connector-java-5.1.5-bin.jar in my test plugin, tried exporting
packages and using Eclipse-BuddyPolicy: dependent but no success.
=> temp solution: add mysql-connector-java-5.1.5-bin.jar to
org.eclipse.emf.cdo.server.hibernate.libraries project and add it to
that Bundle-ClassPath
=> class is now found
- next error is
24.04.2008 16:58:54 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
FATAL: could not complete schema update
org.hibernate.MappingException: Could not determine type for:
org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOTy peUserType,
at table: cdo_features, for columns: [org.hibernate.mapping.Column(type)]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 69)
at org.hibernate.mapping.Column.getSqlTypeCode(Column.java:138)
at org.hibernate.mapping.Column.getSqlType(Column.java:182)
at org.hibernate.mapping.Table.sqlCreateString(Table.java:397)
at
org.hibernate.cfg.Configuration.generateSchemaUpdateScript(C onfiguration.java:962)
at
org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate .java:140)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.initSchema(HibernatePackageHandler.java:346)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.doActivate(HibernatePackageHandler.java:307)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore .doActivate(HibernateStore.java:205)
at
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
at
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
at
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
at
org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:262)
at
org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:250)
at
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
at
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
at
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
at
org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
Giving up for today - maybe this error is familiar to someone? Eike? Martin?
to be continued ...
--------------090702010608040506070406
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
<br>
since I had to convince some of the components of working together,
I'll report my steps and experiences here:<br>
Since I did not have any official guide on how to set up everything, I
just did trial and error. So please comment, if there is any easier or
more conformant way of getting CDO-Hibernate to run...<br>
<br>
- Downloaded Eclipse-3.4M6-modeling<br>
- [added my favourite plugins - subversive, java2html, keepresident]<br>
- [Create a working set for the sources of CDO etc. to keep them in one
place]<br>
- CVS checkout of everything in
:pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD >
org.eclipse.emf > org.eclipse.emf.cdo > plugins<br>
- CVS checkout of everything in
:pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD >
org.eclipse.emf > org.eclipse.emf.cdo > hibernate<br>
|
|
|
Re: [CDO-Teneo-Hibernate] Experience report and errors: Migrating from classic MySQLAdapter-backed s [message #119901 is a reply to message #119871] |
Thu, 24 April 2008 16:08 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Martin Taal![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=mtaal%40springsite.com) Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Stefan,
See comments below/inline marked with MT>>.
Btw, here is a small first page on the cdo-teneo-hibernate integration, it is maybe not complete and
afaics you already know most of it:
http://www.elver.org/hibernate/cdo.html
gr. Martin
Stefan Winkler wrote:
> Hi,
>
> since I had to convince some of the components of working together, I'll
> report my steps and experiences here:
> Since I did not have any official guide on how to set up everything, I
> just did trial and error. So please comment, if there is any easier or
> more conformant way of getting CDO-Hibernate to run...
>
> - Downloaded Eclipse-3.4M6-modeling
> - [added my favourite plugins - subversive, java2html, keepresident]
> - [Create a working set for the sources of CDO etc. to keep them in one
> place]
> - CVS checkout of everything in
> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
> org.eclipse.emf.cdo > plugins
> - CVS checkout of everything in
> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
> org.eclipse.emf.cdo > hibernate
> [@Eike: there are two (conflicting) folders
> org.eclipse.emf.cdo.server.hibernate one in plugins, one in hibernate]
MT>> You should take the ones from the hibernate folder
> - CVS checkout of everything in
> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
> org.eclipse.emf.cdo > tests
> - CVS checkout of everything in
> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
> org.eclipse.emf.net4j > plugins
> - CVS checkout of following projects in
> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
> org.eclipse.emf.teneo > plugins
> * org.eclipse.emf.teneo
> * org.eclipse.emf.teneo.annotations
> * org.eclipse.emf.teneo.hibernate.mapper
MT>> I think you also need org.eclipse.emf.teneo.libraries
> - get hold of these libraries:
> * hibernate3.jar
> * asm.jar
> * cglib-2.1.3.jar
> * commons-collections-2.1.1.jar
> * commons-logging-1.0.4.jar
> * dom4j-1.6.1.jar
> * jta.jar
> * mysql-connector-java-5.1.5-bin.jar
> * hsqldb.jar
> - copy hsqldb.jar to org.eclipse.net4j.db.hsqldb/lib
MT>> org.eclipse.net4j.db.hsqldb is not used in the teneo-hibernate integration
> - copy mysql-connector-java-5.1.5-bin.jar to org.eclipse.net4j.db.mysql/lib
MT>> org.eclipse.net4j.db.mysql is not used in the teneo-hibernate integration
> - copy mysql-connector-java-5.1.5-bin.jar to
> org.eclipse.emf.cdo.tests.hibernate
MT>> should be to the lib directory in this plugin
> - copy the following libraries to
> org.eclipse.emf.cdo.server.hibernate.libraries/lib
> * hibernate3.jar
> * asm.jar
> * cglib-2.1.3.jar
> * commons-collections-2.1.1.jar
> * commons-logging-1.0.4.jar
> * dom4j-1.6.1.jar
> * jta.jar
> * hsqldb.jar
> - copy the following libraries to org.eclipse.emf.teneo.hibernate.mapper:
> * hibernate3.jar
> * dom4j-1.6.1.jar
MT>> It should not be necessary to copy jars to org.eclipse.emf.teneo.hibernate.mapper
>
> - Try out new store with small test case:
>
> |IManagedContainer container = IPluginContainer.INSTANCE;
> acceptor = JVMUtil.getAcceptor(container, "default");
>
> store = *new *HibernateStore(*new *TeneoHibernateMappingProvider());
>
> Map<String, String> props = *new *HashMap<String, String>();
> props.put(Props.PROP_OVERRIDE_UUID, "f8188187-65de-4c8a-8e75-e0ce5949837a");
> props.put(Props.PROP_SUPPORTING_AUDITS, "false");
> props.put(Props.PROP_SUPPORTING_REVISION_DELTAS, "false");
> props.put(Props.PROP_VERIFYING_REVISIONS, "false");
> props.put(Props.PROP_CURRENT_LRU_CAPACITY, "10000");
> props.put(Props.PROP_REVISED_LRU_CAPACITY, "10000");
>
> props.put("hibernate.connection.autocommit","true");
> props.put("hibernate.cache.provider_class","=org.hibernate.cache.HashtableCacheProvider ");
> props.put("hibernate.connection.driver_class","com.mysql.jdbc.Driver ");
> props.put("hibernate.connection.url","jdbc:mysql://localhost:3306/" + DB_NAME);
> props.put("hibernate.connection.username", DB_USER);
> props.put("hibernate.connection.password", DB_PASS);
> props.put("hibernate.dialect","org.hibernate.dialect.MySQLInnoDBDialect ");
>
> repository = CDOServerUtil.createRepository(repositoryName, store,
> props);
>
>
> CDOServerUtil.addRepository(container, repository);
>
> connector = JVMUtil.getConnector(container, "default");
> session = CDOUtil.openSession(connector, repositoryName,
> *true*);
> transaction = session.openTransaction();
> session.getPackageRegistry().putEPackage(ArtifactBasePackage .eINSTANCE);
> session.getPackageRegistry().putEPackage(RequipsePackage.eIN STANCE);
> session.getPackageRegistry().putEPackage(WeightedLinksPackag e.eINSTANCE);
>
> resource = transaction.getOrCreateResource(RESOURCE_PATH);
>
> // etc ... (put stuff into repository)
>
> |
>
>
> => I can't get hibernate to find the mysql driver class. Tried putting
> mysql-connector-java-5.1.5-bin.jar in my test plugin, tried exporting
> packages and using Eclipse-BuddyPolicy: dependent but no success.
MT>> In which plugin did you set dependent? It should be in the one with the hibernate libraries
The mysql jar must be in the lib directory of the hibernate.test plugin
> => temp solution: add mysql-connector-java-5.1.5-bin.jar to
> org.eclipse.emf.cdo.server.hibernate.libraries project and add it to
> that Bundle-ClassPath
MT>> Yes this is also fine
> => class is now found
>
> - next error is
> 24.04.2008 16:58:54 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
> FATAL: could not complete schema update
> org.hibernate.MappingException: Could not determine type for:
> org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOTy peUserType,
> at table: cdo_features, for columns: [org.hibernate.mapping.Column(type)]
> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 69)
> at org.hibernate.mapping.Column.getSqlTypeCode(Column.java:138)
> at org.hibernate.mapping.Column.getSqlType(Column.java:182)
> at org.hibernate.mapping.Table.sqlCreateString(Table.java:397)
> at
> org.hibernate.cfg.Configuration.generateSchemaUpdateScript(C onfiguration.java:962)
> at
> org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate .java:140)
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.initSchema(HibernatePackageHandler.java:346)
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.doActivate(HibernatePackageHandler.java:307)
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore .doActivate(HibernateStore.java:205)
> at
> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
> at
> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
> at
> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
> at
> org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:262)
> at
> org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:250)
> at
> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
> at
> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
> at
> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
> at
> org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
>
> Giving up for today - maybe this error is familiar to someone? Eike? Martin?
MT>> Do you have this class (org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOT ypeUserType)
in the org.eclipse.emf.cdo.server.hibernate plugin?
>
> to be continued ...
>
>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Re: [CDO-Teneo-Hibernate] Experience report and errors: Migrating from classic M [message #119952 is a reply to message #119901] |
Fri, 25 April 2008 07:32 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
|
Hi Martin,
Great intro! As usual I'm behind with my docs ;-( But I promise that I'lll
work on them when my current customer engagement ends mid of May...
Cheers
/Eike
Martin Taal wrote:
> Hi Stefan,
> See comments below/inline marked with MT>>.
> Btw, here is a small first page on the cdo-teneo-hibernate integration, it
is maybe not complete and
> afaics you already know most of it:
> http://www.elver.org/hibernate/cdo.html
> gr. Martin
> Stefan Winkler wrote:
>> Hi,
>>
>> since I had to convince some of the components of working together, I'll
>> report my steps and experiences here:
>> Since I did not have any official guide on how to set up everything, I
>> just did trial and error. So please comment, if there is any easier or
>> more conformant way of getting CDO-Hibernate to run...
>>
>> - Downloaded Eclipse-3.4M6-modeling
>> - [added my favourite plugins - subversive, java2html, keepresident]
>> - [Create a working set for the sources of CDO etc. to keep them in one
>> place]
>> - CVS checkout of everything in
>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
>> org.eclipse.emf.cdo > plugins
>> - CVS checkout of everything in
>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
>> org.eclipse.emf.cdo > hibernate
>> [@Eike: there are two (conflicting) folders
>> org.eclipse.emf.cdo.server.hibernate one in plugins, one in hibernate]
> MT>> You should take the ones from the hibernate folder
>> - CVS checkout of everything in
>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
>> org.eclipse.emf.cdo > tests
>> - CVS checkout of everything in
>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
>> org.eclipse.emf.net4j > plugins
>> - CVS checkout of following projects in
>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
>> org.eclipse.emf.teneo > plugins
>> * org.eclipse.emf.teneo
>> * org.eclipse.emf.teneo.annotations
>> * org.eclipse.emf.teneo.hibernate.mapper
> MT>> I think you also need org.eclipse.emf.teneo.libraries
>> - get hold of these libraries:
>> * hibernate3.jar
>> * asm.jar
>> * cglib-2.1.3.jar
>> * commons-collections-2.1.1.jar
>> * commons-logging-1.0.4.jar
>> * dom4j-1.6.1.jar
>> * jta.jar
>> * mysql-connector-java-5.1.5-bin.jar
>> * hsqldb.jar
>> - copy hsqldb.jar to org.eclipse.net4j.db.hsqldb/lib
> MT>> org.eclipse.net4j.db.hsqldb is not used in the teneo-hibernate
integration
>> - copy mysql-connector-java-5.1.5-bin.jar to org.eclipse.net4j.db.mysql/lib
> MT>> org.eclipse.net4j.db.mysql is not used in the teneo-hibernate
integration
>> - copy mysql-connector-java-5.1.5-bin.jar to
>> org.eclipse.emf.cdo.tests.hibernate
> MT>> should be to the lib directory in this plugin
>> - copy the following libraries to
>> org.eclipse.emf.cdo.server.hibernate.libraries/lib
>> * hibernate3.jar
>> * asm.jar
>> * cglib-2.1.3.jar
>> * commons-collections-2.1.1.jar
>> * commons-logging-1.0.4.jar
>> * dom4j-1.6.1.jar
>> * jta.jar
>> * hsqldb.jar
>> - copy the following libraries to org.eclipse.emf.teneo.hibernate.mapper:
>> * hibernate3.jar
>> * dom4j-1.6.1.jar
> MT>> It should not be necessary to copy jars to
org.eclipse.emf.teneo.hibernate.mapper
>>
>> - Try out new store with small test case:
>>
>> |IManagedContainer container = IPluginContainer.INSTANCE;
>> acceptor = JVMUtil.getAcceptor(container, "default");
>>
>> store = *new *HibernateStore(*new *TeneoHibernateMappingProvider());
>>
>> Map<String, String> props = *new *HashMap<String, String>();
>> props.put(Props.PROP_OVERRIDE_UUID,
"f8188187-65de-4c8a-8e75-e0ce5949837a");
>> props.put(Props.PROP_SUPPORTING_AUDITS, "false");
>> props.put(Props.PROP_SUPPORTING_REVISION_DELTAS, "false");
>> props.put(Props.PROP_VERIFYING_REVISIONS, "false");
>> props.put(Props.PROP_CURRENT_LRU_CAPACITY, "10000");
>> props.put(Props.PROP_REVISED_LRU_CAPACITY, "10000");
>>
>> props.put("hibernate.connection.autocommit","true");
>>
props.put("hibernate.cache.provider_class","=org.hibernate.cache.HashtableCacheProvider ");
>> props.put("hibernate.connection.driver_class","com.mysql.jdbc.Driver ");
>> props.put("hibernate.connection.url","jdbc:mysql://localhost:3306/" +
DB_NAME);
>> props.put("hibernate.connection.username", DB_USER);
>> props.put("hibernate.connection.password", DB_PASS);
>>
props.put("hibernate.dialect","org.hibernate.dialect.MySQLInnoDBDialect ");
>>
>> repository = CDOServerUtil.createRepository(repositoryName, store,
>> props);
>>
>>
>> CDOServerUtil.addRepository(container, repository);
>>
>> connector = JVMUtil.getConnector(container, "default");
>> session = CDOUtil.openSession(connector, repositoryName,
>> *true*);
>> transaction = session.openTransaction();
>> session.getPackageRegistry().putEPackage(ArtifactBasePackage .eINSTANCE);
>> session.getPackageRegistry().putEPackage(RequipsePackage.eIN STANCE);
>>
session.getPackageRegistry().putEPackage(WeightedLinksPackag e.eINSTANCE);
>>
>> resource = transaction.getOrCreateResource(RESOURCE_PATH);
>>
>> // etc ... (put stuff into repository)
>>
>> |
>>
>>
>> => I can't get hibernate to find the mysql driver class. Tried putting
>> mysql-connector-java-5.1.5-bin.jar in my test plugin, tried exporting
>> packages and using Eclipse-BuddyPolicy: dependent but no success.
> MT>> In which plugin did you set dependent? It should be in the one with the
hibernate libraries
> The mysql jar must be in the lib directory of the hibernate.test plugin
>> => temp solution: add mysql-connector-java-5.1.5-bin.jar to
>> org.eclipse.emf.cdo.server.hibernate.libraries project and add it to
>> that Bundle-ClassPath
> MT>> Yes this is also fine
>> => class is now found
>>
>> - next error is
>> 24.04.2008 16:58:54 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
>> FATAL: could not complete schema update
>> org.hibernate.MappingException: Could not determine type for:
>> org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOTy peUserType,
>> at table: cdo_features, for columns: [org.hibernate.mapping.Column(type)]
>> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 69)
>> at org.hibernate.mapping.Column.getSqlTypeCode(Column.java:138)
>> at org.hibernate.mapping.Column.getSqlType(Column.java:182)
>> at org.hibernate.mapping.Table.sqlCreateString(Table.java:397)
>> at
>>
org.hibernate.cfg.Configuration.generateSchemaUpdateScript(C onfiguration.java:962)
>> at
>> org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate .java:140)
>> at
>>
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.initSchema(HibernatePackageHandler.java:346)
>> at
>>
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.doActivate(HibernatePackageHandler.java:307)
>> at
>>
org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore .doActivate(HibernateStore.java:205)
>> at
>>
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>> at
>>
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
>> at
>>
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
>> at
>>
org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:262)
>> at
>>
org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:250)
>> at
>>
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>> at
>>
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
>> at
>>
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
>> at
>>
org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
>>
>> Giving up for today - maybe this error is familiar to someone? Eike? Martin?
> MT>> Do you have this class
(org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOT ypeUserType)
> in the org.eclipse.emf.cdo.server.hibernate plugin?
>>
>> to be continued ...
>>
>>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: [CDO-Teneo-Hibernate] Experience report and errors: Migrating from classic M [message #119965 is a reply to message #119871] |
Fri, 25 April 2008 07:48 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
|
Hi Stefan,
You seem to have invested a lot of time to make it run. Most of the steps
you describe look necessary and appropriate to me.
As soon as I have more time available again I plan to create a space in
the wiki where users can persist reports about their experiences.
More comments inline...
Cheers
/Eike
Stefan Winkler wrote:
> Hi,
> since I had to convince some of the components of working together, I'll
> report my steps and experiences here:
> Since I did not have any official guide on how to set up everything, I
> just did trial and error. So please comment, if there is any easier or
> more conformant way of getting CDO-Hibernate to run...
> - Downloaded Eclipse-3.4M6-modeling
Interesting, will have to look at this one. I remember that once there was
a discussion whether the incubating components (like net4j, cdo and teneo)
can become part of this distro. Will put this on my list ;-)
> - [added my favourite plugins - subversive, java2html, keepresident]
keepresident sounds like a clever toy!
> - [Create a working set for the sources of CDO etc. to keep them in one
> place]
> - CVS checkout of everything in
> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
> org.eclipse.emf.cdo > plugins
> - CVS checkout of everything in
> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
> org.eclipse.emf.cdo > hibernate
> [@Eike: there are two (conflicting) folders
> org.eclipse.emf.cdo.server.hibernate one in plugins, one in hibernate]
The one in plugins/ is obsolete since Martin joined the component as a
committer and I moved everything to the hibernate/ folder. Are both
folders non-empty in HEAD? If yes, could you please file a Bugzilla so
that I won't forget about it during the weekend?
> - CVS checkout of everything in
> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
> org.eclipse.emf.cdo > tests
> - CVS checkout of everything in
> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
> org.eclipse.emf.net4j > plugins
> - CVS checkout of following projects in
> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
> org.eclipse.emf.teneo > plugins
> * org.eclipse.emf.teneo
> * org.eclipse.emf.teneo.annotations
> * org.eclipse.emf.teneo.hibernate.mapper
> - get hold of these libraries:
> * hibernate3.jar
> * asm.jar
> * cglib-2.1.3.jar
> * commons-collections-2.1.1.jar
> * commons-logging-1.0.4.jar
> * dom4j-1.6.1.jar
> * jta.jar
> * mysql-connector-java-5.1.5-bin.jar
> * hsqldb.jar
> - copy hsqldb.jar to org.eclipse.net4j.db.hsqldb/lib
> - copy mysql-connector-java-5.1.5-bin.jar to org.eclipse.net4j.db.mysql/lib
> - copy mysql-connector-java-5.1.5-bin.jar to
> org.eclipse.emf.cdo.tests.hibernate
> - copy the following libraries to
> org.eclipse.emf.cdo.server.hibernate.libraries/lib
> * hibernate3.jar
> * asm.jar
> * cglib-2.1.3.jar
> * commons-collections-2.1.1.jar
> * commons-logging-1.0.4.jar
> * dom4j-1.6.1.jar
> * jta.jar
> * hsqldb.jar
> - copy the following libraries to org.eclipse.emf.teneo.hibernate.mapper:
> * hibernate3.jar
> * dom4j-1.6.1.jar
Oh yes, this non-EPL 3rd party library stuff is really annoying!! If only
the platform itself had a mechanism to automatically provision such
dependencies ;-(
> - Try out new store with small test case:
> |IManagedContainer container = IPluginContainer.INSTANCE;
> acceptor = JVMUtil.getAcceptor(container, "default");
> store = *new *HibernateStore(*new *TeneoHibernateMappingProvider());
> Map<String, String> props = *new *HashMap<String, String>();
> props.put(Props.PROP_OVERRIDE_UUID,
"f8188187-65de-4c8a-8e75-e0ce5949837a");
> props.put(Props.PROP_SUPPORTING_AUDITS, "false");
> props.put(Props.PROP_SUPPORTING_REVISION_DELTAS, "false");
> props.put(Props.PROP_VERIFYING_REVISIONS, "false");
> props.put(Props.PROP_CURRENT_LRU_CAPACITY, "10000");
> props.put(Props.PROP_REVISED_LRU_CAPACITY, "10000");
> props.put("hibernate.connection.autocommit","true");
>
props.put("hibernate.cache.provider_class","=org.hibernate.cache.HashtableCacheProvider ");
> props.put("hibernate.connection.driver_class","com.mysql.jdbc.Driver ");
> props.put("hibernate.connection.url","jdbc:mysql://localhost:3306/" +
DB_NAME);
> props.put("hibernate.connection.username", DB_USER);
> props.put("hibernate.connection.password", DB_PASS);
>
props.put("hibernate.dialect","org.hibernate.dialect.MySQLInnoDBDialect ");
> repository = CDOServerUtil.createRepository(repositoryName, store,
> props);
> CDOServerUtil.addRepository(container, repository);
> connector = JVMUtil.getConnector(container, "default");
> session = CDOUtil.openSession(connector, repositoryName,
> *true*);
> transaction = session.openTransaction();
> session.getPackageRegistry().putEPackage(ArtifactBasePackage .eINSTANCE);
> session.getPackageRegistry().putEPackage(RequipsePackage.eIN STANCE);
> session.getPackageRegistry().putEPackage(WeightedLinksPackag e.eINSTANCE);
> resource = transaction.getOrCreateResource(RESOURCE_PATH);
> // etc ... (put stuff into repository)
> |
Looks ok to me.
Please notice that with the latest sources you can't register subpackages
directly anymore. They're autpomatically registered along with their top
level packages! Just in case...
> => I can't get hibernate to find the mysql driver class. Tried putting
> mysql-connector-java-5.1.5-bin.jar in my test plugin, tried exporting
> packages and using Eclipse-BuddyPolicy: dependent but no success.
> => temp solution: add mysql-connector-java-5.1.5-bin.jar to
> org.eclipse.emf.cdo.server.hibernate.libraries project and add it to
> that Bundle-ClassPath
> => class is now found
Maybe we can create a fragment for the net4j.db plugin (which contains
several jdbc drivers via adapter fragments) that adds an additional
dependency on the hibernate.mapper plugin, so that the BuddyPolicy will
make the driver jars visible. Martin?
> - next error is
> 24.04.2008 16:58:54 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
> FATAL: could not complete schema update
> org.hibernate.MappingException: Could not determine type for:
> org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOTy peUserType,
> at table: cdo_features, for columns: [org.hibernate.mapping.Column(type)]
> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 69)
> at org.hibernate.mapping.Column.getSqlTypeCode(Column.java:138)
> at org.hibernate.mapping.Column.getSqlType(Column.java:182)
> at org.hibernate.mapping.Table.sqlCreateString(Table.java:397)
> at
>
org.hibernate.cfg.Configuration.generateSchemaUpdateScript(C onfiguration.java:962)
> at
> org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate .java:140)
> at
>
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.initSchema(HibernatePackageHandler.java:346)
> at
>
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.doActivate(HibernatePackageHandler.java:307)
> at
>
org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore .doActivate(HibernateStore.java:205)
> at
>
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
> at
>
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
> at
>
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
> at
>
org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:262)
> at
>
org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:250)
> at
>
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
> at
>
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
> at
>
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
> at
> org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
> Giving up for today - maybe this error is familiar to someone? Eike? Martin?
> to be continued ...
This looks like a pure Hibernate problem and I guess it's best to wait for
Martin's analysis ;-)
Happy persisting!
/Eike
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: [CDO-Teneo-Hibernate] Experience report and errors: Migrating from classic MySQLAdapter-backed s [message #120124 is a reply to message #119901] |
Fri, 25 April 2008 15:02 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Stefan Winkler![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=stefan%40winklerweb.net) Messages: 307 Registered: July 2009 Location: Germany |
Senior Member |
|
|
Hi,
today, I learned that Eclipse is always good for some extra fun.
For some reason it deleted the
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
from the .classpath file in all project in my workspace. It is creepy
when Eclipse does not find a single dependency anymore.
Luckily I was able to locate the problem after some time - so now I am
back and ready to proceed.
Thanks, Martin, for all your comments. As you might have guessed, most
errors I wrote were simple typos / paste errors:
>> Hi,
>>
>> since I had to convince some of the components of working together,
>> I'll report my steps and experiences here:
>> Since I did not have any official guide on how to set up everything,
>> I just did trial and error. So please comment, if there is any easier
>> or more conformant way of getting CDO-Hibernate to run...
>>
>> - Downloaded Eclipse-3.4M6-modeling
>> - [added my favourite plugins - subversive, java2html, keepresident]
>> - [Create a working set for the sources of CDO etc. to keep them in
>> one place]
>> - CVS checkout of everything in
>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>> > org.eclipse.emf.cdo > plugins
>> - CVS checkout of everything in
>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>> > org.eclipse.emf.cdo > hibernate
>> [@Eike: there are two (conflicting) folders
>> org.eclipse.emf.cdo.server.hibernate one in plugins, one in hibernate]
> MT>> You should take the ones from the hibernate folder
Sure - this was just to report that it could cause misunderstandings.
@Eike: the folder in plugins is empty, you just get a conflict, if you
try to check out everything at once because of two folders / projects
with the same name.
>> - CVS checkout of everything in
>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>> > org.eclipse.emf.cdo > tests
>> - CVS checkout of everything in
>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>> > org.eclipse.emf.net4j > plugins
>> - CVS checkout of following projects in
>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>> > org.eclipse.emf.teneo > plugins
>> * org.eclipse.emf.teneo
>> * org.eclipse.emf.teneo.annotations
>> * org.eclipse.emf.teneo.hibernate.mapper
> MT>> I think you also need org.eclipse.emf.teneo.libraries
Mhh .. it is not required and AFAIK there's only commons-logging.jar in
there, which has to be copied into
org.eclipse.emf.cdo.server.hibernate.libraries/lib anyway.
>> - get hold of these libraries:
>> * hibernate3.jar
>> * asm.jar
>> * cglib-2.1.3.jar
>> * commons-collections-2.1.1.jar
>> * commons-logging-1.0.4.jar
>> * dom4j-1.6.1.jar
>> * jta.jar
>> * mysql-connector-java-5.1.5-bin.jar
>> * hsqldb.jar
>> - copy hsqldb.jar to org.eclipse.net4j.db.hsqldb/lib
> MT>> org.eclipse.net4j.db.hsqldb is not used in the teneo-hibernate
> integration
>
>> - copy mysql-connector-java-5.1.5-bin.jar to
>> org.eclipse.net4j.db.mysql/lib
> MT>> org.eclipse.net4j.db.mysql is not used in the teneo-hibernate
> integration
You're right - one could completely leave out the net4j.db.* libraries
when using Hibernate.
>
>> - copy mysql-connector-java-5.1.5-bin.jar to
>> org.eclipse.emf.cdo.tests.hibernate
> MT>> should be to the lib directory in this plugin
Correct - typo. :-)
>
>> - copy the following libraries to
>> org.eclipse.emf.cdo.server.hibernate.libraries/lib
>> * hibernate3.jar
>> * asm.jar
>> * cglib-2.1.3.jar
>> * commons-collections-2.1.1.jar
>> * commons-logging-1.0.4.jar
>> * dom4j-1.6.1.jar
>> * jta.jar
>> * hsqldb.jar
>> - copy the following libraries to
>> org.eclipse.emf.teneo.hibernate.mapper:
>> * hibernate3.jar
>> * dom4j-1.6.1.jar
> MT>> It should not be necessary to copy jars to
> org.eclipse.emf.teneo.hibernate.mapper
Hmmm ... maybe that depends on how it is used / deployed?
I get build errors that those two libraries can not be resolved.
>
>>
>> - Try out new store with small test case:
>>
>> |IManagedContainer container = IPluginContainer.INSTANCE;
>> acceptor = JVMUtil.getAcceptor(container, "default");
>> store = *new *HibernateStore(*new
>> *TeneoHibernateMappingProvider());
>> Map<String, String> props = *new *HashMap<String,
>> String>();
>> props.put(Props.PROP_OVERRIDE_UUID,
>> "f8188187-65de-4c8a-8e75-e0ce5949837a");
>> props.put(Props.PROP_SUPPORTING_AUDITS, "false");
>> props.put(Props.PROP_SUPPORTING_REVISION_DELTAS, "false");
>> props.put(Props.PROP_VERIFYING_REVISIONS, "false");
>> props.put(Props.PROP_CURRENT_LRU_CAPACITY, "10000");
>> props.put(Props.PROP_REVISED_LRU_CAPACITY, "10000");
>> props.put("hibernate.connection.autocommit","true");
>>
>> props.put("hibernate.cache.provider_class","=org.hibernate.cache.HashtableCacheProvider ");
>>
>>
>> props.put("hibernate.connection.driver_class","com.mysql.jdbc.Driver ");
>>
>> props.put("hibernate.connection.url","jdbc:mysql://localhost:3306/" +
>> DB_NAME);
>> props.put("hibernate.connection.username", DB_USER);
>> props.put("hibernate.connection.password", DB_PASS);
>>
>> props.put("hibernate.dialect","org.hibernate.dialect.MySQLInnoDBDialect ");
>>
>> repository = CDOServerUtil.createRepository(repositoryName,
>> store,
>> props);
>> CDOServerUtil.addRepository(container, repository);
>> connector = JVMUtil.getConnector(container, "default");
>> session = CDOUtil.openSession(connector, repositoryName,
>> *true*);
>> transaction = session.openTransaction();
>>
>> session.getPackageRegistry().putEPackage(ArtifactBasePackage .eINSTANCE);
>> session.getPackageRegistry().putEPackage(RequipsePackage.eIN STANCE);
>>
>> session.getPackageRegistry().putEPackage(WeightedLinksPackag e.eINSTANCE);
>>
>> resource = transaction.getOrCreateResource(RESOURCE_PATH);
>> // etc ... (put stuff into repository)
>>
>> |
>>
>>
>> => I can't get hibernate to find the mysql driver class. Tried
>> putting mysql-connector-java-5.1.5-bin.jar in my test plugin, tried
>> exporting packages and using Eclipse-BuddyPolicy: dependent but no
>> success.
> MT>> In which plugin did you set dependent? It should be in the one
> with the hibernate libraries
> The mysql jar must be in the lib directory of the hibernate.test plugin
I created a new test plugin for my own stuff. But if I place the mysql
driver there, hibernate does not find it.
>
>> => temp solution: add mysql-connector-java-5.1.5-bin.jar to
>> org.eclipse.emf.cdo.server.hibernate.libraries project and add it to
>> that Bundle-ClassPath
> MT>> Yes this is also fine
>
>> => class is now found
>>
>> - next error is
>> 24.04.2008 16:58:54 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
>> FATAL: could not complete schema update
>> org.hibernate.MappingException: Could not determine type for:
>> org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOTy peUserType,
>> at table: cdo_features, for columns:
>> [org.hibernate.mapping.Column(type)]
>> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 69)
>> at org.hibernate.mapping.Column.getSqlTypeCode(Column.java:138)
>> at org.hibernate.mapping.Column.getSqlType(Column.java:182)
>> at org.hibernate.mapping.Table.sqlCreateString(Table.java:397)
>> at
>> org.hibernate.cfg.Configuration.generateSchemaUpdateScript(C onfiguration.java:962)
>>
>> at
>> org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate .java:140)
>> at
>> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.initSchema(HibernatePackageHandler.java:346)
>>
>> at
>> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.doActivate(HibernatePackageHandler.java:307)
>>
>> at
>> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore .doActivate(HibernateStore.java:205)
>>
>> at
>> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>>
>> at
>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
>>
>> at
>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
>>
>> at
>> org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:262)
>>
>> at
>> org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:250)
>>
>> at
>> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>>
>> at
>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
>>
>> at
>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
>>
>> at
>> org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
>>
>>
>> Giving up for today - maybe this error is familiar to someone? Eike?
>> Martin?
> MT>> Do you have this class
> (org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOT ypeUserType)
> in the org.eclipse.emf.cdo.server.hibernate plugin?
Yes.
The problem is, as far as I can see after some debugging, a classloader
problem.
The mapping which makes problems is
[...]
<joined-subclass name="CDOFeatureImpl" table="cdo_features"
extends="CDOModelElementImpl">
<key/>
<property name="featureID" column="feature" type="int"
not-null="true" />
/ <property name="type"
type=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOTy peUserType "
not-null="false" />
/[...]
from org.eclipse.emf.cdo.server.hibernate/mappings/meta.hbm.xml
When the schema is to be created, hibernate iterated through the
mappings and comes to the mapping above.
Then we are at org.hibernate.mapping.SimpleValue.getType() (line 260)
Type result = TypeFactory.heuristicType(typeName, typeParameters);
where he tries to load the type via ReflectHelper.classForName( typeName
); and fails.
After some trial and error, I found out that adding
Eclipse-BuddyPolicy: dependent
to the MANIFEST.MF of org.eclipse.emf.cdo.server.hibernate.libraries
does the trick. With this policy set, the class is found and I can even
again delete the mysql driver class from
org.eclipse.emf.cdo.server.hibernate.libraries.
I don't know quite much about classloading in Eclipse (or OSGi,
respectivly), this is very much magical to me, but can it be, that the
missing Eclipse-BuddyPolicy in
org.eclipse.emf.cdo.server.hibernate.libraries is a bug? But then, this
may as well be the result of my "non-standard" installation (copying
jars to org.eclipse.emf.teneo.hibernate.mapper)...
Ok, next one: I'm running into a net.sf.cglib.core.CodeGenerationException
INFO: building session factory
25.04.2008 16:02:13 org.hibernate.impl.SessionFactoryImpl <init>
FEIN: Session factory constructed with filter configurations : {}
25.04.2008 16:02:13 org.hibernate.impl.SessionFactoryImpl <init>
FEIN: instantiating session factory with properties:
{hibernate.connection.autocommit=true,
hibernate.connection.driver_class=com.mysql.jdbc.Driver,
hibernate.cache.provider_class=org.hibernate.cache.Hashtable CacheProvider,
hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect,
verifyingRevisions=false, supportingRevisionDeltas=false,
currentLRUCapacity=10000, revisedLRUCapacity=10000,
overrideUUID=f8188187-65de-4c8a-8e75-e0ce5949837a,
hibernate.connection.username=requipse,
hibernate.connection.url=jdbc:mysql://localhost:3306/requipse,
supportingAudits=false, hibernate.connection.password=requipse}
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Static SQL for entity:
org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Version select: select id from cdo_modelelements where id =?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Snapshot select: select cdoclassim_.CDOClassImpl,
cdoclassim_1_.name as name0_, cdoclassim_.classifier as classifier3_,
cdoclassim_.abstract as abstract3_ from cdo_classes cdoclassim_ inner
join cdo_modelelements cdoclassim_1_ on
cdoclassim_.CDOClassImpl=cdoclassim_1_.id where cdoclassim_.CDOClassImpl=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Insert 0: insert into cdo_modelelements (name, id) values (?, ?)
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Update 0: update cdo_modelelements set name=? where id=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Delete 0: delete from cdo_modelelements where id=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Insert 1: insert into cdo_classes (classifier, abstract,
CDOClassImpl) values (?, ?, ?)
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Update 1: update cdo_classes set classifier=?, abstract=? where
CDOClassImpl=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Delete 1: delete from cdo_classes where CDOClassImpl=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Static SQL for entity:
org.eclipse.emf.cdo.internal.protocol.model.CDOPackageImpl
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Version select: select id from cdo_modelelements where id =?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Snapshot select: select cdopackage_.CDOPackageImpl,
cdopackage_1_.name as name0_, cdopackage_.uri as uri1_,
cdopackage_.ecore as ecore1_, cdopackage_.dynamic as dynamic1_,
cdopackage_.parentUri as parentUri1_, cdopackage_.metaIDStart as
metaIDSt6_1_, cdopackage_.metaIDSize as metaIDSize1_ from cdo_packages
cdopackage_ inner join cdo_modelelements cdopackage_1_ on
cdopackage_.CDOPackageImpl=cdopackage_1_.id where
cdopackage_.CDOPackageImpl=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Insert 0: insert into cdo_modelelements (name, id) values (?, ?)
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Update 0: update cdo_modelelements set name=? where id=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Delete 0: delete from cdo_modelelements where id=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Insert 1: insert into cdo_packages (uri, ecore, dynamic,
parentUri, metaIDStart, metaIDSize, CDOPackageImpl) values (?, ?, ?, ?,
?, ?, ?)
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Update 1: update cdo_packages set uri=?, ecore=?, dynamic=?,
parentUri=?, metaIDStart=?, metaIDSize=? where CDOPackageImpl=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Delete 1: delete from cdo_packages where CDOPackageImpl=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Static SQL for entity:
org.eclipse.emf.cdo.internal.protocol.model.CDOModelElementI mpl
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Version select: select id from cdo_modelelements where id =?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Snapshot select: select cdomodelel_.id, cdomodelel_.name as
name0_ from cdo_modelelements cdomodelel_ where cdomodelel_.id=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Insert 0: insert into cdo_modelelements (name, id) values (?, ?)
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Update 0: update cdo_modelelements set name=? where id=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Delete 0: delete from cdo_modelelements where id=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Static SQL for entity:
org.eclipse.emf.cdo.internal.protocol.model.CDOClassProxy
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Version select: select id from cdo_classes_proxy where id =?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Snapshot select: select cdoclasspr_.id, cdoclasspr_.cdoclass as
cdoclass2_ from cdo_classes_proxy cdoclasspr_ where cdoclasspr_.id=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Insert 0: insert into cdo_classes_proxy (cdoclass, id) values (?, ?)
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Update 0: update cdo_classes_proxy set cdoclass=? where id=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Delete 0: delete from cdo_classes_proxy where id=?
main [debug] Releasing hibernate session
main [debug] Clearing session in threadlocal
main [debug] Removing hibernate session
net.sf.cglib.core.CodeGenerationException:
java.lang.reflect.InvocationTargetException-->null
at
net.sf.cglib.core.AbstractClassGenerator.create(AbstractClas sGenerator.java:237)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
at
org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxy Factory(CGLIBLazyInitializer.java:127)
at
org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstant iate(CGLIBProxyFactory.java:43)
at
org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFact ory(PojoEntityTuplizer.java:162)
at
org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)
at
org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at
org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping . <init>(EntityEntityModeToTuplizerMapping.java:56)
at
org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:302)
at
org.hibernate.persister.entity.AbstractEntityPersister.<init >(AbstractEntityPersister.java:434)
at
org.hibernate.persister.entity.JoinedSubclassEntityPersister . <init>(JoinedSubclassEntityPersister.java:91)
at
org.hibernate.persister.PersisterFactory.createClassPersiste r(PersisterFactory.java:58)
at
org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
at
org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1300)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getSessionFactory(HibernatePackageHandler.java:273 )
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.readPackageInfos(HibernatePackageHandler.java:244)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getCDOPackageInfos(HibernatePackageHandler.java:18 8)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Reader.readPackageInfos(HibernateStoreReader.java:87)
at
org.eclipse.emf.cdo.internal.server.PackageManager.doActivat e(PackageManager.java:72)
at
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
at
org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:263)
at
org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:250)
at
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
at
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
at
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
at
org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
at
my.tests.WeightedLinkPersistenceTests.setUp(WeightedLinkPers istenceTests.java:92)
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.junit.internal.runners.BeforeAndAfterRunner.invokeMethod (BeforeAndAfterRunner.java:74)
at
org.junit.internal.runners.BeforeAndAfterRunner.runBefores(B eforeAndAfterRunner.java:50)
at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:33)
at
org.junit.internal.runners.TestMethodRunner.runMethod(TestMe thodRunner.java:75)
at
org.junit.internal.runners.TestMethodRunner.run(TestMethodRu nner.java:45)
at
org.junit.internal.runners.TestClassMethodsRunner.invokeTest Method(TestClassMethodsRunner.java:66)
at
org.junit.internal.runners.TestClassMethodsRunner.run(TestCl assMethodsRunner.java:35)
at
org.junit.internal.runners.TestClassRunner$1.runUnprotected( TestClassRunner.java:42)
at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:34)
at
org.junit.internal.runners.TestClassRunner.run(TestClassRunn er.java:52)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:45)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
at
org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunne r.main(RemotePluginTestRunner.java:62)
at
org.eclipse.pde.internal.junit.runtime.UITestApplication$1.r un(UITestApplication.java:118)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:130)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3750)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3375)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2375)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2339)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 05)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:478)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:288)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:473)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
at
org.eclipse.pde.internal.junit.runtime.UITestApplication.sta rt(UITestApplication.java:52)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:193)
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:362)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:175)
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: 549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
Caused by: java.lang.reflect.InvocationTargetException
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 net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java :384)
at
net.sf.cglib.core.AbstractClassGenerator.create(AbstractClas sGenerator.java:219)
... 74 more
Caused by: java.lang.NoClassDefFoundError:
org/hibernate/proxy/HibernateProxy
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
... 80 more
Caused by: java.lang.ClassNotFoundException:
org.hibernate.proxy.HibernateProxy
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl assInternal(BundleLoader.java:481)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:397)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:385)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:87)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 82 more
Again a classloader problem, I think.
Tried a lot of alternatives of moving hibernate3.jar around and create
and delete copies of it.
No effect.
Giving up for today - maybe there's some light of wisdom coming to me
(or you?).
Anyway, have a nice weekend
Stefan
|
|
|
Re: [CDO-Teneo-Hibernate] Experience report and errors: Migrating from classic MySQLAdapter-backed s [message #120152 is a reply to message #120124] |
Fri, 25 April 2008 18:05 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Martin Taal![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=mtaal%40springsite.com) Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Stefan,
See my comments below.
gr. Martin
Stefan Winkler wrote:
> Hi,
>
> today, I learned that Eclipse is always good for some extra fun.
> For some reason it deleted the
> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
> from the .classpath file in all project in my workspace. It is creepy
> when Eclipse does not find a single dependency anymore.
> Luckily I was able to locate the problem after some time - so now I am
> back and ready to proceed.
>
> Thanks, Martin, for all your comments. As you might have guessed, most
> errors I wrote were simple typos / paste errors:
>>> Hi,
>>>
>>> since I had to convince some of the components of working together,
>>> I'll report my steps and experiences here:
>>> Since I did not have any official guide on how to set up everything,
>>> I just did trial and error. So please comment, if there is any easier
>>> or more conformant way of getting CDO-Hibernate to run...
>>>
>>> - Downloaded Eclipse-3.4M6-modeling
>>> - [added my favourite plugins - subversive, java2html, keepresident]
>>> - [Create a working set for the sources of CDO etc. to keep them in
>>> one place]
>>> - CVS checkout of everything in
>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>>> > org.eclipse.emf.cdo > plugins
>>> - CVS checkout of everything in
>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>>> > org.eclipse.emf.cdo > hibernate
>>> [@Eike: there are two (conflicting) folders
>>> org.eclipse.emf.cdo.server.hibernate one in plugins, one in hibernate]
>> MT>> You should take the ones from the hibernate folder
> Sure - this was just to report that it could cause misunderstandings.
> @Eike: the folder in plugins is empty, you just get a conflict, if you
> try to check out everything at once because of two folders / projects
> with the same name.
>>> - CVS checkout of everything in
>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>>> > org.eclipse.emf.cdo > tests
>>> - CVS checkout of everything in
>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>>> > org.eclipse.emf.net4j > plugins
>>> - CVS checkout of following projects in
>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>>> > org.eclipse.emf.teneo > plugins
>>> * org.eclipse.emf.teneo
>>> * org.eclipse.emf.teneo.annotations
>>> * org.eclipse.emf.teneo.hibernate.mapper
>> MT>> I think you also need org.eclipse.emf.teneo.libraries
> Mhh .. it is not required and AFAIK there's only commons-logging.jar in
> there, which has to be copied into
> org.eclipse.emf.cdo.server.hibernate.libraries/lib anyway.
MT2>> Yes you are right, I changed the dependencies method of the teneo plugins
to import packages so as long as there is another plugin serving commons-logging.jar
then you are okay.
>
>>> - get hold of these libraries:
>>> * hibernate3.jar
>>> * asm.jar
>>> * cglib-2.1.3.jar
>>> * commons-collections-2.1.1.jar
>>> * commons-logging-1.0.4.jar
>>> * dom4j-1.6.1.jar
>>> * jta.jar
>>> * mysql-connector-java-5.1.5-bin.jar
>>> * hsqldb.jar
>>> - copy hsqldb.jar to org.eclipse.net4j.db.hsqldb/lib
>> MT>> org.eclipse.net4j.db.hsqldb is not used in the teneo-hibernate
>> integration
>>
>>> - copy mysql-connector-java-5.1.5-bin.jar to
>>> org.eclipse.net4j.db.mysql/lib
>> MT>> org.eclipse.net4j.db.mysql is not used in the teneo-hibernate
>> integration
> You're right - one could completely leave out the net4j.db.* libraries
> when using Hibernate.
>>
>>> - copy mysql-connector-java-5.1.5-bin.jar to
>>> org.eclipse.emf.cdo.tests.hibernate
>> MT>> should be to the lib directory in this plugin
> Correct - typo. :-)
>>
>>> - copy the following libraries to
>>> org.eclipse.emf.cdo.server.hibernate.libraries/lib
>>> * hibernate3.jar
>>> * asm.jar
>>> * cglib-2.1.3.jar
>>> * commons-collections-2.1.1.jar
>>> * commons-logging-1.0.4.jar
>>> * dom4j-1.6.1.jar
>>> * jta.jar
>>> * hsqldb.jar
>>> - copy the following libraries to
>>> org.eclipse.emf.teneo.hibernate.mapper:
>>> * hibernate3.jar
>>> * dom4j-1.6.1.jar
>> MT>> It should not be necessary to copy jars to
>> org.eclipse.emf.teneo.hibernate.mapper
> Hmmm ... maybe that depends on how it is used / deployed?
> I get build errors that those two libraries can not be resolved.
MT2>> Can you post a screenshot then I can try to solve this as it should
not be required.
>>
>>>
>>> - Try out new store with small test case:
>>>
>>> |IManagedContainer container = IPluginContainer.INSTANCE;
>>> acceptor = JVMUtil.getAcceptor(container, "default");
>>> store = *new *HibernateStore(*new
>>> *TeneoHibernateMappingProvider());
>>> Map<String, String> props = *new *HashMap<String,
>>> String>();
>>> props.put(Props.PROP_OVERRIDE_UUID,
>>> "f8188187-65de-4c8a-8e75-e0ce5949837a");
>>> props.put(Props.PROP_SUPPORTING_AUDITS, "false");
>>> props.put(Props.PROP_SUPPORTING_REVISION_DELTAS, "false");
>>> props.put(Props.PROP_VERIFYING_REVISIONS, "false");
>>> props.put(Props.PROP_CURRENT_LRU_CAPACITY, "10000");
>>> props.put(Props.PROP_REVISED_LRU_CAPACITY, "10000");
>>> props.put("hibernate.connection.autocommit","true");
>>>
>>> props.put("hibernate.cache.provider_class","=org.hibernate.cache.HashtableCacheProvider ");
>>>
>>>
>>> props.put("hibernate.connection.driver_class","com.mysql.jdbc.Driver ");
>>>
>>> props.put("hibernate.connection.url","jdbc:mysql://localhost:3306/" +
>>> DB_NAME);
>>> props.put("hibernate.connection.username", DB_USER);
>>> props.put("hibernate.connection.password", DB_PASS);
>>>
>>> props.put("hibernate.dialect","org.hibernate.dialect.MySQLInnoDBDialect ");
>>>
>>> repository = CDOServerUtil.createRepository(repositoryName,
>>> store,
>>> props);
>>> CDOServerUtil.addRepository(container, repository);
>>> connector = JVMUtil.getConnector(container, "default");
>>> session = CDOUtil.openSession(connector, repositoryName,
>>> *true*);
>>> transaction = session.openTransaction();
>>>
>>> session.getPackageRegistry().putEPackage(ArtifactBasePackage .eINSTANCE);
>>> session.getPackageRegistry().putEPackage(RequipsePackage.eIN STANCE);
>>>
>>> session.getPackageRegistry().putEPackage(WeightedLinksPackag e.eINSTANCE);
>>>
>>> resource = transaction.getOrCreateResource(RESOURCE_PATH);
>>> // etc ... (put stuff into repository)
>>>
>>> |
>>>
>>>
>>> => I can't get hibernate to find the mysql driver class. Tried
>>> putting mysql-connector-java-5.1.5-bin.jar in my test plugin, tried
>>> exporting packages and using Eclipse-BuddyPolicy: dependent but no
>>> success.
>> MT>> In which plugin did you set dependent? It should be in the one
>> with the hibernate libraries
>> The mysql jar must be in the lib directory of the hibernate.test plugin
> I created a new test plugin for my own stuff. But if I place the mysql
> driver there, hibernate does not find it.
>>
>>> => temp solution: add mysql-connector-java-5.1.5-bin.jar to
>>> org.eclipse.emf.cdo.server.hibernate.libraries project and add it to
>>> that Bundle-ClassPath
>> MT>> Yes this is also fine
>>
>>> => class is now found
>>>
>>> - next error is
>>> 24.04.2008 16:58:54 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
>>> FATAL: could not complete schema update
>>> org.hibernate.MappingException: Could not determine type for:
>>> org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOTy peUserType,
>>> at table: cdo_features, for columns:
>>> [org.hibernate.mapping.Column(type)]
>>> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 69)
>>> at org.hibernate.mapping.Column.getSqlTypeCode(Column.java:138)
>>> at org.hibernate.mapping.Column.getSqlType(Column.java:182)
>>> at org.hibernate.mapping.Table.sqlCreateString(Table.java:397)
>>> at
>>> org.hibernate.cfg.Configuration.generateSchemaUpdateScript(C onfiguration.java:962)
>>>
>>> at
>>> org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate .java:140)
>>> at
>>> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.initSchema(HibernatePackageHandler.java:346)
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.doActivate(HibernatePackageHandler.java:307)
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore .doActivate(HibernateStore.java:205)
>>>
>>> at
>>> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>>>
>>> at
>>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
>>>
>>> at
>>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:262)
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:250)
>>>
>>> at
>>> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>>>
>>> at
>>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
>>>
>>> at
>>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
>>>
>>> at
>>> org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
>>>
>>>
>>> Giving up for today - maybe this error is familiar to someone? Eike?
>>> Martin?
>> MT>> Do you have this class
>> (org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOT ypeUserType)
>> in the org.eclipse.emf.cdo.server.hibernate plugin?
> Yes.
> The problem is, as far as I can see after some debugging, a classloader
> problem.
>
> The mapping which makes problems is
>
> [...]
> <joined-subclass name="CDOFeatureImpl" table="cdo_features"
> extends="CDOModelElementImpl">
> <key/>
> <property name="featureID" column="feature" type="int"
> not-null="true" />
> / <property name="type"
> type=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOTy peUserType "
>
> not-null="false" />
> /[...]
>
> from org.eclipse.emf.cdo.server.hibernate/mappings/meta.hbm.xml
>
> When the schema is to be created, hibernate iterated through the
> mappings and comes to the mapping above.
> Then we are at org.hibernate.mapping.SimpleValue.getType() (line 260)
>
> Type result = TypeFactory.heuristicType(typeName, typeParameters);
>
> where he tries to load the type via ReflectHelper.classForName( typeName
> ); and fails.
>
> After some trial and error, I found out that adding
>
> Eclipse-BuddyPolicy: dependent
>
> to the MANIFEST.MF of org.eclipse.emf.cdo.server.hibernate.libraries
> does the trick. With this policy set, the class is found and I can even
> again delete the mysql driver class from
> org.eclipse.emf.cdo.server.hibernate.libraries.
MT2>> Yes I was/am actually surprised that our testcases run without this Eclipse-Buddypolicy
setting, so setting it seems a good idea.
>
> I don't know quite much about classloading in Eclipse (or OSGi,
> respectivly), this is very much magical to me, but can it be, that the
> missing Eclipse-BuddyPolicy in
> org.eclipse.emf.cdo.server.hibernate.libraries is a bug? But then, this
> may as well be the result of my "non-standard" installation (copying
> jars to org.eclipse.emf.teneo.hibernate.mapper)...
MT2>> Eclipse-Buddypolicy dependent means that a plugin will search for classes
in the plugins which depend on it. An example, say that you have a plugin A which depends on plugins
B and C. Now assume that A passes a config file (a mapping file) to B which contains the name of a
class which is served by C. Then with Eclipse-Buddypolicy dependent in B the following will happen:
- B will try to resolve the class, but it can't as the class is not present in his own plugin
- B then asks A because A depends on B and B has Eclipse Buddypolicy dependent
- A tries to load the class but fails so it checks C
- C has the class and loads it and gives it back.
As you can see for libraries like hibernate which instantiate classes from other plugins which are
outside of the visibility of hibernate, Eclipse-buddypolicy dependent is a required feature. Note
that eclipse buddy policy dependent is not very good from a performance point of view as the class
loading process has to go through all these plugins.
>
>
> Ok, next one: I'm running into a net.sf.cglib.core.CodeGenerationException
MT2>> I have looked at the exception below but I can't really think why this occurs.
Do you have a cglib jar in another plugin maybe can you check that?
If you can put in a small test project and email it to me then I can try to replicate it.
>
> INFO: building session factory
> 25.04.2008 16:02:13 org.hibernate.impl.SessionFactoryImpl <init>
> FEIN: Session factory constructed with filter configurations : {}
> 25.04.2008 16:02:13 org.hibernate.impl.SessionFactoryImpl <init>
> FEIN: instantiating session factory with properties:
> {hibernate.connection.autocommit=true,
> hibernate.connection.driver_class=com.mysql.jdbc.Driver,
> hibernate.cache.provider_class=org.hibernate.cache.Hashtable CacheProvider,
> hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect,
> verifyingRevisions=false, supportingRevisionDeltas=false,
> currentLRUCapacity=10000, revisedLRUCapacity=10000,
> overrideUUID=f8188187-65de-4c8a-8e75-e0ce5949837a,
> hibernate.connection.username=requipse,
> hibernate.connection.url=jdbc:mysql://localhost:3306/requipse,
> supportingAudits=false, hibernate.connection.password=requipse}
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Static SQL for entity:
> org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Version select: select id from cdo_modelelements where id =?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Snapshot select: select cdoclassim_.CDOClassImpl,
> cdoclassim_1_.name as name0_, cdoclassim_.classifier as classifier3_,
> cdoclassim_.abstract as abstract3_ from cdo_classes cdoclassim_ inner
> join cdo_modelelements cdoclassim_1_ on
> cdoclassim_.CDOClassImpl=cdoclassim_1_.id where cdoclassim_.CDOClassImpl=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Insert 0: insert into cdo_modelelements (name, id) values (?, ?)
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Update 0: update cdo_modelelements set name=? where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Delete 0: delete from cdo_modelelements where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Insert 1: insert into cdo_classes (classifier, abstract,
> CDOClassImpl) values (?, ?, ?)
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Update 1: update cdo_classes set classifier=?, abstract=? where
> CDOClassImpl=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Delete 1: delete from cdo_classes where CDOClassImpl=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Static SQL for entity:
> org.eclipse.emf.cdo.internal.protocol.model.CDOPackageImpl
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Version select: select id from cdo_modelelements where id =?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Snapshot select: select cdopackage_.CDOPackageImpl,
> cdopackage_1_.name as name0_, cdopackage_.uri as uri1_,
> cdopackage_.ecore as ecore1_, cdopackage_.dynamic as dynamic1_,
> cdopackage_.parentUri as parentUri1_, cdopackage_.metaIDStart as
> metaIDSt6_1_, cdopackage_.metaIDSize as metaIDSize1_ from cdo_packages
> cdopackage_ inner join cdo_modelelements cdopackage_1_ on
> cdopackage_.CDOPackageImpl=cdopackage_1_.id where
> cdopackage_.CDOPackageImpl=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Insert 0: insert into cdo_modelelements (name, id) values (?, ?)
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Update 0: update cdo_modelelements set name=? where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Delete 0: delete from cdo_modelelements where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Insert 1: insert into cdo_packages (uri, ecore, dynamic,
> parentUri, metaIDStart, metaIDSize, CDOPackageImpl) values (?, ?, ?, ?,
> ?, ?, ?)
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Update 1: update cdo_packages set uri=?, ecore=?, dynamic=?,
> parentUri=?, metaIDStart=?, metaIDSize=? where CDOPackageImpl=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Delete 1: delete from cdo_packages where CDOPackageImpl=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Static SQL for entity:
> org.eclipse.emf.cdo.internal.protocol.model.CDOModelElementI mpl
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Version select: select id from cdo_modelelements where id =?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Snapshot select: select cdomodelel_.id, cdomodelel_.name as
> name0_ from cdo_modelelements cdomodelel_ where cdomodelel_.id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Insert 0: insert into cdo_modelelements (name, id) values (?, ?)
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Update 0: update cdo_modelelements set name=? where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Delete 0: delete from cdo_modelelements where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Static SQL for entity:
> org.eclipse.emf.cdo.internal.protocol.model.CDOClassProxy
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Version select: select id from cdo_classes_proxy where id =?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Snapshot select: select cdoclasspr_.id, cdoclasspr_.cdoclass as
> cdoclass2_ from cdo_classes_proxy cdoclasspr_ where cdoclasspr_.id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Insert 0: insert into cdo_classes_proxy (cdoclass, id) values (?, ?)
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Update 0: update cdo_classes_proxy set cdoclass=? where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Delete 0: delete from cdo_classes_proxy where id=?
> main [debug] Releasing hibernate session
> main [debug] Clearing session in threadlocal
> main [debug] Removing hibernate session
> net.sf.cglib.core.CodeGenerationException:
> java.lang.reflect.InvocationTargetException-->null
> at
> net.sf.cglib.core.AbstractClassGenerator.create(AbstractClas sGenerator.java:237)
>
> at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
> at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
> at
> org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxy Factory(CGLIBLazyInitializer.java:127)
>
> at
> org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstant iate(CGLIBProxyFactory.java:43)
>
> at
> org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFact ory(PojoEntityTuplizer.java:162)
>
> at
> org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)
>
> at
> org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
>
> at
> org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping . <init>(EntityEntityModeToTuplizerMapping.java:56)
>
> at
> org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:302)
> at
> org.hibernate.persister.entity.AbstractEntityPersister.<init >(AbstractEntityPersister.java:434)
>
> at
> org.hibernate.persister.entity.JoinedSubclassEntityPersister . <init>(JoinedSubclassEntityPersister.java:91)
>
> at
> org.hibernate.persister.PersisterFactory.createClassPersiste r(PersisterFactory.java:58)
>
> at
> org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
> at
> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1300)
>
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getSessionFactory(HibernatePackageHandler.java:273 )
>
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.readPackageInfos(HibernatePackageHandler.java:244)
>
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getCDOPackageInfos(HibernatePackageHandler.java:18 8)
>
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Reader.readPackageInfos(HibernateStoreReader.java:87)
>
> at
> org.eclipse.emf.cdo.internal.server.PackageManager.doActivat e(PackageManager.java:72)
>
> at
> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>
> at
> org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:263)
>
> at
> org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:250)
>
> at
> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>
> at
> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
>
> at
> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
>
> at
> org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
>
> at
> my.tests.WeightedLinkPersistenceTests.setUp(WeightedLinkPers istenceTests.java:92)
>
> 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.junit.internal.runners.BeforeAndAfterRunner.invokeMethod (BeforeAndAfterRunner.java:74)
>
> at
> org.junit.internal.runners.BeforeAndAfterRunner.runBefores(B eforeAndAfterRunner.java:50)
>
> at
> org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:33)
>
> at
> org.junit.internal.runners.TestMethodRunner.runMethod(TestMe thodRunner.java:75)
>
> at
> org.junit.internal.runners.TestMethodRunner.run(TestMethodRu nner.java:45)
> at
> org.junit.internal.runners.TestClassMethodsRunner.invokeTest Method(TestClassMethodsRunner.java:66)
>
> at
> org.junit.internal.runners.TestClassMethodsRunner.run(TestCl assMethodsRunner.java:35)
>
> at
> org.junit.internal.runners.TestClassRunner$1.runUnprotected( TestClassRunner.java:42)
>
> at
> org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:34)
>
> at
> org.junit.internal.runners.TestClassRunner.run(TestClassRunn er.java:52)
> at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:45)
>
> at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
>
> at
> org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunne r.main(RemotePluginTestRunner.java:62)
>
> at
> org.eclipse.pde.internal.junit.runtime.UITestApplication$1.r un(UITestApplication.java:118)
>
> at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
> at
> org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:130)
>
> at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3750)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3375)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2375)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2339)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 05)
> at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:478)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:288)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:473)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at
> org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
>
> at
> org.eclipse.pde.internal.junit.runtime.UITestApplication.sta rt(UITestApplication.java:52)
>
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:193)
>
> 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:362)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:175)
>
> 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: 549)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
> Caused by: java.lang.reflect.InvocationTargetException
> 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 net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java :384)
> at
> net.sf.cglib.core.AbstractClassGenerator.create(AbstractClas sGenerator.java:219)
>
> ... 74 more
> Caused by: java.lang.NoClassDefFoundError:
> org/hibernate/proxy/HibernateProxy
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(Unknown Source)
> ... 80 more
> Caused by: java.lang.ClassNotFoundException:
> org.hibernate.proxy.HibernateProxy
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl assInternal(BundleLoader.java:481)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:397)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:385)
>
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:87)
>
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
> ... 82 more
>
>
> Again a classloader problem, I think.
> Tried a lot of alternatives of moving hibernate3.jar around and create
> and delete copies of it.
> No effect.
>
> Giving up for today - maybe there's some light of wisdom coming to me
> (or you?).
>
> Anyway, have a nice weekend
>
> Stefan
>
>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Re: [CDO-Teneo-Hibernate] Experience report and errors: Migrating from classic MySQLAdapter-backed s [message #120205 is a reply to message #120124] |
Sat, 26 April 2008 09:20 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: stepper.sympedia.de
Hi Stefan,
You're right, I deleted org.eclipse.emf.cdo.server.hibernate from the
plugins/ folder.
Cheers
/Eike
Stefan Winkler schrieb:
> Hi,
>
> today, I learned that Eclipse is always good for some extra fun.
> For some reason it deleted the
> <classpathentry kind="con"
> path="org.eclipse.pde.core.requiredPlugins"/>
> from the .classpath file in all project in my workspace. It is creepy
> when Eclipse does not find a single dependency anymore.
> Luckily I was able to locate the problem after some time - so now I am
> back and ready to proceed.
>
> Thanks, Martin, for all your comments. As you might have guessed, most
> errors I wrote were simple typos / paste errors:
>>> Hi,
>>>
>>> since I had to convince some of the components of working together,
>>> I'll report my steps and experiences here:
>>> Since I did not have any official guide on how to set up everything,
>>> I just did trial and error. So please comment, if there is any
>>> easier or more conformant way of getting CDO-Hibernate to run...
>>>
>>> - Downloaded Eclipse-3.4M6-modeling
>>> - [added my favourite plugins - subversive, java2html, keepresident]
>>> - [Create a working set for the sources of CDO etc. to keep them in
>>> one place]
>>> - CVS checkout of everything in
>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>>> > org.eclipse.emf.cdo > plugins
>>> - CVS checkout of everything in
>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>>> > org.eclipse.emf.cdo > hibernate
>>> [@Eike: there are two (conflicting) folders
>>> org.eclipse.emf.cdo.server.hibernate one in plugins, one in hibernate]
>> MT>> You should take the ones from the hibernate folder
> Sure - this was just to report that it could cause misunderstandings.
> @Eike: the folder in plugins is empty, you just get a conflict, if you
> try to check out everything at once because of two folders / projects
> with the same name.
>>> - CVS checkout of everything in
>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>>> > org.eclipse.emf.cdo > tests
>>> - CVS checkout of everything in
>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>>> > org.eclipse.emf.net4j > plugins
>>> - CVS checkout of following projects in
>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>>> > org.eclipse.emf.teneo > plugins
>>> * org.eclipse.emf.teneo
>>> * org.eclipse.emf.teneo.annotations
>>> * org.eclipse.emf.teneo.hibernate.mapper
>> MT>> I think you also need org.eclipse.emf.teneo.libraries
> Mhh .. it is not required and AFAIK there's only commons-logging.jar
> in there, which has to be copied into
> org.eclipse.emf.cdo.server.hibernate.libraries/lib anyway.
>
>>> - get hold of these libraries:
>>> * hibernate3.jar
>>> * asm.jar
>>> * cglib-2.1.3.jar
>>> * commons-collections-2.1.1.jar
>>> * commons-logging-1.0.4.jar
>>> * dom4j-1.6.1.jar
>>> * jta.jar
>>> * mysql-connector-java-5.1.5-bin.jar
>>> * hsqldb.jar
>>> - copy hsqldb.jar to org.eclipse.net4j.db.hsqldb/lib
>> MT>> org.eclipse.net4j.db.hsqldb is not used in the teneo-hibernate
>> integration
>>
>>> - copy mysql-connector-java-5.1.5-bin.jar to
>>> org.eclipse.net4j.db.mysql/lib
>> MT>> org.eclipse.net4j.db.mysql is not used in the teneo-hibernate
>> integration
> You're right - one could completely leave out the net4j.db.* libraries
> when using Hibernate.
>>
>>> - copy mysql-connector-java-5.1.5-bin.jar to
>>> org.eclipse.emf.cdo.tests.hibernate
>> MT>> should be to the lib directory in this plugin
> Correct - typo. :-)
>>
>>> - copy the following libraries to
>>> org.eclipse.emf.cdo.server.hibernate.libraries/lib
>>> * hibernate3.jar
>>> * asm.jar
>>> * cglib-2.1.3.jar
>>> * commons-collections-2.1.1.jar
>>> * commons-logging-1.0.4.jar
>>> * dom4j-1.6.1.jar
>>> * jta.jar
>>> * hsqldb.jar
>>> - copy the following libraries to
>>> org.eclipse.emf.teneo.hibernate.mapper:
>>> * hibernate3.jar
>>> * dom4j-1.6.1.jar
>> MT>> It should not be necessary to copy jars to
>> org.eclipse.emf.teneo.hibernate.mapper
> Hmmm ... maybe that depends on how it is used / deployed?
> I get build errors that those two libraries can not be resolved.
>>
>>>
>>> - Try out new store with small test case:
>>>
>>> |IManagedContainer container = IPluginContainer.INSTANCE;
>>> acceptor = JVMUtil.getAcceptor(container, "default");
>>> store = *new *HibernateStore(*new
>>> *TeneoHibernateMappingProvider());
>>> Map<String, String> props = *new
>>> *HashMap<String, String>();
>>> props.put(Props.PROP_OVERRIDE_UUID,
>>> "f8188187-65de-4c8a-8e75-e0ce5949837a");
>>> props.put(Props.PROP_SUPPORTING_AUDITS, "false");
>>> props.put(Props.PROP_SUPPORTING_REVISION_DELTAS, "false");
>>> props.put(Props.PROP_VERIFYING_REVISIONS, "false");
>>> props.put(Props.PROP_CURRENT_LRU_CAPACITY, "10000");
>>> props.put(Props.PROP_REVISED_LRU_CAPACITY, "10000");
>>> props.put("hibernate.connection.autocommit","true");
>>>
>>> props.put("hibernate.cache.provider_class","=org.hibernate.cache.HashtableCacheProvider ");
>>>
>>>
>>> props.put("hibernate.connection.driver_class","com.mysql.jdbc.Driver ");
>>>
>>> props.put("hibernate.connection.url","jdbc:mysql://localhost:3306/"
>>> + DB_NAME);
>>> props.put("hibernate.connection.username", DB_USER);
>>> props.put("hibernate.connection.password", DB_PASS);
>>>
>>> props.put("hibernate.dialect","org.hibernate.dialect.MySQLInnoDBDialect ");
>>>
>>> repository = CDOServerUtil.createRepository(repositoryName,
>>> store,
>>> props);
>>> CDOServerUtil.addRepository(container, repository);
>>> connector = JVMUtil.getConnector(container, "default");
>>> session = CDOUtil.openSession(connector, repositoryName,
>>> *true*);
>>> transaction = session.openTransaction();
>>>
>>> session.getPackageRegistry().putEPackage(ArtifactBasePackage .eINSTANCE);
>>>
>>>
>>> session.getPackageRegistry().putEPackage(RequipsePackage.eIN STANCE);
>>>
>>> session.getPackageRegistry().putEPackage(WeightedLinksPackag e.eINSTANCE);
>>>
>>> resource = transaction.getOrCreateResource(RESOURCE_PATH);
>>> // etc ... (put stuff into repository)
>>>
>>> |
>>>
>>>
>>> => I can't get hibernate to find the mysql driver class. Tried
>>> putting mysql-connector-java-5.1.5-bin.jar in my test plugin, tried
>>> exporting packages and using Eclipse-BuddyPolicy: dependent but no
>>> success.
>> MT>> In which plugin did you set dependent? It should be in the one
>> with the hibernate libraries
>> The mysql jar must be in the lib directory of the hibernate.test plugin
> I created a new test plugin for my own stuff. But if I place the mysql
> driver there, hibernate does not find it.
>>
>>> => temp solution: add mysql-connector-java-5.1.5-bin.jar to
>>> org.eclipse.emf.cdo.server.hibernate.libraries project and add it to
>>> that Bundle-ClassPath
>> MT>> Yes this is also fine
>>
>>> => class is now found
>>>
>>> - next error is
>>> 24.04.2008 16:58:54 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
>>> FATAL: could not complete schema update
>>> org.hibernate.MappingException: Could not determine type for:
>>> org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOTy peUserType,
>>> at table: cdo_features, for columns:
>>> [org.hibernate.mapping.Column(type)]
>>> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 69)
>>> at org.hibernate.mapping.Column.getSqlTypeCode(Column.java:138)
>>> at org.hibernate.mapping.Column.getSqlType(Column.java:182)
>>> at org.hibernate.mapping.Table.sqlCreateString(Table.java:397)
>>> at
>>> org.hibernate.cfg.Configuration.generateSchemaUpdateScript(C onfiguration.java:962)
>>>
>>> at
>>> org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate .java:140)
>>> at
>>> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.initSchema(HibernatePackageHandler.java:346)
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.doActivate(HibernatePackageHandler.java:307)
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore .doActivate(HibernateStore.java:205)
>>>
>>> at
>>> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>>>
>>> at
>>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
>>>
>>> at
>>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:262)
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:250)
>>>
>>> at
>>> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>>>
>>> at
>>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
>>>
>>> at
>>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
>>>
>>> at
>>> org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
>>>
>>>
>>> Giving up for today - maybe this error is familiar to someone? Eike?
>>> Martin?
>> MT>> Do you have this class
>> (org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOT ypeUserType)
>> in the org.eclipse.emf.cdo.server.hibernate plugin?
> Yes.
> The problem is, as far as I can see after some debugging, a
> classloader problem.
>
> The mapping which makes problems is
>
> [...]
> <joined-subclass name="CDOFeatureImpl" table="cdo_features"
> extends="CDOModelElementImpl">
> <key/>
> <property name="featureID" column="feature" type="int"
> not-null="true" />
> / <property name="type"
> type=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOTy peUserType "
>
> not-null="false" />
> /[...]
>
> from org.eclipse.emf.cdo.server.hibernate/mappings/meta.hbm.xml
>
> When the schema is to be created, hibernate iterated through the
> mappings and comes to the mapping above.
> Then we are at org.hibernate.mapping.SimpleValue.getType() (line 260)
>
> Type result = TypeFactory.heuristicType(typeName, typeParameters);
>
> where he tries to load the type via ReflectHelper.classForName(
> typeName ); and fails.
>
> After some trial and error, I found out that adding
>
> Eclipse-BuddyPolicy: dependent
>
> to the MANIFEST.MF of org.eclipse.emf.cdo.server.hibernate.libraries
> does the trick. With this policy set, the class is found and I can
> even again delete the mysql driver class from
> org.eclipse.emf.cdo.server.hibernate.libraries.
>
> I don't know quite much about classloading in Eclipse (or OSGi,
> respectivly), this is very much magical to me, but can it be, that the
> missing Eclipse-BuddyPolicy in
> org.eclipse.emf.cdo.server.hibernate.libraries is a bug? But then,
> this may as well be the result of my "non-standard" installation
> (copying jars to org.eclipse.emf.teneo.hibernate.mapper)...
>
>
> Ok, next one: I'm running into a
> net.sf.cglib.core.CodeGenerationException
>
> INFO: building session factory
> 25.04.2008 16:02:13 org.hibernate.impl.SessionFactoryImpl <init>
> FEIN: Session factory constructed with filter configurations : {}
> 25.04.2008 16:02:13 org.hibernate.impl.SessionFactoryImpl <init>
> FEIN: instantiating session factory with properties:
> {hibernate.connection.autocommit=true,
> hibernate.connection.driver_class=com.mysql.jdbc.Driver,
> hibernate.cache.provider_class=org.hibernate.cache.Hashtable CacheProvider,
> hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect,
> verifyingRevisions=false, supportingRevisionDeltas=false,
> currentLRUCapacity=10000, revisedLRUCapacity=10000,
> overrideUUID=f8188187-65de-4c8a-8e75-e0ce5949837a,
> hibernate.connection.username=requipse,
> hibernate.connection.url=jdbc:mysql://localhost:3306/requipse,
> supportingAudits=false, hibernate.connection.password=requipse}
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Static SQL for entity:
> org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Version select: select id from cdo_modelelements where id =?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Snapshot select: select cdoclassim_.CDOClassImpl,
> cdoclassim_1_.name as name0_, cdoclassim_.classifier as classifier3_,
> cdoclassim_.abstract as abstract3_ from cdo_classes cdoclassim_ inner
> join cdo_modelelements cdoclassim_1_ on
> cdoclassim_.CDOClassImpl=cdoclassim_1_.id where
> cdoclassim_.CDOClassImpl=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Insert 0: insert into cdo_modelelements (name, id) values (?, ?)
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Update 0: update cdo_modelelements set name=? where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Delete 0: delete from cdo_modelelements where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Insert 1: insert into cdo_classes (classifier, abstract,
> CDOClassImpl) values (?, ?, ?)
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Update 1: update cdo_classes set classifier=?, abstract=? where
> CDOClassImpl=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Delete 1: delete from cdo_classes where CDOClassImpl=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Static SQL for entity:
> org.eclipse.emf.cdo.internal.protocol.model.CDOPackageImpl
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Version select: select id from cdo_modelelements where id =?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Snapshot select: select cdopackage_.CDOPackageImpl,
> cdopackage_1_.name as name0_, cdopackage_.uri as uri1_,
> cdopackage_.ecore as ecore1_, cdopackage_.dynamic as dynamic1_,
> cdopackage_.parentUri as parentUri1_, cdopackage_.metaIDStart as
> metaIDSt6_1_, cdopackage_.metaIDSize as metaIDSize1_ from cdo_packages
> cdopackage_ inner join cdo_modelelements cdopackage_1_ on
> cdopackage_.CDOPackageImpl=cdopackage_1_.id where
> cdopackage_.CDOPackageImpl=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Insert 0: insert into cdo_modelelements (name, id) values (?, ?)
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Update 0: update cdo_modelelements set name=? where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Delete 0: delete from cdo_modelelements where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Insert 1: insert into cdo_packages (uri, ecore, dynamic,
> parentUri, metaIDStart, metaIDSize, CDOPackageImpl) values (?, ?, ?,
> ?, ?, ?, ?)
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Update 1: update cdo_packages set uri=?, ecore=?, dynamic=?,
> parentUri=?, metaIDStart=?, metaIDSize=? where CDOPackageImpl=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Delete 1: delete from cdo_packages where CDOPackageImpl=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Static SQL for entity:
> org.eclipse.emf.cdo.internal.protocol.model.CDOModelElementI mpl
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Version select: select id from cdo_modelelements where id =?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Snapshot select: select cdomodelel_.id, cdomodelel_.name as
> name0_ from cdo_modelelements cdomodelel_ where cdomodelel_.id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Insert 0: insert into cdo_modelelements (name, id) values (?, ?)
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Update 0: update cdo_modelelements set name=? where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Delete 0: delete from cdo_modelelements where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Static SQL for entity:
> org.eclipse.emf.cdo.internal.protocol.model.CDOClassProxy
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Version select: select id from cdo_classes_proxy where id =?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Snapshot select: select cdoclasspr_.id, cdoclasspr_.cdoclass as
> cdoclass2_ from cdo_classes_proxy cdoclasspr_ where cdoclasspr_.id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Insert 0: insert into cdo_classes_proxy (cdoclass, id) values
> (?, ?)
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Update 0: update cdo_classes_proxy set cdoclass=? where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Delete 0: delete from cdo_classes_proxy where id=?
> main [debug] Releasing hibernate session
> main [debug] Clearing session in threadlocal
> main [debug] Removing hibernate session
> net.sf.cglib.core.CodeGenerationException:
> java.lang.reflect.InvocationTargetException-->null
> at
> net.sf.cglib.core.AbstractClassGenerator.create(AbstractClas sGenerator.java:237)
>
> at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
> at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
> at
> org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxy Factory(CGLIBLazyInitializer.java:127)
>
> at
> org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstant iate(CGLIBProxyFactory.java:43)
>
> at
> org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFact ory(PojoEntityTuplizer.java:162)
>
> at
> org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)
>
> at
> org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
>
> at
> org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping . <init>(EntityEntityModeToTuplizerMapping.java:56)
>
> at
> org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:302)
>
> at
> org.hibernate.persister.entity.AbstractEntityPersister.<init >(AbstractEntityPersister.java:434)
>
> at
> org.hibernate.persister.entity.JoinedSubclassEntityPersister . <init>(JoinedSubclassEntityPersister.java:91)
>
> at
> org.hibernate.persister.PersisterFactory.createClassPersiste r(PersisterFactory.java:58)
>
> at
> org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
> at
> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1300)
>
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getSessionFactory(HibernatePackageHandler.java:273 )
>
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.readPackageInfos(HibernatePackageHandler.java:244)
>
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getCDOPackageInfos(HibernatePackageHandler.java:18 8)
>
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Reader.readPackageInfos(HibernateStoreReader.java:87)
>
> at
> org.eclipse.emf.cdo.internal.server.PackageManager.doActivat e(PackageManager.java:72)
>
> at
> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>
> at
> org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:263)
>
> at
> org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:250)
>
> at
> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>
> at
> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
>
> at
> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
>
> at
> org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
>
> at
> my.tests.WeightedLinkPersistenceTests.setUp(WeightedLinkPers istenceTests.java:92)
>
> 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.junit.internal.runners.BeforeAndAfterRunner.invokeMethod (BeforeAndAfterRunner.java:74)
>
> at
> org.junit.internal.runners.BeforeAndAfterRunner.runBefores(B eforeAndAfterRunner.java:50)
>
> at
> org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:33)
>
> at
> org.junit.internal.runners.TestMethodRunner.runMethod(TestMe thodRunner.java:75)
>
> at
> org.junit.internal.runners.TestMethodRunner.run(TestMethodRu nner.java:45)
> at
> org.junit.internal.runners.TestClassMethodsRunner.invokeTest Method(TestClassMethodsRunner.java:66)
>
> at
> org.junit.internal.runners.TestClassMethodsRunner.run(TestCl assMethodsRunner.java:35)
>
> at
> org.junit.internal.runners.TestClassRunner$1.runUnprotected( TestClassRunner.java:42)
>
> at
> org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:34)
>
> at
> org.junit.internal.runners.TestClassRunner.run(TestClassRunn er.java:52)
> at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:45)
>
> at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
>
> at
> org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunne r.main(RemotePluginTestRunner.java:62)
>
> at
> org.eclipse.pde.internal.junit.runtime.UITestApplication$1.r un(UITestApplication.java:118)
>
> at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
> at
> org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:130)
>
> at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3750)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3375)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2375)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2339)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 05)
> at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:478)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:288)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:473)
>
> at
> org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at
> org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
>
> at
> org.eclipse.pde.internal.junit.runtime.UITestApplication.sta rt(UITestApplication.java:52)
>
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:193)
>
> 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:362)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:175)
>
> 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: 549)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
> Caused by: java.lang.reflect.InvocationTargetException
> 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 net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java :384)
> at
> net.sf.cglib.core.AbstractClassGenerator.create(AbstractClas sGenerator.java:219)
>
> ... 74 more
> Caused by: java.lang.NoClassDefFoundError:
> org/hibernate/proxy/HibernateProxy
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(Unknown Source)
> ... 80 more
> Caused by: java.lang.ClassNotFoundException:
> org.hibernate.proxy.HibernateProxy
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl assInternal(BundleLoader.java:481)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:397)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:385)
>
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:87)
>
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
> ... 82 more
>
>
> Again a classloader problem, I think.
> Tried a lot of alternatives of moving hibernate3.jar around and create
> and delete copies of it.
> No effect.
>
> Giving up for today - maybe there's some light of wisdom coming to me
> (or you?).
>
> Anyway, have a nice weekend
>
> Stefan
>
>
|
|
|
Re: [CDO-Teneo-Hibernate] Experience report and errors: Migrating from classic MySQLAdapter-backed s [message #120575 is a reply to message #120152] |
Tue, 29 April 2008 14:28 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Stefan Winkler![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=stefan%40winklerweb.net) Messages: 307 Registered: July 2009 Location: Germany |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------010208080508020408020101
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Hi Martin,
Martin Taal schrieb:
> Hi Stefan,
> See my comments below.
>
> gr. Martin
>
> Stefan Winkler wrote:
>> Hi,
>>
>> today, I learned that Eclipse is always good for some extra fun.
>> For some reason it deleted the
>> <classpathentry kind="con"
>> path="org.eclipse.pde.core.requiredPlugins"/>
>> from the .classpath file in all project in my workspace. It is creepy
>> when Eclipse does not find a single dependency anymore.
>> Luckily I was able to locate the problem after some time - so now I
>> am back and ready to proceed.
>>
>> Thanks, Martin, for all your comments. As you might have guessed,
>> most errors I wrote were simple typos / paste errors:
>>>> Hi,
>>>>
>>>> since I had to convince some of the components of working together,
>>>> I'll report my steps and experiences here:
>>>> Since I did not have any official guide on how to set up
>>>> everything, I just did trial and error. So please comment, if there
>>>> is any easier or more conformant way of getting CDO-Hibernate to
>>>> run...
>>>>
>>>> - Downloaded Eclipse-3.4M6-modeling
>>>> - [added my favourite plugins - subversive, java2html, keepresident]
>>>> - [Create a working set for the sources of CDO etc. to keep them in
>>>> one place]
>>>> - CVS checkout of everything in
>>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD >
>>>> org.eclipse.emf > org.eclipse.emf.cdo > plugins
>>>> - CVS checkout of everything in
>>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD >
>>>> org.eclipse.emf > org.eclipse.emf.cdo > hibernate
>>>> [@Eike: there are two (conflicting) folders
>>>> org.eclipse.emf.cdo.server.hibernate one in plugins, one in hibernate]
>>> MT>> You should take the ones from the hibernate folder
>> Sure - this was just to report that it could cause misunderstandings.
>> @Eike: the folder in plugins is empty, you just get a conflict, if
>> you try to check out everything at once because of two folders /
>> projects with the same name.
>>>> - CVS checkout of everything in
>>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD >
>>>> org.eclipse.emf > org.eclipse.emf.cdo > tests
>>>> - CVS checkout of everything in
>>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD >
>>>> org.eclipse.emf > org.eclipse.emf.net4j > plugins
>>>> - CVS checkout of following projects in
>>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD >
>>>> org.eclipse.emf > org.eclipse.emf.teneo > plugins
>>>> * org.eclipse.emf.teneo
>>>> * org.eclipse.emf.teneo.annotations
>>>> * org.eclipse.emf.teneo.hibernate.mapper
>>> MT>> I think you also need org.eclipse.emf.teneo.libraries
>> Mhh .. it is not required and AFAIK there's only commons-logging.jar
>> in there, which has to be copied into
>> org.eclipse.emf.cdo.server.hibernate.libraries/lib anyway.
> MT2>> Yes you are right, I changed the dependencies method of the
> teneo plugins
> to import packages so as long as there is another plugin serving
> commons-logging.jar
> then you are okay.
>
>>
>>>> - get hold of these libraries:
>>>> * hibernate3.jar
>>>> * asm.jar
>>>> * cglib-2.1.3.jar
>>>> * commons-collections-2.1.1.jar
>>>> * commons-logging-1.0.4.jar
>>>> * dom4j-1.6.1.jar
>>>> * jta.jar
>>>> * mysql-connector-java-5.1.5-bin.jar
>>>> * hsqldb.jar
>>>> - copy hsqldb.jar to org.eclipse.net4j.db.hsqldb/lib
>>> MT>> org.eclipse.net4j.db.hsqldb is not used in the teneo-hibernate
>>> integration
>>>
>>>> - copy mysql-connector-java-5.1.5-bin.jar to
>>>> org.eclipse.net4j.db.mysql/lib
>>> MT>> org.eclipse.net4j.db.mysql is not used in the teneo-hibernate
>>> integration
>> You're right - one could completely leave out the net4j.db.*
>> libraries when using Hibernate.
>>>
>>>> - copy mysql-connector-java-5.1.5-bin.jar to
>>>> org.eclipse.emf.cdo.tests.hibernate
>>> MT>> should be to the lib directory in this plugin
>> Correct - typo. :-)
>>>
>>>> - copy the following libraries to
>>>> org.eclipse.emf.cdo.server.hibernate.libraries/lib
>>>> * hibernate3.jar
>>>> * asm.jar
>>>> * cglib-2.1.3.jar
>>>> * commons-collections-2.1.1.jar
>>>> * commons-logging-1.0.4.jar
>>>> * dom4j-1.6.1.jar
>>>> * jta.jar
>>>> * hsqldb.jar
>>>> - copy the following libraries to
>>>> org.eclipse.emf.teneo.hibernate.mapper:
>>>> * hibernate3.jar
>>>> * dom4j-1.6.1.jar
>>> MT>> It should not be necessary to copy jars to
>>> org.eclipse.emf.teneo.hibernate.mapper
>> Hmmm ... maybe that depends on how it is used / deployed?
>> I get build errors that those two libraries can not be resolved.
> MT2>> Can you post a screenshot then I can try to solve this as it should
> not be required.
You seem to have updated build.properties yesterday so now there's no
problem anymore.
>>>
>>>>
>>>> - Try out new store with small test case:
>>>>
>>>> |IManagedContainer container = IPluginContainer.INSTANCE;
>>>> acceptor = JVMUtil.getAcceptor(container, "default");
>>>> store = *new *HibernateStore(*new
>>>> *TeneoHibernateMappingProvider());
>>>> Map<String, String> props = *new
>>>> *HashMap<String, String>();
>>>> props.put(Props.PROP_OVERRIDE_UUID,
>>>> "f8188187-65de-4c8a-8e75-e0ce5949837a");
>>>> props.put(Props.PROP_SUPPORTING_AUDITS, "false");
>>>> props.put(Props.PROP_SUPPORTING_REVISION_DELTAS, "false");
>>>> props.put(Props.PROP_VERIFYING_REVISIONS, "false");
>>>> props.put(Props.PROP_CURRENT_LRU_CAPACITY, "10000");
>>>> props.put(Props.PROP_REVISED_LRU_CAPACITY, "10000");
>>>> props.put("hibernate.connection.autocommit","true");
>>>>
>>>> props.put("hibernate.cache.provider_class","=org.hibernate.cache.HashtableCacheProvider ");
>>>>
>>>>
>>>> props.put("hibernate.connection.driver_class","com.mysql.jdbc.Driver ");
>>>>
>>>>
>>>> props.put("hibernate.connection.url","jdbc:mysql://localhost:3306/"
>>>> + DB_NAME);
>>>> props.put("hibernate.connection.username", DB_USER);
>>>> props.put("hibernate.connection.password", DB_PASS);
>>>>
>>>> props.put("hibernate.dialect","org.hibernate.dialect.MySQLInnoDBDialect ");
>>>>
>>>> repository = CDOServerUtil.createRepository(repositoryName,
>>>> store,
>>>> props);
>>>> CDOServerUtil.addRepository(container, repository);
>>>> connector = JVMUtil.getConnector(container, "default");
>>>> session = CDOUtil.openSession(connector, repositoryName,
>>>> *true*);
>>>> transaction = session.openTransaction();
>>>>
>>>> session.getPackageRegistry().putEPackage(ArtifactBasePackage .eINSTANCE);
>>>>
>>>>
>>>> session.getPackageRegistry().putEPackage(RequipsePackage.eIN STANCE);
>>>>
>>>> session.getPackageRegistry().putEPackage(WeightedLinksPackag e.eINSTANCE);
>>>>
>>>> resource = transaction.getOrCreateResource(RESOURCE_PATH);
>>>> // etc ... (put stuff into repository)
>>>>
>>>> |
>>>>
>>>>
>>>> => I can't get hibernate to find the mysql driver class. Tried
>>>> putting mysql-connector-java-5.1.5-bin.jar in my test plugin, tried
>>>> exporting packages and using Eclipse-BuddyPolicy: dependent but no
>>>> success.
>>> MT>> In which plugin did you set dependent? It should be in the one
>>> with the hibernate libraries
>>> The mysql jar must be in the lib directory of the hibernate.test plugin
>> I created a new test plugin for my own stuff. But if I place the
>> mysql driver there, hibernate does not find it.
>>>
>>>> => temp solution: add mysql-connector-java-5.1.5-bin.jar to
>>>> org.eclipse.emf.cdo.server.hibernate.libraries project and add it
>>>> to that Bundle-ClassPath
>>> MT>> Yes this is also fine
>>>
>>>> => class is now found
>>>>
>>>> - next error is
>>>> 24.04.2008 16:58:54 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
>>>> FATAL: could not complete schema update
>>>> org.hibernate.MappingException: Could not determine type for:
>>>> org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOTy peUserType,
>>>> at table: cdo_features, for columns:
>>>> [org.hibernate.mapping.Column(type)]
>>>> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 69)
>>>> at org.hibernate.mapping.Column.getSqlTypeCode(Column.java:138)
>>>> at org.hibernate.mapping.Column.getSqlType(Column.java:182)
>>>> at org.hibernate.mapping.Table.sqlCreateString(Table.java:397)
>>>> at
>>>> org.hibernate.cfg.Configuration.generateSchemaUpdateScript(C onfiguration.java:962)
>>>>
>>>> at
>>>> org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate .java:140)
>>>> at
>>>> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.initSchema(HibernatePackageHandler.java:346)
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.doActivate(HibernatePackageHandler.java:307)
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore .doActivate(HibernateStore.java:205)
>>>>
>>>> at
>>>> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>>>>
>>>> at
>>>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
>>>>
>>>> at
>>>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:262)
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:250)
>>>>
>>>> at
>>>> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>>>>
>>>> at
>>>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
>>>>
>>>> at
>>>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
>>>>
>>>>
>>>> Giving up for today - maybe this error is familiar to someone?
>>>> Eike? Martin?
>>> MT>> Do you have this class
>>> (org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOT ypeUserType)
>>> in the org.eclipse.emf.cdo.server.hibernate plugin?
>> Yes.
>> The problem is, as far as I can see after some debugging, a
>> classloader problem.
>>
>> The mapping which makes problems is
>>
>> [...]
>> <joined-subclass name="CDOFeatureImpl" table="cdo_features"
>> extends="CDOModelElementImpl">
>> <key/>
>> <property name="featureID" column="feature" type="int"
>> not-null="true" />
>> / <property name="type"
>> type=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOTy peUserType "
>>
>> not-null="false" />
>> /[...]
>>
>> from org.eclipse.emf.cdo.server.hibernate/mappings/meta.hbm.xml
>>
>> When the schema is to be created, hibernate iterated through the
>> mappings and comes to the mapping above.
>> Then we are at org.hibernate.mapping.SimpleValue.getType() (line 260)
>>
>> Type result = TypeFactory.heuristicType(typeName, typeParameters);
>>
>> where he tries to load the type via ReflectHelper.classForName(
>> typeName ); and fails.
>>
>> After some trial and error, I found out that adding
>>
>> Eclipse-BuddyPolicy: dependent
>>
>> to the MANIFEST.MF of org.eclipse.emf.cdo.server.hibernate.libraries
>> does the trick. With this policy set, the class is found and I can
>> even again delete the mysql driver class from
>> org.eclipse.emf.cdo.server.hibernate.libraries.
> MT2>> Yes I was/am actually surprised that our testcases run without
> this Eclipse-Buddypolicy
> setting, so setting it seems a good idea.
Is there a testcase using an embedded server/client (meaning: a net4j
JVM connection?). I guess a lot of the trouble is caused by this setting.
I can run the standalone hibernate server for the testcases with no
problem, but has any of you two tried testing with server and client
inside one JVM?
I started over and wiped my workspace today.
I checked out:
org.eclipse.emf.cdo
org.eclipse.emf.cdo.protocol
org.eclipse.emf.cdo.server
org.eclipse.emf.cdo.server.hibernate
org.eclipse.emf.cdo.server.hibernate.id
org.eclipse.emf.cdo.server.hibernate.libraries
org.eclipse.emf.cdo.server.hibernate.teneo
org.eclipse.emf.teneo
org.eclipse.emf.teneo.annotations
org.eclipse.emf.teneo.hibernate.mapper
org.eclipse.net4j
org.eclipse.net4j.jvm
org.eclipse.net4j.util
and added these libraries:
/org.eclipse.emf.cdo.server.hibernate.libraries/lib/asm.jar
/org.eclipse.emf.cdo.server.hibernate.libraries/lib/cglib-2. 1.3.jar
/org.eclipse.emf.cdo.server.hibernate.libraries/lib/commons- collections-2.1.1.jar
/org.eclipse.emf.cdo.server.hibernate.libraries/lib/commons- logging-1.0.4.jar
/org.eclipse.emf.cdo.server.hibernate.libraries/lib/dom4j-1. 6.1.jar
/org.eclipse.emf.cdo.server.hibernate.libraries/lib/hibernat e3.jar
/org.eclipse.emf.cdo.server.hibernate.libraries/lib/jta.jar
and (for now):
/org.eclipse.emf.cdo.server.hibernate.libraries/lib/mysql-co nnector-java-5.1.5-bin.jar
I also added the mysql libraries to the runtime classpath.
To analyze class loading problems I turned on tracing of "debug/loader"
of the org.eclipse.osgi bundle.
With this configuration I get this issue:
29.04.2008 11:06:58 org.hibernate.cfg.Configuration
secondPassCompileForeignKeys
FEIN: resolving reference to class:
org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl
BundleClassLoader[org.eclipse.emf.cdo.server.hibernate.libra ries_0.8.0.qualifier].loadClass(org.eclipse.emf.cdo.server.i nternal.hibernate.tuplizer.CDOIDMetaRangeUserType)
BundleLoader[org.eclipse.emf.cdo.server.hibernate.libraries_ 0.8.0.qualifier].loadBundleClass(org.eclipse.emf.cdo.server. internal.hibernate.tuplizer.CDOIDMetaRangeUserType)
BundleLoader[org.eclipse.emf.cdo.server.hibernate.libraries_ 0.8.0.qualifier].findLocalClass(org.eclipse.emf.cdo.server.i nternal.hibernate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\hiberna te3.jar].findClass(org.eclipse.emf.cdo.server.internal.hiber nate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\asm.jar ].findClass(org.eclipse.emf.cdo.server.internal.hibernate.tu plizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\cglib-2 .1.3.jar].findClass(org.eclipse.emf.cdo.server.internal.hibe rnate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\commons -collections-2.1.1.jar].findClass(org.eclipse.emf.cdo.server .internal.hibernate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\commons -logging-1.0.4.jar].findClass(org.eclipse.emf.cdo.server.int ernal.hibernate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\dom4j-1 .6.1.jar].findClass(org.eclipse.emf.cdo.server.internal.hibe rnate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\jta.jar ].findClass(org.eclipse.emf.cdo.server.internal.hibernate.tu plizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\mysql-c onnector-java-5.1.5-bin.jar].findClass(org.eclipse.emf.cdo.s erver.internal.hibernate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[org.eclipse.emf.cdo.server.hibernate.libra ries_0.8.0.qualifier].loadClass(org.eclipse.emf.cdo.server.i nternal.hibernate.tuplizer.CDOIDMetaRangeUserType)
failed.
java.lang.ClassNotFoundException:
org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOID MetaRangeUserType
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl assInternal(BundleLoader.java:481)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:397)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:385)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:87)
at java.lang.ClassLoader.loadClass(Unknown Source)
at
org.eclipse.core.runtime.internal.adaptor.ContextFinder.load Class(ContextFinder.java:124)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper. java:95)
at org.hibernate.type.TypeFactory.heuristicType(TypeFactory.jav a:223)
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 60)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:2 53)
at org.hibernate.mapping.Property.isValid(Property.java:185)
at
org.hibernate.mapping.PersistentClass.validate(PersistentCla ss.java:440)
at org.hibernate.mapping.JoinedSubclass.validate(JoinedSubclass .java:40)
at org.hibernate.cfg.Configuration.validate(Configuration.java: 1108)
at
org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1293)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getSessionFactory(HibernatePackageHandler.java:332 )
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.readPackageInfos(HibernatePackageHandler.java:290)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getCDOPackageInfos(HibernatePackageHandler.java:21 2)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Reader.readPackageInfos(HibernateStoreReader.java:87)
at
org.eclipse.emf.cdo.internal.server.PackageManager.doActivat e(PackageManager.java:72)
at
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
at
org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:264)
at
org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:251)
at
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
at
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
at
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
at
org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
at mytest.MyTest.setUp(MyTest.java:88)
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.junit.internal.runners.BeforeAndAfterRunner.invokeMethod (BeforeAndAfterRunner.java:74)
at
org.junit.internal.runners.BeforeAndAfterRunner.runBefores(B eforeAndAfterRunner.java:50)
at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:33)
at
org.junit.internal.runners.TestMethodRunner.runMethod(TestMe thodRunner.java:75)
at
org.junit.internal.runners.TestMethodRunner.run(TestMethodRu nner.java:45)
at
org.junit.internal.runners.TestClassMethodsRunner.invokeTest Method(TestClassMethodsRunner.java:66)
at
org.junit.internal.runners.TestClassMethodsRunner.run(TestCl assMethodsRunner.java:35)
at
org.junit.internal.runners.TestClassRunner$1.runUnprotected( TestClassRunner.java:42)
at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:34)
at
org.junit.internal.runners.TestClassRunner.run(TestClassRunn er.java:52)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:45)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
at
org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunne r.main(RemotePluginTestRunner.java:62)
at
org.eclipse.pde.internal.junit.runtime.CoreTestApplication.r un(CoreTestApplication.java:23)
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.internal.app.EclipseAppContainer.callMet hod(EclipseAppContainer.java:565)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:195)
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:362)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:175)
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: 549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
BundleClassLoader[org.eclipse.emf.cdo.server.hibernate.libra ries_0.8.0.qualifier].loadClass(org.eclipse.emf.cdo.server.i nternal.hibernate.tuplizer.CDOIDMetaRangeUserType)
BundleLoader[org.eclipse.emf.cdo.server.hibernate.libraries_ 0.8.0.qualifier].loadBundleClass(org.eclipse.emf.cdo.server. internal.hibernate.tuplizer.CDOIDMetaRangeUserType)
BundleLoader[org.eclipse.emf.cdo.server.hibernate.libraries_ 0.8.0.qualifier].findLocalClass(org.eclipse.emf.cdo.server.i nternal.hibernate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\hiberna te3.jar].findClass(org.eclipse.emf.cdo.server.internal.hiber nate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\asm.jar ].findClass(org.eclipse.emf.cdo.server.internal.hibernate.tu plizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\cglib-2 .1.3.jar].findClass(org.eclipse.emf.cdo.server.internal.hibe rnate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\commons -collections-2.1.1.jar].findClass(org.eclipse.emf.cdo.server .internal.hibernate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\commons -logging-1.0.4.jar].findClass(org.eclipse.emf.cdo.server.int ernal.hibernate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\dom4j-1 .6.1.jar].findClass(org.eclipse.emf.cdo.server.internal.hibe rnate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\jta.jar ].findClass(org.eclipse.emf.cdo.server.internal.hibernate.tu plizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\mysql-c onnector-java-5.1.5-bin.jar].findClass(org.eclipse.emf.cdo.s erver.internal.hibernate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[org.eclipse.emf.cdo.server.hibernate.libra ries_0.8.0.qualifier].loadClass(org.eclipse.emf.cdo.server.i nternal.hibernate.tuplizer.CDOIDMetaRangeUserType)
failed.
java.lang.ClassNotFoundException:
org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOID MetaRangeUserType
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl assInternal(BundleLoader.java:481)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:397)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:385)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:87)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper. java:100)
at org.hibernate.type.TypeFactory.heuristicType(TypeFactory.jav a:223)
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 60)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:2 53)
at org.hibernate.mapping.Property.isValid(Property.java:185)
at
org.hibernate.mapping.PersistentClass.validate(PersistentCla ss.java:440)
at org.hibernate.mapping.JoinedSubclass.validate(JoinedSubclass .java:40)
at org.hibernate.cfg.Configuration.validate(Configuration.java: 1108)
at
org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1293)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getSessionFactory(HibernatePackageHandler.java:332 )
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.readPackageInfos(HibernatePackageHandler.java:290)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getCDOPackageInfos(HibernatePackageHandler.java:21 2)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Reader.readPackageInfos(HibernateStoreReader.java:87)
at
org.eclipse.emf.cdo.internal.server.PackageManager.doActivat e(PackageManager.java:72)
at
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
at
org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:264)
at
org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:251)
at
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
at
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
at
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
at
org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
at mytest.MyTest.setUp(MyTest.java:88)
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.junit.internal.runners.BeforeAndAfterRunner.invokeMethod (BeforeAndAfterRunner.java:74)
at
org.junit.internal.runners.BeforeAndAfterRunner.runBefores(B eforeAndAfterRunner.java:50)
at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:33)
at
org.junit.internal.runners.TestMethodRunner.runMethod(TestMe thodRunner.java:75)
at
org.junit.internal.runners.TestMethodRunner.run(TestMethodRu nner.java:45)
at
org.junit.internal.runners.TestClassMethodsRunner.invokeTest Method(TestClassMethodsRunner.java:66)
at
org.junit.internal.runners.TestClassMethodsRunner.run(TestCl assMethodsRunner.java:35)
at
org.junit.internal.runners.TestClassRunner$1.runUnprotected( TestClassRunner.java:42)
at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:34)
at
org.junit.internal.runners.TestClassRunner.run(TestClassRunn er.java:52)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:45)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
at
org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunne r.main(RemotePluginTestRunner.java:62)
at
org.eclipse.pde.internal.junit.runtime.CoreTestApplication.r un(CoreTestApplication.java:23)
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.internal.app.EclipseAppContainer.callMet hod(EclipseAppContainer.java:565)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:195)
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:362)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:175)
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: 549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
Ok - the problem seems to be that the
org.eclipse.emf.cdo.server.hibernate.libraries Bundle where
hibernate3.jar lives does not see org.eclipse.emf.cdo.server which
defines the mapping types.
Idea: add Eclipse-BuddyPolicy: dependent.
Thus, I also can move the mysql-driver to my test case Bundle.
This leads to:
BundleClassLoader[org.eclipse.emf.cdo.protocol_0.8.0.qualifi er].loadClass(org.hibernate.proxy.HibernateProxy)
BundleLoader[org.eclipse.emf.cdo.protocol_0.8.0.qualifier].l oadBundleClass(org.hibernate.proxy.HibernateProxy)
BundleLoader[org.eclipse.emf.cdo.protocol_0.8.0.qualifier].f indLocalClass(org.hibernate.proxy.HibernateProxy)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.protocol\bin].findClass(org.hibernate. proxy.HibernateProxy)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.protocol].findClass(org.hibernate.prox y.HibernateProxy)
BundleClassLoader[*org.eclipse.emf.cdo.protocol_0.8.0.qualif ier*].loadClass(org.hibernate.proxy.HibernateProxy)
failed.
java.lang.ClassNotFoundException: *org.hibernate.proxy.HibernateProxy*
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl assInternal(BundleLoader.java:481)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:397)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:385)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:87)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
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 net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java :384)
at
net.sf.cglib.core.AbstractClassGenerator.create(AbstractClas sGenerator.java:219)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
at
org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxy Factory(CGLIBLazyInitializer.java:127)
at
org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstant iate(CGLIBProxyFactory.java:43)
at
org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFact ory(PojoEntityTuplizer.java:162)
at
org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)
at
org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at
org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping . <init>(EntityEntityModeToTuplizerMapping.java:56)
at
org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:302)
at
org.hibernate.persister.entity.AbstractEntityPersister.<init >(AbstractEntityPersister.java:434)
at
org.hibernate.persister.entity.JoinedSubclassEntityPersister . <init>(JoinedSubclassEntityPersister.java:91)
at
org.hibernate.persister.PersisterFactory.createClassPersiste r(PersisterFactory.java:58)
at
org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
at
org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1300)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getSessionFactory(HibernatePackageHandler.java:332 )
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.readPackageInfos(HibernatePackageHandler.java:290)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getCDOPackageInfos(HibernatePackageHandler.java:21 2)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Reader.readPackageInfos(HibernateStoreReader.java:87)
at
org.eclipse.emf.cdo.internal.server.PackageManager.doActivat e(PackageManager.java:72)
at
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
at
org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:264)
at
org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:251)
at
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
at
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
at
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
at
org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
at mytest.MyTest.setUp(MyTest.java:88)
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.junit.internal.runners.BeforeAndAfterRunner.invokeMethod (BeforeAndAfterRunner.java:74)
at
org.junit.internal.runners.BeforeAndAfterRunner.runBefores(B eforeAndAfterRunner.java:50)
at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:33)
at
org.junit.internal.runners.TestMethodRunner.runMethod(TestMe thodRunner.java:75)
at
org.junit.internal.runners.TestMethodRunner.run(TestMethodRu nner.java:45)
at
org.junit.internal.runners.TestClassMethodsRunner.invokeTest Method(TestClassMethodsRunner.java:66)
at
org.junit.internal.runners.TestClassMethodsRunner.run(TestCl assMethodsRunner.java:35)
at
org.junit.internal.runners.TestClassRunner$1.runUnprotected( TestClassRunner.java:42)
at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:34)
at
org.junit.internal.runners.TestClassRunner.run(TestClassRunn er.java:52)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:45)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
at
org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunne r.main(RemotePluginTestRunner.java:62)
at
org.eclipse.pde.internal.junit.runtime.CoreTestApplication.r un(CoreTestApplication.java:23)
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.internal.app.EclipseAppContainer.callMet hod(EclipseAppContainer.java:565)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:195)
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:362)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:175)
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: 549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
BundleClassLoader[org.eclipse.emf.cdo.server.hibernate_0.8.0 .qualifier].loadClass(org.eclipse.emf.cdo.server.internal.hi bernate.HibernateThreadContext)
BundleLoader[org.eclipse.emf.cdo.server.hibernate_0.8.0.qual ifier].loadBundleClass(org.eclipse.emf.cdo.server.internal.h ibernate.HibernateThreadContext)
BundleLoader[org.eclipse.emf.cdo.server.hibernate_0.8.0.qual ifier].findLocalClass(org.eclipse.emf.cdo.server.internal.hi bernate.HibernateThreadContext)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate\bin].findClass(org.ec lipse.emf.cdo.server.internal.hibernate.HibernateThreadConte xt)
about to read 2680 bytes from
org/eclipse/emf/cdo/server/internal/hibernate/HibernateThrea dContext.class
read 2680 bytes from
C:\work\work\diss\requipse-workspace-temp-2\org.eclipse.emf. cdo.server.hibernate\bin/org/eclipse/emf/cdo/server/internal /hibernate/HibernateThreadContext.class
defining class
org.eclipse.emf.cdo.server.internal.hibernate.HibernateThrea dContext
BundleLoader[org.eclipse.emf.cdo.server.hibernate_0.8.0.qual ifier] found
local class
org.eclipse.emf.cdo.server.internal.hibernate.HibernateThrea dContext
net.sf.cglib.core.CodeGenerationException:
java.lang.reflect.InvocationTargetException-->null
at
net.sf.cglib.core.AbstractClassGenerator.create(AbstractClas sGenerator.java:237)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
at
org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxy Factory(CGLIBLazyInitializer.java:127)
at
org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstant iate(CGLIBProxyFactory.java:43)
at
org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFact ory(PojoEntityTuplizer.java:162)
at
org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)
at
org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at
org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping . <init>(EntityEntityModeToTuplizerMapping.java:56)
at
org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:302)
at
org.hibernate.persister.entity.AbstractEntityPersister.<init >(AbstractEntityPersister.java:434)
at
org.hibernate.persister.entity.JoinedSubclassEntityPersister . <init>(JoinedSubclassEntityPersister.java:91)
at
org.hibernate.persister.PersisterFactory.createClassPersiste r(PersisterFactory.java:58)
at
org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
at
org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1300)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getSessionFactory(HibernatePackageHandler.java:332 )
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.readPackageInfos(HibernatePackageHandler.java:290)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getCDOPackageInfos(HibernatePackageHandler.java:21 2)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Reader.readPackageInfos(HibernateStoreReader.java:87)
at
org.eclipse.emf.cdo.internal.server.PackageManager.doActivat e(PackageManager.java:72)
at
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
at
org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:264)
at
org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:251)
at
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
at
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
at
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
at
org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
at mytest.MyTest.setUp(MyTest.java:88)
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.junit.internal.runners.BeforeAndAfterRunner.invokeMethod (BeforeAndAfterRunner.java:74)
at
org.junit.internal.runners.BeforeAndAfterRunner.runBefores(B eforeAndAfterRunner.java:50)
at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:33)
at
org.junit.internal.runners.TestMethodRunner.runMethod(TestMe thodRunner.java:75)
at
org.junit.internal.runners.TestMethodRunner.run(TestMethodRu nner.java:45)
at
org.junit.internal.runners.TestClassMethodsRunner.invokeTest Method(TestClassMethodsRunner.java:66)
at
org.junit.internal.runners.TestClassMethodsRunner.run(TestCl assMethodsRunner.java:35)
at
org.junit.internal.runners.TestClassRunner$1.runUnprotected( TestClassRunner.java:42)
at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:34)
at
org.junit.internal.runners.TestClassRunner.run(TestClassRunn er.java:52)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:45)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
at
org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunne r.main(RemotePluginTestRunner.java:62)
at
org.eclipse.pde.internal.junit.runtime.CoreTestApplication.r un(CoreTestApplication.java:23)
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.internal.app.EclipseAppContainer.callMet hod(EclipseAppContainer.java:565)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:195)
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:362)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:175)
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: 549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
Caused by: java.lang.reflect.InvocationTargetException
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 net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java :384)
at
net.sf.cglib.core.AbstractClassGenerator.create(AbstractClas sGenerator.java:219)
... 66 more
Caused by: java.lang.NoClassDefFoundError:
org/hibernate/proxy/HibernateProxy
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
... 72 more
Caused by: java.lang.ClassNotFoundException:
org.hibernate.proxy.HibernateProxy
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl assInternal(BundleLoader.java:481)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:397)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:385)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:87)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 74 more
As far as I can see, Java tries to load the class
*org.hibernate.proxy.HibernateProxy* from the bundle
*org.eclipse.emf.cdo.protocol_0.8.0.qualifier*. Why so? I think because of
net.sf.cglib.proxy.Enhancer.getDefaultClassLoader (Enhancer.java:386):
protected ClassLoader getDefaultClassLoader() {
if (superclass != null) {
return superclass.getClassLoader();
Superclass is org.eclipse.emf.cdo.internal.protocol.model.CDOFeatureImpl
in this call.
Maybe this is a bug in CGLib or Hibernate, because it implicitly assumes
that the class loader of the super class of a class to persist is able
to locate the HibernateProxy interface, which is not the case here. As a
workaround, I add the Eclipse-BuddyPolicy: dependent property to the
*org.eclipse.emf.cdo.protocol *bundle as well.
.... works (well, a bit): I am able to create the repository, session and
transaction, I can create my model and add it to a newly created repository.
However, I am not able to commit, because for some reason, the
cdo_resource table is not created.
FEIN: begin
29.04.2008 16:05:35 org.hibernate.jdbc.ConnectionManager openConnection
FEIN: opening JDBC connection
29.04.2008 16:05:35
org.hibernate.connection.DriverManagerConnectionProvider getConnection
AM FEINSTEN: total checked-out connections: 0
29.04.2008 16:05:35
org.hibernate.connection.DriverManagerConnectionProvider getConnection
AM FEINSTEN: using pooled JDBC connection, pool size: 0
29.04.2008 16:05:35 org.hibernate.transaction.JDBCTransaction begin
FEIN: current autocommit status: true
29.04.2008 16:05:35 org.hibernate.transaction.JDBCTransaction begin
FEIN: disabling autocommit
29.04.2008 16:05:35 org.hibernate.jdbc.JDBCContext afterTransactionBegin
AM FEINSTEN: after transaction begin
29.04.2008 16:05:35
org.hibernate.event.def.DefaultSaveOrUpdateEventListener entityIsTransient
AM FEINSTEN: saving transient instance
29.04.2008 16:05:35 org.hibernate.event.def.AbstractSaveEventListener
performSave
AM FEINSTEN: saving [CDOResource#<null>]
29.04.2008 16:05:35 org.hibernate.event.def.AbstractSaveEventListener
performSaveOrReplicate
AM FEINSTEN: executing insertions
29.04.2008 16:05:35 org.hibernate.engine.Cascade cascade
AM FEINSTEN: processing cascade ACTION_SAVE_UPDATE for: CDOResource
29.04.2008 16:05:35 org.hibernate.engine.Cascade cascade
AM FEINSTEN: done processing cascade ACTION_SAVE_UPDATE for: CDOResource
29.04.2008 16:05:35 org.hibernate.engine.Versioning seedVersion
AM FEINSTEN: using initial version: 1
29.04.2008 16:05:35 org.hibernate.event.def.WrapVisitor
processArrayOrNewCollection
AM FEINSTEN: Wrapped collection in role: CDOResource.contents
Thread-4 [debug] Stored hb list in threadlocal: CDOResource.contents
29.04.2008 16:05:35 org.hibernate.event.def.AbstractSaveEventListener
performSaveOrReplicate
FEIN: executing identity-insert immediately
29.04.2008 16:05:35
org.hibernate.persister.entity.AbstractEntityPersister insert
AM FEINSTEN: Inserting entity: CDOResource (native id)
29.04.2008 16:05:35
org.hibernate.persister.entity.AbstractEntityPersister insert
AM FEINSTEN: Version: 1
29.04.2008 16:05:35 org.hibernate.jdbc.AbstractBatcher
logOpenPreparedStatement
FEIN: about to open PreparedStatement (open PreparedStatements: 0,
globally: 0)
29.04.2008 16:05:35 org.hibernate.jdbc.AbstractBatcher log
FEIN: insert into `cdo_resources` (e_version, path, `dtype`) values (?,
?, 'cdoresource')
29.04.2008 16:05:35 org.hibernate.jdbc.AbstractBatcher getPreparedStatement
AM FEINSTEN: preparing statement
Thread-4 [debug] Clearing used hibernate session
Thread-4 [debug] Clearing commitcontext in threadlocal
29.04.2008 16:05:35
org.hibernate.persister.entity.AbstractEntityPersister dehydrate
AM FEINSTEN: Dehydrating entity: [CDOResource#<null>]
29.04.2008 16:05:35 org.hibernate.type.NullableType nullSafeSet
AM FEINSTEN: binding '1' to parameter: 1
29.04.2008 16:05:35 org.hibernate.type.NullableType nullSafeSet
AM FEINSTEN: binding '/my/test/resource' to parameter: 2
29.04.2008 16:05:35 org.hibernate.jdbc.AbstractBatcher
logClosePreparedStatement
FEIN: about to close PreparedStatement (open PreparedStatements: 1,
globally: 1)
29.04.2008 16:05:35 org.hibernate.jdbc.AbstractBatcher
closePreparedStatement
AM FEINSTEN: closing statement
29.04.2008 16:05:35 org.hibernate.util.JDBCExceptionReporter logExceptions
FEIN: could not insert: [CDOResource] [insert into `cdo_resources`
(e_version, path, `dtype`) values (?, ?, 'cdoresource')]
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table
'requipse.cdo_resources' doesn't exist
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Nativ e Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknow n Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Un known
Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.Util.getInstance(Util.java:381)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:103 1)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957 )
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3376)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3308)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1837)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1961)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:25 43)
at
com.mysql.jdbc.PreparedStatement.executeInternal(PreparedSta tement.java:1737)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedState ment.java:2022)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedState ment.java:1940)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedState ment.java:1925)
at
org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate. executeAndExtract(IdentityGenerator.java:73)
at
org.hibernate.id.insert.AbstractReturningDelegate.performIns ert(AbstractReturningDelegate.java:33)
at
org.hibernate.persister.entity.AbstractEntityPersister.inser t(AbstractEntityPersister.java:2163)
at
org.hibernate.persister.entity.AbstractEntityPersister.inser t(AbstractEntityPersister.java:2643)
at
org.hibernate.action.EntityIdentityInsertAction.execute(Enti tyIdentityInsertAction.java:51)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:27 9)
at
org.hibernate.event.def.AbstractSaveEventListener.performSav eOrReplicate(AbstractSaveEventListener.java:298)
at
org.hibernate.event.def.AbstractSaveEventListener.performSav e(AbstractSaveEventListener.java:181)
at
org.hibernate.event.def.AbstractSaveEventListener.saveWithGe neratedId(AbstractSaveEventListener.java:107)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.sav eWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener .java:187)
at
org.hibernate.event.def.DefaultSaveEventListener.saveWithGen eratedOrRequestedId(DefaultSaveEventListener.java:33)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.ent ityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
at
org.hibernate.event.def.DefaultSaveEventListener.performSave OrUpdate(DefaultSaveEventListener.java:27)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onS aveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibern
|
|
|
Re: [CDO-Teneo-Hibernate] Experience report and errors: Migrating from classic M [message #120603 is a reply to message #120575] |
Tue, 29 April 2008 15:03 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
|
Hi Stefan,
Looks as if you entered dependency hell ;-(
Only recently I stumbled over weird behaviour of PDE or OSGi which was
related to the "jars.extra.classpath" in some build.properties file. I had
the feeling that, once configured, PDE caches the chosen jar location and
it's hard to get rid of that cached setting. The result was that it always
searched for classes in that location although I already removed the
property from the build.properties. I really can't explain it better but I
was able to get rid of the hazzle by turning all "jars.extra.classpath"
properties by "bin.includes" + "Bundle-Classpath" (in MANIFEST.MF). Maybe
this is of help for you.
Nick and I also have hard times to integrate the Hibernate stuff into the
automated builds and tests ;-(
Cheers
/Eike
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
| |
Re: [CDO-Teneo-Hibernate] Experience report and errors: Migrating from classic M [message #120666 is a reply to message #120628] |
Wed, 30 April 2008 07:54 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Stefan Winkler![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=stefan%40winklerweb.net) Messages: 307 Registered: July 2009 Location: Germany |
Senior Member |
|
|
Hi,
Martin, this one's for you ;-)
Stefan Winkler schrieb:
> Hi Eike,
>
> well as of now, I "only" have the problem that the CDOResource does
> not register itself, or Hibernate does not create a table for this,
> respectively.
> Do you have any idea why this could be?
> Does not intuitively seem to be a dependency issue.
Solved that issue by setting
props.put("hibernate.hbm2ddl.auto","update");
Now I get a
org.hibernate.id.IdentifierGenerationException: ids for this class must
be manually assigned before calling save(): MyNode
at org.hibernate.id.Assigned.generate(Assigned.java:33)
at
org.hibernate.event.def.AbstractSaveEventListener.saveWithGe neratedId(AbstractSaveEventListener.java:99)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.sav eWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener .java:187)
at
org.hibernate.event.def.DefaultSaveEventListener.saveWithGen eratedOrRequestedId(DefaultSaveEventListener.java:33)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.ent ityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
at
org.hibernate.event.def.DefaultSaveEventListener.performSave OrUpdate(DefaultSaveEventListener.java:27)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onS aveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:535 )
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:523)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Writer.commit(HibernateStoreWriter.java:67)
at
org.eclipse.emf.cdo.internal.server.Transaction.commit(Trans action.java:179)
at
org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication.indicating(CommitTransactionIndication.java:109 )
at
org.eclipse.net4j.signal.IndicationWithResponse.execute(Indi cationWithResponse.java:46)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:143)
at org.eclipse.net4j.signal.Signal.run(Signal.java:124)
This one should be solveable.
As you might have guessed, MyNode is an element from my own model.
How do I have to prepare my model in order to be able to work with
CDO-Teneo-Hibernate?
And more particularly, how do I assign the id for my model class?
This is my test model:
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="mycontainer"
nsURI="http://www.fernuni-hagen.de/ST/mycontainer.ecore"
nsPrefix="mycontainer">
<eClassifiers xsi:type="ecore:EClass" name="MyContainer">
<eStructuralFeatures xsi:type="ecore:EReference" name="contents"
upperBound="-1"
eType="#//MyNode"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="MyNode">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="text"
eType="#//EString"
defaultValueLiteral="" iD="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EDataType" name="EString"
instanceClassName="java.lang.String"/>
</ecore:EPackage>
Thanks all the time for your support!
Cheers,
Stefan
>
> Cheers
> Stefan
>
>
> Eike Stepper schrieb:
>> Hi Stefan,
>>
>> Looks as if you entered dependency hell ;-(
>> Only recently I stumbled over weird behaviour of PDE or OSGi which
>> was related to the "jars.extra.classpath" in some build.properties
>> file. I had the feeling that, once configured, PDE caches the chosen
>> jar location and it's hard to get rid of that cached setting. The
>> result was that it always searched for classes in that location
>> although I already removed the property from the build.properties. I
>> really can't explain it better but I was able to get rid of the
>> hazzle by turning all "jars.extra.classpath" properties by
>> "bin.includes" + "Bundle-Classpath" (in MANIFEST.MF). Maybe this is
>> of help for you.
>>
>> Nick and I also have hard times to integrate the Hibernate stuff into
>> the automated builds and tests ;-(
>>
>> Cheers
>> /Eike
>>
>>
>>
|
|
|
Re: [CDO-Teneo-Hibernate] Experience report and errors: Migrating from classic M [message #120746 is a reply to message #120666] |
Wed, 30 April 2008 17:54 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Martin Taal![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=mtaal%40springsite.com) Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Stefan,
As a default Teneo will use the eattribute with id=true as the primary key of the eclass. In your
case the eattribute text has id=true. Afaics in your case you tried to persist an instance with a
null-value in the text eattribute which is not allowed (as it is the pk). You can either set this
eattribute before saving, or disable this default teneo behavior. For this you can set the option
PersistenceOptions.ID_FEATURE_AS_PRIMARY_KEY to "false". If you do this then a synthetic primary key
will be used.
gr. Martin
Stefan Winkler wrote:
> Hi,
>
> Martin, this one's for you ;-)
>
> Stefan Winkler schrieb:
>> Hi Eike,
>>
>> well as of now, I "only" have the problem that the CDOResource does
>> not register itself, or Hibernate does not create a table for this,
>> respectively.
>> Do you have any idea why this could be?
>> Does not intuitively seem to be a dependency issue.
>
> Solved that issue by setting
>
> props.put("hibernate.hbm2ddl.auto","update");
>
>
> Now I get a
>
>
> org.hibernate.id.IdentifierGenerationException: ids for this class must
> be manually assigned before calling save(): MyNode
> at org.hibernate.id.Assigned.generate(Assigned.java:33)
> at
> org.hibernate.event.def.AbstractSaveEventListener.saveWithGe neratedId(AbstractSaveEventListener.java:99)
>
> at
> org.hibernate.event.def.DefaultSaveOrUpdateEventListener.sav eWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener .java:187)
>
> at
> org.hibernate.event.def.DefaultSaveEventListener.saveWithGen eratedOrRequestedId(DefaultSaveEventListener.java:33)
>
> at
> org.hibernate.event.def.DefaultSaveOrUpdateEventListener.ent ityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
>
> at
> org.hibernate.event.def.DefaultSaveEventListener.performSave OrUpdate(DefaultSaveEventListener.java:27)
>
> at
> org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onS aveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
>
> at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:535 )
> at org.hibernate.impl.SessionImpl.save(SessionImpl.java:523)
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Writer.commit(HibernateStoreWriter.java:67)
>
> at
> org.eclipse.emf.cdo.internal.server.Transaction.commit(Trans action.java:179)
>
> at
> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication.indicating(CommitTransactionIndication.java:109 )
>
> at
> org.eclipse.net4j.signal.IndicationWithResponse.execute(Indi cationWithResponse.java:46)
>
> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:143)
> at org.eclipse.net4j.signal.Signal.run(Signal.java:124)
>
>
> This one should be solveable.
> As you might have guessed, MyNode is an element from my own model.
>
> How do I have to prepare my model in order to be able to work with
> CDO-Teneo-Hibernate?
> And more particularly, how do I assign the id for my model class?
>
> This is my test model:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ecore:EPackage xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="mycontainer"
> nsURI="http://www.fernuni-hagen.de/ST/mycontainer.ecore"
> nsPrefix="mycontainer">
> <eClassifiers xsi:type="ecore:EClass" name="MyContainer">
> <eStructuralFeatures xsi:type="ecore:EReference" name="contents"
> upperBound="-1"
> eType="#//MyNode"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="MyNode">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="text"
> eType="#//EString"
> defaultValueLiteral="" iD="true"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EDataType" name="EString"
> instanceClassName="java.lang.String"/>
> </ecore:EPackage>
>
> Thanks all the time for your support!
>
> Cheers,
> Stefan
>
>
>
>
>
>
>
>
>
>
>>
>> Cheers
>> Stefan
>>
>>
>> Eike Stepper schrieb:
>>> Hi Stefan,
>>>
>>> Looks as if you entered dependency hell ;-(
>>> Only recently I stumbled over weird behaviour of PDE or OSGi which
>>> was related to the "jars.extra.classpath" in some build.properties
>>> file. I had the feeling that, once configured, PDE caches the chosen
>>> jar location and it's hard to get rid of that cached setting. The
>>> result was that it always searched for classes in that location
>>> although I already removed the property from the build.properties. I
>>> really can't explain it better but I was able to get rid of the
>>> hazzle by turning all "jars.extra.classpath" properties by
>>> "bin.includes" + "Bundle-Classpath" (in MANIFEST.MF). Maybe this is
>>> of help for you.
>>>
>>> Nick and I also have hard times to integrate the Hibernate stuff into
>>> the automated builds and tests ;-(
>>>
>>> Cheers
>>> /Eike
>>>
>>>
>>>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Re: [CDO-Teneo-Hibernate] Experience report and errors: Migrating from classic MySQLAdapter-backed s [message #617902 is a reply to message #119871] |
Thu, 24 April 2008 16:08 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Martin Taal![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=mtaal%40springsite.com) Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Stefan,
See comments below/inline marked with MT>>.
Btw, here is a small first page on the cdo-teneo-hibernate integration, it is maybe not complete and
afaics you already know most of it:
http://www.elver.org/hibernate/cdo.html
gr. Martin
Stefan Winkler wrote:
> Hi,
>
> since I had to convince some of the components of working together, I'll
> report my steps and experiences here:
> Since I did not have any official guide on how to set up everything, I
> just did trial and error. So please comment, if there is any easier or
> more conformant way of getting CDO-Hibernate to run...
>
> - Downloaded Eclipse-3.4M6-modeling
> - [added my favourite plugins - subversive, java2html, keepresident]
> - [Create a working set for the sources of CDO etc. to keep them in one
> place]
> - CVS checkout of everything in
> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
> org.eclipse.emf.cdo > plugins
> - CVS checkout of everything in
> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
> org.eclipse.emf.cdo > hibernate
> [@Eike: there are two (conflicting) folders
> org.eclipse.emf.cdo.server.hibernate one in plugins, one in hibernate]
MT>> You should take the ones from the hibernate folder
> - CVS checkout of everything in
> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
> org.eclipse.emf.cdo > tests
> - CVS checkout of everything in
> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
> org.eclipse.emf.net4j > plugins
> - CVS checkout of following projects in
> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
> org.eclipse.emf.teneo > plugins
> * org.eclipse.emf.teneo
> * org.eclipse.emf.teneo.annotations
> * org.eclipse.emf.teneo.hibernate.mapper
MT>> I think you also need org.eclipse.emf.teneo.libraries
> - get hold of these libraries:
> * hibernate3.jar
> * asm.jar
> * cglib-2.1.3.jar
> * commons-collections-2.1.1.jar
> * commons-logging-1.0.4.jar
> * dom4j-1.6.1.jar
> * jta.jar
> * mysql-connector-java-5.1.5-bin.jar
> * hsqldb.jar
> - copy hsqldb.jar to org.eclipse.net4j.db.hsqldb/lib
MT>> org.eclipse.net4j.db.hsqldb is not used in the teneo-hibernate integration
> - copy mysql-connector-java-5.1.5-bin.jar to org.eclipse.net4j.db.mysql/lib
MT>> org.eclipse.net4j.db.mysql is not used in the teneo-hibernate integration
> - copy mysql-connector-java-5.1.5-bin.jar to
> org.eclipse.emf.cdo.tests.hibernate
MT>> should be to the lib directory in this plugin
> - copy the following libraries to
> org.eclipse.emf.cdo.server.hibernate.libraries/lib
> * hibernate3.jar
> * asm.jar
> * cglib-2.1.3.jar
> * commons-collections-2.1.1.jar
> * commons-logging-1.0.4.jar
> * dom4j-1.6.1.jar
> * jta.jar
> * hsqldb.jar
> - copy the following libraries to org.eclipse.emf.teneo.hibernate.mapper:
> * hibernate3.jar
> * dom4j-1.6.1.jar
MT>> It should not be necessary to copy jars to org.eclipse.emf.teneo.hibernate.mapper
>
> - Try out new store with small test case:
>
> |IManagedContainer container = IPluginContainer.INSTANCE;
> acceptor = JVMUtil.getAcceptor(container, "default");
>
> store = *new *HibernateStore(*new *TeneoHibernateMappingProvider());
>
> Map<String, String> props = *new *HashMap<String, String>();
> props.put(Props.PROP_OVERRIDE_UUID, "f8188187-65de-4c8a-8e75-e0ce5949837a");
> props.put(Props.PROP_SUPPORTING_AUDITS, "false");
> props.put(Props.PROP_SUPPORTING_REVISION_DELTAS, "false");
> props.put(Props.PROP_VERIFYING_REVISIONS, "false");
> props.put(Props.PROP_CURRENT_LRU_CAPACITY, "10000");
> props.put(Props.PROP_REVISED_LRU_CAPACITY, "10000");
>
> props.put("hibernate.connection.autocommit","true");
> props.put("hibernate.cache.provider_class","=org.hibernate.cache.HashtableCacheProvider ");
> props.put("hibernate.connection.driver_class","com.mysql.jdbc.Driver ");
> props.put("hibernate.connection.url","jdbc:mysql://localhost:3306/" + DB_NAME);
> props.put("hibernate.connection.username", DB_USER);
> props.put("hibernate.connection.password", DB_PASS);
> props.put("hibernate.dialect","org.hibernate.dialect.MySQLInnoDBDialect ");
>
> repository = CDOServerUtil.createRepository(repositoryName, store,
> props);
>
>
> CDOServerUtil.addRepository(container, repository);
>
> connector = JVMUtil.getConnector(container, "default");
> session = CDOUtil.openSession(connector, repositoryName,
> *true*);
> transaction = session.openTransaction();
> session.getPackageRegistry().putEPackage(ArtifactBasePackage .eINSTANCE);
> session.getPackageRegistry().putEPackage(RequipsePackage.eIN STANCE);
> session.getPackageRegistry().putEPackage(WeightedLinksPackag e.eINSTANCE);
>
> resource = transaction.getOrCreateResource(RESOURCE_PATH);
>
> // etc ... (put stuff into repository)
>
> |
>
>
> => I can't get hibernate to find the mysql driver class. Tried putting
> mysql-connector-java-5.1.5-bin.jar in my test plugin, tried exporting
> packages and using Eclipse-BuddyPolicy: dependent but no success.
MT>> In which plugin did you set dependent? It should be in the one with the hibernate libraries
The mysql jar must be in the lib directory of the hibernate.test plugin
> => temp solution: add mysql-connector-java-5.1.5-bin.jar to
> org.eclipse.emf.cdo.server.hibernate.libraries project and add it to
> that Bundle-ClassPath
MT>> Yes this is also fine
> => class is now found
>
> - next error is
> 24.04.2008 16:58:54 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
> FATAL: could not complete schema update
> org.hibernate.MappingException: Could not determine type for:
> org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOTy peUserType,
> at table: cdo_features, for columns: [org.hibernate.mapping.Column(type)]
> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 69)
> at org.hibernate.mapping.Column.getSqlTypeCode(Column.java:138)
> at org.hibernate.mapping.Column.getSqlType(Column.java:182)
> at org.hibernate.mapping.Table.sqlCreateString(Table.java:397)
> at
> org.hibernate.cfg.Configuration.generateSchemaUpdateScript(C onfiguration.java:962)
> at
> org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate .java:140)
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.initSchema(HibernatePackageHandler.java:346)
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.doActivate(HibernatePackageHandler.java:307)
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore .doActivate(HibernateStore.java:205)
> at
> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
> at
> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
> at
> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
> at
> org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:262)
> at
> org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:250)
> at
> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
> at
> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
> at
> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
> at
> org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
>
> Giving up for today - maybe this error is familiar to someone? Eike? Martin?
MT>> Do you have this class (org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOT ypeUserType)
in the org.eclipse.emf.cdo.server.hibernate plugin?
>
> to be continued ...
>
>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Re: [CDO-Teneo-Hibernate] Experience report and errors: Migrating from classic M [message #617906 is a reply to message #119901] |
Fri, 25 April 2008 07:32 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
|
Hi Martin,
Great intro! As usual I'm behind with my docs ;-( But I promise that I'lll
work on them when my current customer engagement ends mid of May...
Cheers
/Eike
Martin Taal wrote:
> Hi Stefan,
> See comments below/inline marked with MT>>.
> Btw, here is a small first page on the cdo-teneo-hibernate integration, it
is maybe not complete and
> afaics you already know most of it:
> http://www.elver.org/hibernate/cdo.html
> gr. Martin
> Stefan Winkler wrote:
>> Hi,
>>
>> since I had to convince some of the components of working together, I'll
>> report my steps and experiences here:
>> Since I did not have any official guide on how to set up everything, I
>> just did trial and error. So please comment, if there is any easier or
>> more conformant way of getting CDO-Hibernate to run...
>>
>> - Downloaded Eclipse-3.4M6-modeling
>> - [added my favourite plugins - subversive, java2html, keepresident]
>> - [Create a working set for the sources of CDO etc. to keep them in one
>> place]
>> - CVS checkout of everything in
>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
>> org.eclipse.emf.cdo > plugins
>> - CVS checkout of everything in
>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
>> org.eclipse.emf.cdo > hibernate
>> [@Eike: there are two (conflicting) folders
>> org.eclipse.emf.cdo.server.hibernate one in plugins, one in hibernate]
> MT>> You should take the ones from the hibernate folder
>> - CVS checkout of everything in
>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
>> org.eclipse.emf.cdo > tests
>> - CVS checkout of everything in
>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
>> org.eclipse.emf.net4j > plugins
>> - CVS checkout of following projects in
>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
>> org.eclipse.emf.teneo > plugins
>> * org.eclipse.emf.teneo
>> * org.eclipse.emf.teneo.annotations
>> * org.eclipse.emf.teneo.hibernate.mapper
> MT>> I think you also need org.eclipse.emf.teneo.libraries
>> - get hold of these libraries:
>> * hibernate3.jar
>> * asm.jar
>> * cglib-2.1.3.jar
>> * commons-collections-2.1.1.jar
>> * commons-logging-1.0.4.jar
>> * dom4j-1.6.1.jar
>> * jta.jar
>> * mysql-connector-java-5.1.5-bin.jar
>> * hsqldb.jar
>> - copy hsqldb.jar to org.eclipse.net4j.db.hsqldb/lib
> MT>> org.eclipse.net4j.db.hsqldb is not used in the teneo-hibernate
integration
>> - copy mysql-connector-java-5.1.5-bin.jar to org.eclipse.net4j.db.mysql/lib
> MT>> org.eclipse.net4j.db.mysql is not used in the teneo-hibernate
integration
>> - copy mysql-connector-java-5.1.5-bin.jar to
>> org.eclipse.emf.cdo.tests.hibernate
> MT>> should be to the lib directory in this plugin
>> - copy the following libraries to
>> org.eclipse.emf.cdo.server.hibernate.libraries/lib
>> * hibernate3.jar
>> * asm.jar
>> * cglib-2.1.3.jar
>> * commons-collections-2.1.1.jar
>> * commons-logging-1.0.4.jar
>> * dom4j-1.6.1.jar
>> * jta.jar
>> * hsqldb.jar
>> - copy the following libraries to org.eclipse.emf.teneo.hibernate.mapper:
>> * hibernate3.jar
>> * dom4j-1.6.1.jar
> MT>> It should not be necessary to copy jars to
org.eclipse.emf.teneo.hibernate.mapper
>>
>> - Try out new store with small test case:
>>
>> |IManagedContainer container = IPluginContainer.INSTANCE;
>> acceptor = JVMUtil.getAcceptor(container, "default");
>>
>> store = *new *HibernateStore(*new *TeneoHibernateMappingProvider());
>>
>> Map<String, String> props = *new *HashMap<String, String>();
>> props.put(Props.PROP_OVERRIDE_UUID,
"f8188187-65de-4c8a-8e75-e0ce5949837a");
>> props.put(Props.PROP_SUPPORTING_AUDITS, "false");
>> props.put(Props.PROP_SUPPORTING_REVISION_DELTAS, "false");
>> props.put(Props.PROP_VERIFYING_REVISIONS, "false");
>> props.put(Props.PROP_CURRENT_LRU_CAPACITY, "10000");
>> props.put(Props.PROP_REVISED_LRU_CAPACITY, "10000");
>>
>> props.put("hibernate.connection.autocommit","true");
>>
props.put("hibernate.cache.provider_class","=org.hibernate.cache.HashtableCacheProvider ");
>> props.put("hibernate.connection.driver_class","com.mysql.jdbc.Driver ");
>> props.put("hibernate.connection.url","jdbc:mysql://localhost:3306/" +
DB_NAME);
>> props.put("hibernate.connection.username", DB_USER);
>> props.put("hibernate.connection.password", DB_PASS);
>>
props.put("hibernate.dialect","org.hibernate.dialect.MySQLInnoDBDialect ");
>>
>> repository = CDOServerUtil.createRepository(repositoryName, store,
>> props);
>>
>>
>> CDOServerUtil.addRepository(container, repository);
>>
>> connector = JVMUtil.getConnector(container, "default");
>> session = CDOUtil.openSession(connector, repositoryName,
>> *true*);
>> transaction = session.openTransaction();
>> session.getPackageRegistry().putEPackage(ArtifactBasePackage .eINSTANCE);
>> session.getPackageRegistry().putEPackage(RequipsePackage.eIN STANCE);
>>
session.getPackageRegistry().putEPackage(WeightedLinksPackag e.eINSTANCE);
>>
>> resource = transaction.getOrCreateResource(RESOURCE_PATH);
>>
>> // etc ... (put stuff into repository)
>>
>> |
>>
>>
>> => I can't get hibernate to find the mysql driver class. Tried putting
>> mysql-connector-java-5.1.5-bin.jar in my test plugin, tried exporting
>> packages and using Eclipse-BuddyPolicy: dependent but no success.
> MT>> In which plugin did you set dependent? It should be in the one with the
hibernate libraries
> The mysql jar must be in the lib directory of the hibernate.test plugin
>> => temp solution: add mysql-connector-java-5.1.5-bin.jar to
>> org.eclipse.emf.cdo.server.hibernate.libraries project and add it to
>> that Bundle-ClassPath
> MT>> Yes this is also fine
>> => class is now found
>>
>> - next error is
>> 24.04.2008 16:58:54 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
>> FATAL: could not complete schema update
>> org.hibernate.MappingException: Could not determine type for:
>> org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOTy peUserType,
>> at table: cdo_features, for columns: [org.hibernate.mapping.Column(type)]
>> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 69)
>> at org.hibernate.mapping.Column.getSqlTypeCode(Column.java:138)
>> at org.hibernate.mapping.Column.getSqlType(Column.java:182)
>> at org.hibernate.mapping.Table.sqlCreateString(Table.java:397)
>> at
>>
org.hibernate.cfg.Configuration.generateSchemaUpdateScript(C onfiguration.java:962)
>> at
>> org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate .java:140)
>> at
>>
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.initSchema(HibernatePackageHandler.java:346)
>> at
>>
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.doActivate(HibernatePackageHandler.java:307)
>> at
>>
org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore .doActivate(HibernateStore.java:205)
>> at
>>
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>> at
>>
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
>> at
>>
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
>> at
>>
org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:262)
>> at
>>
org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:250)
>> at
>>
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>> at
>>
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
>> at
>>
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
>> at
>>
org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
>>
>> Giving up for today - maybe this error is familiar to someone? Eike? Martin?
> MT>> Do you have this class
(org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOT ypeUserType)
> in the org.eclipse.emf.cdo.server.hibernate plugin?
>>
>> to be continued ...
>>
>>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: [CDO-Teneo-Hibernate] Experience report and errors: Migrating from classic M [message #617907 is a reply to message #119871] |
Fri, 25 April 2008 07:48 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
|
Hi Stefan,
You seem to have invested a lot of time to make it run. Most of the steps
you describe look necessary and appropriate to me.
As soon as I have more time available again I plan to create a space in
the wiki where users can persist reports about their experiences.
More comments inline...
Cheers
/Eike
Stefan Winkler wrote:
> Hi,
> since I had to convince some of the components of working together, I'll
> report my steps and experiences here:
> Since I did not have any official guide on how to set up everything, I
> just did trial and error. So please comment, if there is any easier or
> more conformant way of getting CDO-Hibernate to run...
> - Downloaded Eclipse-3.4M6-modeling
Interesting, will have to look at this one. I remember that once there was
a discussion whether the incubating components (like net4j, cdo and teneo)
can become part of this distro. Will put this on my list ;-)
> - [added my favourite plugins - subversive, java2html, keepresident]
keepresident sounds like a clever toy!
> - [Create a working set for the sources of CDO etc. to keep them in one
> place]
> - CVS checkout of everything in
> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
> org.eclipse.emf.cdo > plugins
> - CVS checkout of everything in
> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
> org.eclipse.emf.cdo > hibernate
> [@Eike: there are two (conflicting) folders
> org.eclipse.emf.cdo.server.hibernate one in plugins, one in hibernate]
The one in plugins/ is obsolete since Martin joined the component as a
committer and I moved everything to the hibernate/ folder. Are both
folders non-empty in HEAD? If yes, could you please file a Bugzilla so
that I won't forget about it during the weekend?
> - CVS checkout of everything in
> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
> org.eclipse.emf.cdo > tests
> - CVS checkout of everything in
> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
> org.eclipse.emf.net4j > plugins
> - CVS checkout of following projects in
> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf >
> org.eclipse.emf.teneo > plugins
> * org.eclipse.emf.teneo
> * org.eclipse.emf.teneo.annotations
> * org.eclipse.emf.teneo.hibernate.mapper
> - get hold of these libraries:
> * hibernate3.jar
> * asm.jar
> * cglib-2.1.3.jar
> * commons-collections-2.1.1.jar
> * commons-logging-1.0.4.jar
> * dom4j-1.6.1.jar
> * jta.jar
> * mysql-connector-java-5.1.5-bin.jar
> * hsqldb.jar
> - copy hsqldb.jar to org.eclipse.net4j.db.hsqldb/lib
> - copy mysql-connector-java-5.1.5-bin.jar to org.eclipse.net4j.db.mysql/lib
> - copy mysql-connector-java-5.1.5-bin.jar to
> org.eclipse.emf.cdo.tests.hibernate
> - copy the following libraries to
> org.eclipse.emf.cdo.server.hibernate.libraries/lib
> * hibernate3.jar
> * asm.jar
> * cglib-2.1.3.jar
> * commons-collections-2.1.1.jar
> * commons-logging-1.0.4.jar
> * dom4j-1.6.1.jar
> * jta.jar
> * hsqldb.jar
> - copy the following libraries to org.eclipse.emf.teneo.hibernate.mapper:
> * hibernate3.jar
> * dom4j-1.6.1.jar
Oh yes, this non-EPL 3rd party library stuff is really annoying!! If only
the platform itself had a mechanism to automatically provision such
dependencies ;-(
> - Try out new store with small test case:
> |IManagedContainer container = IPluginContainer.INSTANCE;
> acceptor = JVMUtil.getAcceptor(container, "default");
> store = *new *HibernateStore(*new *TeneoHibernateMappingProvider());
> Map<String, String> props = *new *HashMap<String, String>();
> props.put(Props.PROP_OVERRIDE_UUID,
"f8188187-65de-4c8a-8e75-e0ce5949837a");
> props.put(Props.PROP_SUPPORTING_AUDITS, "false");
> props.put(Props.PROP_SUPPORTING_REVISION_DELTAS, "false");
> props.put(Props.PROP_VERIFYING_REVISIONS, "false");
> props.put(Props.PROP_CURRENT_LRU_CAPACITY, "10000");
> props.put(Props.PROP_REVISED_LRU_CAPACITY, "10000");
> props.put("hibernate.connection.autocommit","true");
>
props.put("hibernate.cache.provider_class","=org.hibernate.cache.HashtableCacheProvider ");
> props.put("hibernate.connection.driver_class","com.mysql.jdbc.Driver ");
> props.put("hibernate.connection.url","jdbc:mysql://localhost:3306/" +
DB_NAME);
> props.put("hibernate.connection.username", DB_USER);
> props.put("hibernate.connection.password", DB_PASS);
>
props.put("hibernate.dialect","org.hibernate.dialect.MySQLInnoDBDialect ");
> repository = CDOServerUtil.createRepository(repositoryName, store,
> props);
> CDOServerUtil.addRepository(container, repository);
> connector = JVMUtil.getConnector(container, "default");
> session = CDOUtil.openSession(connector, repositoryName,
> *true*);
> transaction = session.openTransaction();
> session.getPackageRegistry().putEPackage(ArtifactBasePackage .eINSTANCE);
> session.getPackageRegistry().putEPackage(RequipsePackage.eIN STANCE);
> session.getPackageRegistry().putEPackage(WeightedLinksPackag e.eINSTANCE);
> resource = transaction.getOrCreateResource(RESOURCE_PATH);
> // etc ... (put stuff into repository)
> |
Looks ok to me.
Please notice that with the latest sources you can't register subpackages
directly anymore. They're autpomatically registered along with their top
level packages! Just in case...
> => I can't get hibernate to find the mysql driver class. Tried putting
> mysql-connector-java-5.1.5-bin.jar in my test plugin, tried exporting
> packages and using Eclipse-BuddyPolicy: dependent but no success.
> => temp solution: add mysql-connector-java-5.1.5-bin.jar to
> org.eclipse.emf.cdo.server.hibernate.libraries project and add it to
> that Bundle-ClassPath
> => class is now found
Maybe we can create a fragment for the net4j.db plugin (which contains
several jdbc drivers via adapter fragments) that adds an additional
dependency on the hibernate.mapper plugin, so that the BuddyPolicy will
make the driver jars visible. Martin?
> - next error is
> 24.04.2008 16:58:54 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
> FATAL: could not complete schema update
> org.hibernate.MappingException: Could not determine type for:
> org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOTy peUserType,
> at table: cdo_features, for columns: [org.hibernate.mapping.Column(type)]
> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 69)
> at org.hibernate.mapping.Column.getSqlTypeCode(Column.java:138)
> at org.hibernate.mapping.Column.getSqlType(Column.java:182)
> at org.hibernate.mapping.Table.sqlCreateString(Table.java:397)
> at
>
org.hibernate.cfg.Configuration.generateSchemaUpdateScript(C onfiguration.java:962)
> at
> org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate .java:140)
> at
>
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.initSchema(HibernatePackageHandler.java:346)
> at
>
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.doActivate(HibernatePackageHandler.java:307)
> at
>
org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore .doActivate(HibernateStore.java:205)
> at
>
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
> at
>
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
> at
>
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
> at
>
org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:262)
> at
>
org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:250)
> at
>
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
> at
>
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
> at
>
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
> at
> org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
> Giving up for today - maybe this error is familiar to someone? Eike? Martin?
> to be continued ...
This looks like a pure Hibernate problem and I guess it's best to wait for
Martin's analysis ;-)
Happy persisting!
/Eike
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: [CDO-Teneo-Hibernate] Experience report and errors: Migrating from classic MySQLAdapter-backed s [message #617916 is a reply to message #119901] |
Fri, 25 April 2008 15:02 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Stefan Winkler![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=stefan%40winklerweb.net) Messages: 307 Registered: July 2009 Location: Germany |
Senior Member |
|
|
Hi,
today, I learned that Eclipse is always good for some extra fun.
For some reason it deleted the
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
from the .classpath file in all project in my workspace. It is creepy
when Eclipse does not find a single dependency anymore.
Luckily I was able to locate the problem after some time - so now I am
back and ready to proceed.
Thanks, Martin, for all your comments. As you might have guessed, most
errors I wrote were simple typos / paste errors:
>> Hi,
>>
>> since I had to convince some of the components of working together,
>> I'll report my steps and experiences here:
>> Since I did not have any official guide on how to set up everything,
>> I just did trial and error. So please comment, if there is any easier
>> or more conformant way of getting CDO-Hibernate to run...
>>
>> - Downloaded Eclipse-3.4M6-modeling
>> - [added my favourite plugins - subversive, java2html, keepresident]
>> - [Create a working set for the sources of CDO etc. to keep them in
>> one place]
>> - CVS checkout of everything in
>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>> > org.eclipse.emf.cdo > plugins
>> - CVS checkout of everything in
>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>> > org.eclipse.emf.cdo > hibernate
>> [@Eike: there are two (conflicting) folders
>> org.eclipse.emf.cdo.server.hibernate one in plugins, one in hibernate]
> MT>> You should take the ones from the hibernate folder
Sure - this was just to report that it could cause misunderstandings.
@Eike: the folder in plugins is empty, you just get a conflict, if you
try to check out everything at once because of two folders / projects
with the same name.
>> - CVS checkout of everything in
>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>> > org.eclipse.emf.cdo > tests
>> - CVS checkout of everything in
>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>> > org.eclipse.emf.net4j > plugins
>> - CVS checkout of following projects in
>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>> > org.eclipse.emf.teneo > plugins
>> * org.eclipse.emf.teneo
>> * org.eclipse.emf.teneo.annotations
>> * org.eclipse.emf.teneo.hibernate.mapper
> MT>> I think you also need org.eclipse.emf.teneo.libraries
Mhh .. it is not required and AFAIK there's only commons-logging.jar in
there, which has to be copied into
org.eclipse.emf.cdo.server.hibernate.libraries/lib anyway.
>> - get hold of these libraries:
>> * hibernate3.jar
>> * asm.jar
>> * cglib-2.1.3.jar
>> * commons-collections-2.1.1.jar
>> * commons-logging-1.0.4.jar
>> * dom4j-1.6.1.jar
>> * jta.jar
>> * mysql-connector-java-5.1.5-bin.jar
>> * hsqldb.jar
>> - copy hsqldb.jar to org.eclipse.net4j.db.hsqldb/lib
> MT>> org.eclipse.net4j.db.hsqldb is not used in the teneo-hibernate
> integration
>
>> - copy mysql-connector-java-5.1.5-bin.jar to
>> org.eclipse.net4j.db.mysql/lib
> MT>> org.eclipse.net4j.db.mysql is not used in the teneo-hibernate
> integration
You're right - one could completely leave out the net4j.db.* libraries
when using Hibernate.
>
>> - copy mysql-connector-java-5.1.5-bin.jar to
>> org.eclipse.emf.cdo.tests.hibernate
> MT>> should be to the lib directory in this plugin
Correct - typo. :-)
>
>> - copy the following libraries to
>> org.eclipse.emf.cdo.server.hibernate.libraries/lib
>> * hibernate3.jar
>> * asm.jar
>> * cglib-2.1.3.jar
>> * commons-collections-2.1.1.jar
>> * commons-logging-1.0.4.jar
>> * dom4j-1.6.1.jar
>> * jta.jar
>> * hsqldb.jar
>> - copy the following libraries to
>> org.eclipse.emf.teneo.hibernate.mapper:
>> * hibernate3.jar
>> * dom4j-1.6.1.jar
> MT>> It should not be necessary to copy jars to
> org.eclipse.emf.teneo.hibernate.mapper
Hmmm ... maybe that depends on how it is used / deployed?
I get build errors that those two libraries can not be resolved.
>
>>
>> - Try out new store with small test case:
>>
>> |IManagedContainer container = IPluginContainer.INSTANCE;
>> acceptor = JVMUtil.getAcceptor(container, "default");
>> store = *new *HibernateStore(*new
>> *TeneoHibernateMappingProvider());
>> Map<String, String> props = *new *HashMap<String,
>> String>();
>> props.put(Props.PROP_OVERRIDE_UUID,
>> "f8188187-65de-4c8a-8e75-e0ce5949837a");
>> props.put(Props.PROP_SUPPORTING_AUDITS, "false");
>> props.put(Props.PROP_SUPPORTING_REVISION_DELTAS, "false");
>> props.put(Props.PROP_VERIFYING_REVISIONS, "false");
>> props.put(Props.PROP_CURRENT_LRU_CAPACITY, "10000");
>> props.put(Props.PROP_REVISED_LRU_CAPACITY, "10000");
>> props.put("hibernate.connection.autocommit","true");
>>
>> props.put("hibernate.cache.provider_class","=org.hibernate.cache.HashtableCacheProvider ");
>>
>>
>> props.put("hibernate.connection.driver_class","com.mysql.jdbc.Driver ");
>>
>> props.put("hibernate.connection.url","jdbc:mysql://localhost:3306/" +
>> DB_NAME);
>> props.put("hibernate.connection.username", DB_USER);
>> props.put("hibernate.connection.password", DB_PASS);
>>
>> props.put("hibernate.dialect","org.hibernate.dialect.MySQLInnoDBDialect ");
>>
>> repository = CDOServerUtil.createRepository(repositoryName,
>> store,
>> props);
>> CDOServerUtil.addRepository(container, repository);
>> connector = JVMUtil.getConnector(container, "default");
>> session = CDOUtil.openSession(connector, repositoryName,
>> *true*);
>> transaction = session.openTransaction();
>>
>> session.getPackageRegistry().putEPackage(ArtifactBasePackage .eINSTANCE);
>> session.getPackageRegistry().putEPackage(RequipsePackage.eIN STANCE);
>>
>> session.getPackageRegistry().putEPackage(WeightedLinksPackag e.eINSTANCE);
>>
>> resource = transaction.getOrCreateResource(RESOURCE_PATH);
>> // etc ... (put stuff into repository)
>>
>> |
>>
>>
>> => I can't get hibernate to find the mysql driver class. Tried
>> putting mysql-connector-java-5.1.5-bin.jar in my test plugin, tried
>> exporting packages and using Eclipse-BuddyPolicy: dependent but no
>> success.
> MT>> In which plugin did you set dependent? It should be in the one
> with the hibernate libraries
> The mysql jar must be in the lib directory of the hibernate.test plugin
I created a new test plugin for my own stuff. But if I place the mysql
driver there, hibernate does not find it.
>
>> => temp solution: add mysql-connector-java-5.1.5-bin.jar to
>> org.eclipse.emf.cdo.server.hibernate.libraries project and add it to
>> that Bundle-ClassPath
> MT>> Yes this is also fine
>
>> => class is now found
>>
>> - next error is
>> 24.04.2008 16:58:54 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
>> FATAL: could not complete schema update
>> org.hibernate.MappingException: Could not determine type for:
>> org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOTy peUserType,
>> at table: cdo_features, for columns:
>> [org.hibernate.mapping.Column(type)]
>> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 69)
>> at org.hibernate.mapping.Column.getSqlTypeCode(Column.java:138)
>> at org.hibernate.mapping.Column.getSqlType(Column.java:182)
>> at org.hibernate.mapping.Table.sqlCreateString(Table.java:397)
>> at
>> org.hibernate.cfg.Configuration.generateSchemaUpdateScript(C onfiguration.java:962)
>>
>> at
>> org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate .java:140)
>> at
>> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.initSchema(HibernatePackageHandler.java:346)
>>
>> at
>> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.doActivate(HibernatePackageHandler.java:307)
>>
>> at
>> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore .doActivate(HibernateStore.java:205)
>>
>> at
>> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>>
>> at
>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
>>
>> at
>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
>>
>> at
>> org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:262)
>>
>> at
>> org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:250)
>>
>> at
>> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>>
>> at
>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
>>
>> at
>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
>>
>> at
>> org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
>>
>>
>> Giving up for today - maybe this error is familiar to someone? Eike?
>> Martin?
> MT>> Do you have this class
> (org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOT ypeUserType)
> in the org.eclipse.emf.cdo.server.hibernate plugin?
Yes.
The problem is, as far as I can see after some debugging, a classloader
problem.
The mapping which makes problems is
[...]
<joined-subclass name="CDOFeatureImpl" table="cdo_features"
extends="CDOModelElementImpl">
<key/>
<property name="featureID" column="feature" type="int"
not-null="true" />
/ <property name="type"
type=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOTy peUserType "
not-null="false" />
/[...]
from org.eclipse.emf.cdo.server.hibernate/mappings/meta.hbm.xml
When the schema is to be created, hibernate iterated through the
mappings and comes to the mapping above.
Then we are at org.hibernate.mapping.SimpleValue.getType() (line 260)
Type result = TypeFactory.heuristicType(typeName, typeParameters);
where he tries to load the type via ReflectHelper.classForName( typeName
); and fails.
After some trial and error, I found out that adding
Eclipse-BuddyPolicy: dependent
to the MANIFEST.MF of org.eclipse.emf.cdo.server.hibernate.libraries
does the trick. With this policy set, the class is found and I can even
again delete the mysql driver class from
org.eclipse.emf.cdo.server.hibernate.libraries.
I don't know quite much about classloading in Eclipse (or OSGi,
respectivly), this is very much magical to me, but can it be, that the
missing Eclipse-BuddyPolicy in
org.eclipse.emf.cdo.server.hibernate.libraries is a bug? But then, this
may as well be the result of my "non-standard" installation (copying
jars to org.eclipse.emf.teneo.hibernate.mapper)...
Ok, next one: I'm running into a net.sf.cglib.core.CodeGenerationException
INFO: building session factory
25.04.2008 16:02:13 org.hibernate.impl.SessionFactoryImpl <init>
FEIN: Session factory constructed with filter configurations : {}
25.04.2008 16:02:13 org.hibernate.impl.SessionFactoryImpl <init>
FEIN: instantiating session factory with properties:
{hibernate.connection.autocommit=true,
hibernate.connection.driver_class=com.mysql.jdbc.Driver,
hibernate.cache.provider_class=org.hibernate.cache.Hashtable CacheProvider,
hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect,
verifyingRevisions=false, supportingRevisionDeltas=false,
currentLRUCapacity=10000, revisedLRUCapacity=10000,
overrideUUID=f8188187-65de-4c8a-8e75-e0ce5949837a,
hibernate.connection.username=requipse,
hibernate.connection.url=jdbc:mysql://localhost:3306/requipse,
supportingAudits=false, hibernate.connection.password=requipse}
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Static SQL for entity:
org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Version select: select id from cdo_modelelements where id =?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Snapshot select: select cdoclassim_.CDOClassImpl,
cdoclassim_1_.name as name0_, cdoclassim_.classifier as classifier3_,
cdoclassim_.abstract as abstract3_ from cdo_classes cdoclassim_ inner
join cdo_modelelements cdoclassim_1_ on
cdoclassim_.CDOClassImpl=cdoclassim_1_.id where cdoclassim_.CDOClassImpl=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Insert 0: insert into cdo_modelelements (name, id) values (?, ?)
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Update 0: update cdo_modelelements set name=? where id=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Delete 0: delete from cdo_modelelements where id=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Insert 1: insert into cdo_classes (classifier, abstract,
CDOClassImpl) values (?, ?, ?)
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Update 1: update cdo_classes set classifier=?, abstract=? where
CDOClassImpl=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Delete 1: delete from cdo_classes where CDOClassImpl=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Static SQL for entity:
org.eclipse.emf.cdo.internal.protocol.model.CDOPackageImpl
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Version select: select id from cdo_modelelements where id =?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Snapshot select: select cdopackage_.CDOPackageImpl,
cdopackage_1_.name as name0_, cdopackage_.uri as uri1_,
cdopackage_.ecore as ecore1_, cdopackage_.dynamic as dynamic1_,
cdopackage_.parentUri as parentUri1_, cdopackage_.metaIDStart as
metaIDSt6_1_, cdopackage_.metaIDSize as metaIDSize1_ from cdo_packages
cdopackage_ inner join cdo_modelelements cdopackage_1_ on
cdopackage_.CDOPackageImpl=cdopackage_1_.id where
cdopackage_.CDOPackageImpl=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Insert 0: insert into cdo_modelelements (name, id) values (?, ?)
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Update 0: update cdo_modelelements set name=? where id=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Delete 0: delete from cdo_modelelements where id=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Insert 1: insert into cdo_packages (uri, ecore, dynamic,
parentUri, metaIDStart, metaIDSize, CDOPackageImpl) values (?, ?, ?, ?,
?, ?, ?)
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Update 1: update cdo_packages set uri=?, ecore=?, dynamic=?,
parentUri=?, metaIDStart=?, metaIDSize=? where CDOPackageImpl=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Delete 1: delete from cdo_packages where CDOPackageImpl=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Static SQL for entity:
org.eclipse.emf.cdo.internal.protocol.model.CDOModelElementI mpl
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Version select: select id from cdo_modelelements where id =?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Snapshot select: select cdomodelel_.id, cdomodelel_.name as
name0_ from cdo_modelelements cdomodelel_ where cdomodelel_.id=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Insert 0: insert into cdo_modelelements (name, id) values (?, ?)
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Update 0: update cdo_modelelements set name=? where id=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Delete 0: delete from cdo_modelelements where id=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Static SQL for entity:
org.eclipse.emf.cdo.internal.protocol.model.CDOClassProxy
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Version select: select id from cdo_classes_proxy where id =?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Snapshot select: select cdoclasspr_.id, cdoclasspr_.cdoclass as
cdoclass2_ from cdo_classes_proxy cdoclasspr_ where cdoclasspr_.id=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Insert 0: insert into cdo_classes_proxy (cdoclass, id) values (?, ?)
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Update 0: update cdo_classes_proxy set cdoclass=? where id=?
25.04.2008 16:02:13
org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
FEIN: Delete 0: delete from cdo_classes_proxy where id=?
main [debug] Releasing hibernate session
main [debug] Clearing session in threadlocal
main [debug] Removing hibernate session
net.sf.cglib.core.CodeGenerationException:
java.lang.reflect.InvocationTargetException-->null
at
net.sf.cglib.core.AbstractClassGenerator.create(AbstractClas sGenerator.java:237)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
at
org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxy Factory(CGLIBLazyInitializer.java:127)
at
org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstant iate(CGLIBProxyFactory.java:43)
at
org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFact ory(PojoEntityTuplizer.java:162)
at
org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)
at
org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at
org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping . <init>(EntityEntityModeToTuplizerMapping.java:56)
at
org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:302)
at
org.hibernate.persister.entity.AbstractEntityPersister.<init >(AbstractEntityPersister.java:434)
at
org.hibernate.persister.entity.JoinedSubclassEntityPersister . <init>(JoinedSubclassEntityPersister.java:91)
at
org.hibernate.persister.PersisterFactory.createClassPersiste r(PersisterFactory.java:58)
at
org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
at
org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1300)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getSessionFactory(HibernatePackageHandler.java:273 )
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.readPackageInfos(HibernatePackageHandler.java:244)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getCDOPackageInfos(HibernatePackageHandler.java:18 8)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Reader.readPackageInfos(HibernateStoreReader.java:87)
at
org.eclipse.emf.cdo.internal.server.PackageManager.doActivat e(PackageManager.java:72)
at
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
at
org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:263)
at
org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:250)
at
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
at
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
at
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
at
org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
at
my.tests.WeightedLinkPersistenceTests.setUp(WeightedLinkPers istenceTests.java:92)
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.junit.internal.runners.BeforeAndAfterRunner.invokeMethod (BeforeAndAfterRunner.java:74)
at
org.junit.internal.runners.BeforeAndAfterRunner.runBefores(B eforeAndAfterRunner.java:50)
at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:33)
at
org.junit.internal.runners.TestMethodRunner.runMethod(TestMe thodRunner.java:75)
at
org.junit.internal.runners.TestMethodRunner.run(TestMethodRu nner.java:45)
at
org.junit.internal.runners.TestClassMethodsRunner.invokeTest Method(TestClassMethodsRunner.java:66)
at
org.junit.internal.runners.TestClassMethodsRunner.run(TestCl assMethodsRunner.java:35)
at
org.junit.internal.runners.TestClassRunner$1.runUnprotected( TestClassRunner.java:42)
at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:34)
at
org.junit.internal.runners.TestClassRunner.run(TestClassRunn er.java:52)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:45)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
at
org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunne r.main(RemotePluginTestRunner.java:62)
at
org.eclipse.pde.internal.junit.runtime.UITestApplication$1.r un(UITestApplication.java:118)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:130)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3750)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3375)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2375)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2339)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 05)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:478)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:288)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:473)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
at
org.eclipse.pde.internal.junit.runtime.UITestApplication.sta rt(UITestApplication.java:52)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:193)
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:362)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:175)
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: 549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
Caused by: java.lang.reflect.InvocationTargetException
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 net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java :384)
at
net.sf.cglib.core.AbstractClassGenerator.create(AbstractClas sGenerator.java:219)
... 74 more
Caused by: java.lang.NoClassDefFoundError:
org/hibernate/proxy/HibernateProxy
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
... 80 more
Caused by: java.lang.ClassNotFoundException:
org.hibernate.proxy.HibernateProxy
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl assInternal(BundleLoader.java:481)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:397)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:385)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:87)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 82 more
Again a classloader problem, I think.
Tried a lot of alternatives of moving hibernate3.jar around and create
and delete copies of it.
No effect.
Giving up for today - maybe there's some light of wisdom coming to me
(or you?).
Anyway, have a nice weekend
Stefan
|
|
|
Re: [CDO-Teneo-Hibernate] Experience report and errors: Migrating from classic MySQLAdapter-backed s [message #617918 is a reply to message #120124] |
Fri, 25 April 2008 18:05 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Martin Taal![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=mtaal%40springsite.com) Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Stefan,
See my comments below.
gr. Martin
Stefan Winkler wrote:
> Hi,
>
> today, I learned that Eclipse is always good for some extra fun.
> For some reason it deleted the
> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
> from the .classpath file in all project in my workspace. It is creepy
> when Eclipse does not find a single dependency anymore.
> Luckily I was able to locate the problem after some time - so now I am
> back and ready to proceed.
>
> Thanks, Martin, for all your comments. As you might have guessed, most
> errors I wrote were simple typos / paste errors:
>>> Hi,
>>>
>>> since I had to convince some of the components of working together,
>>> I'll report my steps and experiences here:
>>> Since I did not have any official guide on how to set up everything,
>>> I just did trial and error. So please comment, if there is any easier
>>> or more conformant way of getting CDO-Hibernate to run...
>>>
>>> - Downloaded Eclipse-3.4M6-modeling
>>> - [added my favourite plugins - subversive, java2html, keepresident]
>>> - [Create a working set for the sources of CDO etc. to keep them in
>>> one place]
>>> - CVS checkout of everything in
>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>>> > org.eclipse.emf.cdo > plugins
>>> - CVS checkout of everything in
>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>>> > org.eclipse.emf.cdo > hibernate
>>> [@Eike: there are two (conflicting) folders
>>> org.eclipse.emf.cdo.server.hibernate one in plugins, one in hibernate]
>> MT>> You should take the ones from the hibernate folder
> Sure - this was just to report that it could cause misunderstandings.
> @Eike: the folder in plugins is empty, you just get a conflict, if you
> try to check out everything at once because of two folders / projects
> with the same name.
>>> - CVS checkout of everything in
>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>>> > org.eclipse.emf.cdo > tests
>>> - CVS checkout of everything in
>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>>> > org.eclipse.emf.net4j > plugins
>>> - CVS checkout of following projects in
>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>>> > org.eclipse.emf.teneo > plugins
>>> * org.eclipse.emf.teneo
>>> * org.eclipse.emf.teneo.annotations
>>> * org.eclipse.emf.teneo.hibernate.mapper
>> MT>> I think you also need org.eclipse.emf.teneo.libraries
> Mhh .. it is not required and AFAIK there's only commons-logging.jar in
> there, which has to be copied into
> org.eclipse.emf.cdo.server.hibernate.libraries/lib anyway.
MT2>> Yes you are right, I changed the dependencies method of the teneo plugins
to import packages so as long as there is another plugin serving commons-logging.jar
then you are okay.
>
>>> - get hold of these libraries:
>>> * hibernate3.jar
>>> * asm.jar
>>> * cglib-2.1.3.jar
>>> * commons-collections-2.1.1.jar
>>> * commons-logging-1.0.4.jar
>>> * dom4j-1.6.1.jar
>>> * jta.jar
>>> * mysql-connector-java-5.1.5-bin.jar
>>> * hsqldb.jar
>>> - copy hsqldb.jar to org.eclipse.net4j.db.hsqldb/lib
>> MT>> org.eclipse.net4j.db.hsqldb is not used in the teneo-hibernate
>> integration
>>
>>> - copy mysql-connector-java-5.1.5-bin.jar to
>>> org.eclipse.net4j.db.mysql/lib
>> MT>> org.eclipse.net4j.db.mysql is not used in the teneo-hibernate
>> integration
> You're right - one could completely leave out the net4j.db.* libraries
> when using Hibernate.
>>
>>> - copy mysql-connector-java-5.1.5-bin.jar to
>>> org.eclipse.emf.cdo.tests.hibernate
>> MT>> should be to the lib directory in this plugin
> Correct - typo. :-)
>>
>>> - copy the following libraries to
>>> org.eclipse.emf.cdo.server.hibernate.libraries/lib
>>> * hibernate3.jar
>>> * asm.jar
>>> * cglib-2.1.3.jar
>>> * commons-collections-2.1.1.jar
>>> * commons-logging-1.0.4.jar
>>> * dom4j-1.6.1.jar
>>> * jta.jar
>>> * hsqldb.jar
>>> - copy the following libraries to
>>> org.eclipse.emf.teneo.hibernate.mapper:
>>> * hibernate3.jar
>>> * dom4j-1.6.1.jar
>> MT>> It should not be necessary to copy jars to
>> org.eclipse.emf.teneo.hibernate.mapper
> Hmmm ... maybe that depends on how it is used / deployed?
> I get build errors that those two libraries can not be resolved.
MT2>> Can you post a screenshot then I can try to solve this as it should
not be required.
>>
>>>
>>> - Try out new store with small test case:
>>>
>>> |IManagedContainer container = IPluginContainer.INSTANCE;
>>> acceptor = JVMUtil.getAcceptor(container, "default");
>>> store = *new *HibernateStore(*new
>>> *TeneoHibernateMappingProvider());
>>> Map<String, String> props = *new *HashMap<String,
>>> String>();
>>> props.put(Props.PROP_OVERRIDE_UUID,
>>> "f8188187-65de-4c8a-8e75-e0ce5949837a");
>>> props.put(Props.PROP_SUPPORTING_AUDITS, "false");
>>> props.put(Props.PROP_SUPPORTING_REVISION_DELTAS, "false");
>>> props.put(Props.PROP_VERIFYING_REVISIONS, "false");
>>> props.put(Props.PROP_CURRENT_LRU_CAPACITY, "10000");
>>> props.put(Props.PROP_REVISED_LRU_CAPACITY, "10000");
>>> props.put("hibernate.connection.autocommit","true");
>>>
>>> props.put("hibernate.cache.provider_class","=org.hibernate.cache.HashtableCacheProvider ");
>>>
>>>
>>> props.put("hibernate.connection.driver_class","com.mysql.jdbc.Driver ");
>>>
>>> props.put("hibernate.connection.url","jdbc:mysql://localhost:3306/" +
>>> DB_NAME);
>>> props.put("hibernate.connection.username", DB_USER);
>>> props.put("hibernate.connection.password", DB_PASS);
>>>
>>> props.put("hibernate.dialect","org.hibernate.dialect.MySQLInnoDBDialect ");
>>>
>>> repository = CDOServerUtil.createRepository(repositoryName,
>>> store,
>>> props);
>>> CDOServerUtil.addRepository(container, repository);
>>> connector = JVMUtil.getConnector(container, "default");
>>> session = CDOUtil.openSession(connector, repositoryName,
>>> *true*);
>>> transaction = session.openTransaction();
>>>
>>> session.getPackageRegistry().putEPackage(ArtifactBasePackage .eINSTANCE);
>>> session.getPackageRegistry().putEPackage(RequipsePackage.eIN STANCE);
>>>
>>> session.getPackageRegistry().putEPackage(WeightedLinksPackag e.eINSTANCE);
>>>
>>> resource = transaction.getOrCreateResource(RESOURCE_PATH);
>>> // etc ... (put stuff into repository)
>>>
>>> |
>>>
>>>
>>> => I can't get hibernate to find the mysql driver class. Tried
>>> putting mysql-connector-java-5.1.5-bin.jar in my test plugin, tried
>>> exporting packages and using Eclipse-BuddyPolicy: dependent but no
>>> success.
>> MT>> In which plugin did you set dependent? It should be in the one
>> with the hibernate libraries
>> The mysql jar must be in the lib directory of the hibernate.test plugin
> I created a new test plugin for my own stuff. But if I place the mysql
> driver there, hibernate does not find it.
>>
>>> => temp solution: add mysql-connector-java-5.1.5-bin.jar to
>>> org.eclipse.emf.cdo.server.hibernate.libraries project and add it to
>>> that Bundle-ClassPath
>> MT>> Yes this is also fine
>>
>>> => class is now found
>>>
>>> - next error is
>>> 24.04.2008 16:58:54 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
>>> FATAL: could not complete schema update
>>> org.hibernate.MappingException: Could not determine type for:
>>> org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOTy peUserType,
>>> at table: cdo_features, for columns:
>>> [org.hibernate.mapping.Column(type)]
>>> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 69)
>>> at org.hibernate.mapping.Column.getSqlTypeCode(Column.java:138)
>>> at org.hibernate.mapping.Column.getSqlType(Column.java:182)
>>> at org.hibernate.mapping.Table.sqlCreateString(Table.java:397)
>>> at
>>> org.hibernate.cfg.Configuration.generateSchemaUpdateScript(C onfiguration.java:962)
>>>
>>> at
>>> org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate .java:140)
>>> at
>>> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.initSchema(HibernatePackageHandler.java:346)
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.doActivate(HibernatePackageHandler.java:307)
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore .doActivate(HibernateStore.java:205)
>>>
>>> at
>>> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>>>
>>> at
>>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
>>>
>>> at
>>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:262)
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:250)
>>>
>>> at
>>> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>>>
>>> at
>>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
>>>
>>> at
>>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
>>>
>>> at
>>> org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
>>>
>>>
>>> Giving up for today - maybe this error is familiar to someone? Eike?
>>> Martin?
>> MT>> Do you have this class
>> (org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOT ypeUserType)
>> in the org.eclipse.emf.cdo.server.hibernate plugin?
> Yes.
> The problem is, as far as I can see after some debugging, a classloader
> problem.
>
> The mapping which makes problems is
>
> [...]
> <joined-subclass name="CDOFeatureImpl" table="cdo_features"
> extends="CDOModelElementImpl">
> <key/>
> <property name="featureID" column="feature" type="int"
> not-null="true" />
> / <property name="type"
> type=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOTy peUserType "
>
> not-null="false" />
> /[...]
>
> from org.eclipse.emf.cdo.server.hibernate/mappings/meta.hbm.xml
>
> When the schema is to be created, hibernate iterated through the
> mappings and comes to the mapping above.
> Then we are at org.hibernate.mapping.SimpleValue.getType() (line 260)
>
> Type result = TypeFactory.heuristicType(typeName, typeParameters);
>
> where he tries to load the type via ReflectHelper.classForName( typeName
> ); and fails.
>
> After some trial and error, I found out that adding
>
> Eclipse-BuddyPolicy: dependent
>
> to the MANIFEST.MF of org.eclipse.emf.cdo.server.hibernate.libraries
> does the trick. With this policy set, the class is found and I can even
> again delete the mysql driver class from
> org.eclipse.emf.cdo.server.hibernate.libraries.
MT2>> Yes I was/am actually surprised that our testcases run without this Eclipse-Buddypolicy
setting, so setting it seems a good idea.
>
> I don't know quite much about classloading in Eclipse (or OSGi,
> respectivly), this is very much magical to me, but can it be, that the
> missing Eclipse-BuddyPolicy in
> org.eclipse.emf.cdo.server.hibernate.libraries is a bug? But then, this
> may as well be the result of my "non-standard" installation (copying
> jars to org.eclipse.emf.teneo.hibernate.mapper)...
MT2>> Eclipse-Buddypolicy dependent means that a plugin will search for classes
in the plugins which depend on it. An example, say that you have a plugin A which depends on plugins
B and C. Now assume that A passes a config file (a mapping file) to B which contains the name of a
class which is served by C. Then with Eclipse-Buddypolicy dependent in B the following will happen:
- B will try to resolve the class, but it can't as the class is not present in his own plugin
- B then asks A because A depends on B and B has Eclipse Buddypolicy dependent
- A tries to load the class but fails so it checks C
- C has the class and loads it and gives it back.
As you can see for libraries like hibernate which instantiate classes from other plugins which are
outside of the visibility of hibernate, Eclipse-buddypolicy dependent is a required feature. Note
that eclipse buddy policy dependent is not very good from a performance point of view as the class
loading process has to go through all these plugins.
>
>
> Ok, next one: I'm running into a net.sf.cglib.core.CodeGenerationException
MT2>> I have looked at the exception below but I can't really think why this occurs.
Do you have a cglib jar in another plugin maybe can you check that?
If you can put in a small test project and email it to me then I can try to replicate it.
>
> INFO: building session factory
> 25.04.2008 16:02:13 org.hibernate.impl.SessionFactoryImpl <init>
> FEIN: Session factory constructed with filter configurations : {}
> 25.04.2008 16:02:13 org.hibernate.impl.SessionFactoryImpl <init>
> FEIN: instantiating session factory with properties:
> {hibernate.connection.autocommit=true,
> hibernate.connection.driver_class=com.mysql.jdbc.Driver,
> hibernate.cache.provider_class=org.hibernate.cache.Hashtable CacheProvider,
> hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect,
> verifyingRevisions=false, supportingRevisionDeltas=false,
> currentLRUCapacity=10000, revisedLRUCapacity=10000,
> overrideUUID=f8188187-65de-4c8a-8e75-e0ce5949837a,
> hibernate.connection.username=requipse,
> hibernate.connection.url=jdbc:mysql://localhost:3306/requipse,
> supportingAudits=false, hibernate.connection.password=requipse}
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Static SQL for entity:
> org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Version select: select id from cdo_modelelements where id =?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Snapshot select: select cdoclassim_.CDOClassImpl,
> cdoclassim_1_.name as name0_, cdoclassim_.classifier as classifier3_,
> cdoclassim_.abstract as abstract3_ from cdo_classes cdoclassim_ inner
> join cdo_modelelements cdoclassim_1_ on
> cdoclassim_.CDOClassImpl=cdoclassim_1_.id where cdoclassim_.CDOClassImpl=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Insert 0: insert into cdo_modelelements (name, id) values (?, ?)
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Update 0: update cdo_modelelements set name=? where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Delete 0: delete from cdo_modelelements where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Insert 1: insert into cdo_classes (classifier, abstract,
> CDOClassImpl) values (?, ?, ?)
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Update 1: update cdo_classes set classifier=?, abstract=? where
> CDOClassImpl=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Delete 1: delete from cdo_classes where CDOClassImpl=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Static SQL for entity:
> org.eclipse.emf.cdo.internal.protocol.model.CDOPackageImpl
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Version select: select id from cdo_modelelements where id =?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Snapshot select: select cdopackage_.CDOPackageImpl,
> cdopackage_1_.name as name0_, cdopackage_.uri as uri1_,
> cdopackage_.ecore as ecore1_, cdopackage_.dynamic as dynamic1_,
> cdopackage_.parentUri as parentUri1_, cdopackage_.metaIDStart as
> metaIDSt6_1_, cdopackage_.metaIDSize as metaIDSize1_ from cdo_packages
> cdopackage_ inner join cdo_modelelements cdopackage_1_ on
> cdopackage_.CDOPackageImpl=cdopackage_1_.id where
> cdopackage_.CDOPackageImpl=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Insert 0: insert into cdo_modelelements (name, id) values (?, ?)
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Update 0: update cdo_modelelements set name=? where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Delete 0: delete from cdo_modelelements where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Insert 1: insert into cdo_packages (uri, ecore, dynamic,
> parentUri, metaIDStart, metaIDSize, CDOPackageImpl) values (?, ?, ?, ?,
> ?, ?, ?)
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Update 1: update cdo_packages set uri=?, ecore=?, dynamic=?,
> parentUri=?, metaIDStart=?, metaIDSize=? where CDOPackageImpl=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Delete 1: delete from cdo_packages where CDOPackageImpl=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Static SQL for entity:
> org.eclipse.emf.cdo.internal.protocol.model.CDOModelElementI mpl
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Version select: select id from cdo_modelelements where id =?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Snapshot select: select cdomodelel_.id, cdomodelel_.name as
> name0_ from cdo_modelelements cdomodelel_ where cdomodelel_.id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Insert 0: insert into cdo_modelelements (name, id) values (?, ?)
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Update 0: update cdo_modelelements set name=? where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Delete 0: delete from cdo_modelelements where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Static SQL for entity:
> org.eclipse.emf.cdo.internal.protocol.model.CDOClassProxy
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Version select: select id from cdo_classes_proxy where id =?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Snapshot select: select cdoclasspr_.id, cdoclasspr_.cdoclass as
> cdoclass2_ from cdo_classes_proxy cdoclasspr_ where cdoclasspr_.id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Insert 0: insert into cdo_classes_proxy (cdoclass, id) values (?, ?)
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Update 0: update cdo_classes_proxy set cdoclass=? where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Delete 0: delete from cdo_classes_proxy where id=?
> main [debug] Releasing hibernate session
> main [debug] Clearing session in threadlocal
> main [debug] Removing hibernate session
> net.sf.cglib.core.CodeGenerationException:
> java.lang.reflect.InvocationTargetException-->null
> at
> net.sf.cglib.core.AbstractClassGenerator.create(AbstractClas sGenerator.java:237)
>
> at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
> at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
> at
> org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxy Factory(CGLIBLazyInitializer.java:127)
>
> at
> org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstant iate(CGLIBProxyFactory.java:43)
>
> at
> org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFact ory(PojoEntityTuplizer.java:162)
>
> at
> org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)
>
> at
> org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
>
> at
> org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping . <init>(EntityEntityModeToTuplizerMapping.java:56)
>
> at
> org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:302)
> at
> org.hibernate.persister.entity.AbstractEntityPersister.<init >(AbstractEntityPersister.java:434)
>
> at
> org.hibernate.persister.entity.JoinedSubclassEntityPersister . <init>(JoinedSubclassEntityPersister.java:91)
>
> at
> org.hibernate.persister.PersisterFactory.createClassPersiste r(PersisterFactory.java:58)
>
> at
> org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
> at
> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1300)
>
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getSessionFactory(HibernatePackageHandler.java:273 )
>
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.readPackageInfos(HibernatePackageHandler.java:244)
>
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getCDOPackageInfos(HibernatePackageHandler.java:18 8)
>
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Reader.readPackageInfos(HibernateStoreReader.java:87)
>
> at
> org.eclipse.emf.cdo.internal.server.PackageManager.doActivat e(PackageManager.java:72)
>
> at
> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>
> at
> org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:263)
>
> at
> org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:250)
>
> at
> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>
> at
> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
>
> at
> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
>
> at
> org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
>
> at
> my.tests.WeightedLinkPersistenceTests.setUp(WeightedLinkPers istenceTests.java:92)
>
> 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.junit.internal.runners.BeforeAndAfterRunner.invokeMethod (BeforeAndAfterRunner.java:74)
>
> at
> org.junit.internal.runners.BeforeAndAfterRunner.runBefores(B eforeAndAfterRunner.java:50)
>
> at
> org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:33)
>
> at
> org.junit.internal.runners.TestMethodRunner.runMethod(TestMe thodRunner.java:75)
>
> at
> org.junit.internal.runners.TestMethodRunner.run(TestMethodRu nner.java:45)
> at
> org.junit.internal.runners.TestClassMethodsRunner.invokeTest Method(TestClassMethodsRunner.java:66)
>
> at
> org.junit.internal.runners.TestClassMethodsRunner.run(TestCl assMethodsRunner.java:35)
>
> at
> org.junit.internal.runners.TestClassRunner$1.runUnprotected( TestClassRunner.java:42)
>
> at
> org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:34)
>
> at
> org.junit.internal.runners.TestClassRunner.run(TestClassRunn er.java:52)
> at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:45)
>
> at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
>
> at
> org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunne r.main(RemotePluginTestRunner.java:62)
>
> at
> org.eclipse.pde.internal.junit.runtime.UITestApplication$1.r un(UITestApplication.java:118)
>
> at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
> at
> org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:130)
>
> at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3750)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3375)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2375)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2339)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 05)
> at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:478)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:288)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:473)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at
> org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
>
> at
> org.eclipse.pde.internal.junit.runtime.UITestApplication.sta rt(UITestApplication.java:52)
>
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:193)
>
> 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:362)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:175)
>
> 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: 549)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
> Caused by: java.lang.reflect.InvocationTargetException
> 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 net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java :384)
> at
> net.sf.cglib.core.AbstractClassGenerator.create(AbstractClas sGenerator.java:219)
>
> ... 74 more
> Caused by: java.lang.NoClassDefFoundError:
> org/hibernate/proxy/HibernateProxy
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(Unknown Source)
> ... 80 more
> Caused by: java.lang.ClassNotFoundException:
> org.hibernate.proxy.HibernateProxy
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl assInternal(BundleLoader.java:481)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:397)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:385)
>
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:87)
>
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
> ... 82 more
>
>
> Again a classloader problem, I think.
> Tried a lot of alternatives of moving hibernate3.jar around and create
> and delete copies of it.
> No effect.
>
> Giving up for today - maybe there's some light of wisdom coming to me
> (or you?).
>
> Anyway, have a nice weekend
>
> Stefan
>
>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Re: [CDO-Teneo-Hibernate] Experience report and errors: Migrating from classic MySQLAdapter-backed s [message #617922 is a reply to message #120124] |
Sat, 26 April 2008 09:20 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
|
Hi Stefan,
You're right, I deleted org.eclipse.emf.cdo.server.hibernate from the
plugins/ folder.
Cheers
/Eike
Stefan Winkler schrieb:
> Hi,
>
> today, I learned that Eclipse is always good for some extra fun.
> For some reason it deleted the
> <classpathentry kind="con"
> path="org.eclipse.pde.core.requiredPlugins"/>
> from the .classpath file in all project in my workspace. It is creepy
> when Eclipse does not find a single dependency anymore.
> Luckily I was able to locate the problem after some time - so now I am
> back and ready to proceed.
>
> Thanks, Martin, for all your comments. As you might have guessed, most
> errors I wrote were simple typos / paste errors:
>>> Hi,
>>>
>>> since I had to convince some of the components of working together,
>>> I'll report my steps and experiences here:
>>> Since I did not have any official guide on how to set up everything,
>>> I just did trial and error. So please comment, if there is any
>>> easier or more conformant way of getting CDO-Hibernate to run...
>>>
>>> - Downloaded Eclipse-3.4M6-modeling
>>> - [added my favourite plugins - subversive, java2html, keepresident]
>>> - [Create a working set for the sources of CDO etc. to keep them in
>>> one place]
>>> - CVS checkout of everything in
>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>>> > org.eclipse.emf.cdo > plugins
>>> - CVS checkout of everything in
>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>>> > org.eclipse.emf.cdo > hibernate
>>> [@Eike: there are two (conflicting) folders
>>> org.eclipse.emf.cdo.server.hibernate one in plugins, one in hibernate]
>> MT>> You should take the ones from the hibernate folder
> Sure - this was just to report that it could cause misunderstandings.
> @Eike: the folder in plugins is empty, you just get a conflict, if you
> try to check out everything at once because of two folders / projects
> with the same name.
>>> - CVS checkout of everything in
>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>>> > org.eclipse.emf.cdo > tests
>>> - CVS checkout of everything in
>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>>> > org.eclipse.emf.net4j > plugins
>>> - CVS checkout of following projects in
>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD > org.eclipse.emf
>>> > org.eclipse.emf.teneo > plugins
>>> * org.eclipse.emf.teneo
>>> * org.eclipse.emf.teneo.annotations
>>> * org.eclipse.emf.teneo.hibernate.mapper
>> MT>> I think you also need org.eclipse.emf.teneo.libraries
> Mhh .. it is not required and AFAIK there's only commons-logging.jar
> in there, which has to be copied into
> org.eclipse.emf.cdo.server.hibernate.libraries/lib anyway.
>
>>> - get hold of these libraries:
>>> * hibernate3.jar
>>> * asm.jar
>>> * cglib-2.1.3.jar
>>> * commons-collections-2.1.1.jar
>>> * commons-logging-1.0.4.jar
>>> * dom4j-1.6.1.jar
>>> * jta.jar
>>> * mysql-connector-java-5.1.5-bin.jar
>>> * hsqldb.jar
>>> - copy hsqldb.jar to org.eclipse.net4j.db.hsqldb/lib
>> MT>> org.eclipse.net4j.db.hsqldb is not used in the teneo-hibernate
>> integration
>>
>>> - copy mysql-connector-java-5.1.5-bin.jar to
>>> org.eclipse.net4j.db.mysql/lib
>> MT>> org.eclipse.net4j.db.mysql is not used in the teneo-hibernate
>> integration
> You're right - one could completely leave out the net4j.db.* libraries
> when using Hibernate.
>>
>>> - copy mysql-connector-java-5.1.5-bin.jar to
>>> org.eclipse.emf.cdo.tests.hibernate
>> MT>> should be to the lib directory in this plugin
> Correct - typo. :-)
>>
>>> - copy the following libraries to
>>> org.eclipse.emf.cdo.server.hibernate.libraries/lib
>>> * hibernate3.jar
>>> * asm.jar
>>> * cglib-2.1.3.jar
>>> * commons-collections-2.1.1.jar
>>> * commons-logging-1.0.4.jar
>>> * dom4j-1.6.1.jar
>>> * jta.jar
>>> * hsqldb.jar
>>> - copy the following libraries to
>>> org.eclipse.emf.teneo.hibernate.mapper:
>>> * hibernate3.jar
>>> * dom4j-1.6.1.jar
>> MT>> It should not be necessary to copy jars to
>> org.eclipse.emf.teneo.hibernate.mapper
> Hmmm ... maybe that depends on how it is used / deployed?
> I get build errors that those two libraries can not be resolved.
>>
>>>
>>> - Try out new store with small test case:
>>>
>>> |IManagedContainer container = IPluginContainer.INSTANCE;
>>> acceptor = JVMUtil.getAcceptor(container, "default");
>>> store = *new *HibernateStore(*new
>>> *TeneoHibernateMappingProvider());
>>> Map<String, String> props = *new
>>> *HashMap<String, String>();
>>> props.put(Props.PROP_OVERRIDE_UUID,
>>> "f8188187-65de-4c8a-8e75-e0ce5949837a");
>>> props.put(Props.PROP_SUPPORTING_AUDITS, "false");
>>> props.put(Props.PROP_SUPPORTING_REVISION_DELTAS, "false");
>>> props.put(Props.PROP_VERIFYING_REVISIONS, "false");
>>> props.put(Props.PROP_CURRENT_LRU_CAPACITY, "10000");
>>> props.put(Props.PROP_REVISED_LRU_CAPACITY, "10000");
>>> props.put("hibernate.connection.autocommit","true");
>>>
>>> props.put("hibernate.cache.provider_class","=org.hibernate.cache.HashtableCacheProvider ");
>>>
>>>
>>> props.put("hibernate.connection.driver_class","com.mysql.jdbc.Driver ");
>>>
>>> props.put("hibernate.connection.url","jdbc:mysql://localhost:3306/"
>>> + DB_NAME);
>>> props.put("hibernate.connection.username", DB_USER);
>>> props.put("hibernate.connection.password", DB_PASS);
>>>
>>> props.put("hibernate.dialect","org.hibernate.dialect.MySQLInnoDBDialect ");
>>>
>>> repository = CDOServerUtil.createRepository(repositoryName,
>>> store,
>>> props);
>>> CDOServerUtil.addRepository(container, repository);
>>> connector = JVMUtil.getConnector(container, "default");
>>> session = CDOUtil.openSession(connector, repositoryName,
>>> *true*);
>>> transaction = session.openTransaction();
>>>
>>> session.getPackageRegistry().putEPackage(ArtifactBasePackage .eINSTANCE);
>>>
>>>
>>> session.getPackageRegistry().putEPackage(RequipsePackage.eIN STANCE);
>>>
>>> session.getPackageRegistry().putEPackage(WeightedLinksPackag e.eINSTANCE);
>>>
>>> resource = transaction.getOrCreateResource(RESOURCE_PATH);
>>> // etc ... (put stuff into repository)
>>>
>>> |
>>>
>>>
>>> => I can't get hibernate to find the mysql driver class. Tried
>>> putting mysql-connector-java-5.1.5-bin.jar in my test plugin, tried
>>> exporting packages and using Eclipse-BuddyPolicy: dependent but no
>>> success.
>> MT>> In which plugin did you set dependent? It should be in the one
>> with the hibernate libraries
>> The mysql jar must be in the lib directory of the hibernate.test plugin
> I created a new test plugin for my own stuff. But if I place the mysql
> driver there, hibernate does not find it.
>>
>>> => temp solution: add mysql-connector-java-5.1.5-bin.jar to
>>> org.eclipse.emf.cdo.server.hibernate.libraries project and add it to
>>> that Bundle-ClassPath
>> MT>> Yes this is also fine
>>
>>> => class is now found
>>>
>>> - next error is
>>> 24.04.2008 16:58:54 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
>>> FATAL: could not complete schema update
>>> org.hibernate.MappingException: Could not determine type for:
>>> org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOTy peUserType,
>>> at table: cdo_features, for columns:
>>> [org.hibernate.mapping.Column(type)]
>>> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 69)
>>> at org.hibernate.mapping.Column.getSqlTypeCode(Column.java:138)
>>> at org.hibernate.mapping.Column.getSqlType(Column.java:182)
>>> at org.hibernate.mapping.Table.sqlCreateString(Table.java:397)
>>> at
>>> org.hibernate.cfg.Configuration.generateSchemaUpdateScript(C onfiguration.java:962)
>>>
>>> at
>>> org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate .java:140)
>>> at
>>> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.initSchema(HibernatePackageHandler.java:346)
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.doActivate(HibernatePackageHandler.java:307)
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore .doActivate(HibernateStore.java:205)
>>>
>>> at
>>> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>>>
>>> at
>>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
>>>
>>> at
>>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:262)
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:250)
>>>
>>> at
>>> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>>>
>>> at
>>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
>>>
>>> at
>>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
>>>
>>> at
>>> org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
>>>
>>>
>>> Giving up for today - maybe this error is familiar to someone? Eike?
>>> Martin?
>> MT>> Do you have this class
>> (org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOT ypeUserType)
>> in the org.eclipse.emf.cdo.server.hibernate plugin?
> Yes.
> The problem is, as far as I can see after some debugging, a
> classloader problem.
>
> The mapping which makes problems is
>
> [...]
> <joined-subclass name="CDOFeatureImpl" table="cdo_features"
> extends="CDOModelElementImpl">
> <key/>
> <property name="featureID" column="feature" type="int"
> not-null="true" />
> / <property name="type"
> type=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOTy peUserType "
>
> not-null="false" />
> /[...]
>
> from org.eclipse.emf.cdo.server.hibernate/mappings/meta.hbm.xml
>
> When the schema is to be created, hibernate iterated through the
> mappings and comes to the mapping above.
> Then we are at org.hibernate.mapping.SimpleValue.getType() (line 260)
>
> Type result = TypeFactory.heuristicType(typeName, typeParameters);
>
> where he tries to load the type via ReflectHelper.classForName(
> typeName ); and fails.
>
> After some trial and error, I found out that adding
>
> Eclipse-BuddyPolicy: dependent
>
> to the MANIFEST.MF of org.eclipse.emf.cdo.server.hibernate.libraries
> does the trick. With this policy set, the class is found and I can
> even again delete the mysql driver class from
> org.eclipse.emf.cdo.server.hibernate.libraries.
>
> I don't know quite much about classloading in Eclipse (or OSGi,
> respectivly), this is very much magical to me, but can it be, that the
> missing Eclipse-BuddyPolicy in
> org.eclipse.emf.cdo.server.hibernate.libraries is a bug? But then,
> this may as well be the result of my "non-standard" installation
> (copying jars to org.eclipse.emf.teneo.hibernate.mapper)...
>
>
> Ok, next one: I'm running into a
> net.sf.cglib.core.CodeGenerationException
>
> INFO: building session factory
> 25.04.2008 16:02:13 org.hibernate.impl.SessionFactoryImpl <init>
> FEIN: Session factory constructed with filter configurations : {}
> 25.04.2008 16:02:13 org.hibernate.impl.SessionFactoryImpl <init>
> FEIN: instantiating session factory with properties:
> {hibernate.connection.autocommit=true,
> hibernate.connection.driver_class=com.mysql.jdbc.Driver,
> hibernate.cache.provider_class=org.hibernate.cache.Hashtable CacheProvider,
> hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect,
> verifyingRevisions=false, supportingRevisionDeltas=false,
> currentLRUCapacity=10000, revisedLRUCapacity=10000,
> overrideUUID=f8188187-65de-4c8a-8e75-e0ce5949837a,
> hibernate.connection.username=requipse,
> hibernate.connection.url=jdbc:mysql://localhost:3306/requipse,
> supportingAudits=false, hibernate.connection.password=requipse}
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Static SQL for entity:
> org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Version select: select id from cdo_modelelements where id =?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Snapshot select: select cdoclassim_.CDOClassImpl,
> cdoclassim_1_.name as name0_, cdoclassim_.classifier as classifier3_,
> cdoclassim_.abstract as abstract3_ from cdo_classes cdoclassim_ inner
> join cdo_modelelements cdoclassim_1_ on
> cdoclassim_.CDOClassImpl=cdoclassim_1_.id where
> cdoclassim_.CDOClassImpl=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Insert 0: insert into cdo_modelelements (name, id) values (?, ?)
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Update 0: update cdo_modelelements set name=? where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Delete 0: delete from cdo_modelelements where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Insert 1: insert into cdo_classes (classifier, abstract,
> CDOClassImpl) values (?, ?, ?)
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Update 1: update cdo_classes set classifier=?, abstract=? where
> CDOClassImpl=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Delete 1: delete from cdo_classes where CDOClassImpl=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Static SQL for entity:
> org.eclipse.emf.cdo.internal.protocol.model.CDOPackageImpl
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Version select: select id from cdo_modelelements where id =?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Snapshot select: select cdopackage_.CDOPackageImpl,
> cdopackage_1_.name as name0_, cdopackage_.uri as uri1_,
> cdopackage_.ecore as ecore1_, cdopackage_.dynamic as dynamic1_,
> cdopackage_.parentUri as parentUri1_, cdopackage_.metaIDStart as
> metaIDSt6_1_, cdopackage_.metaIDSize as metaIDSize1_ from cdo_packages
> cdopackage_ inner join cdo_modelelements cdopackage_1_ on
> cdopackage_.CDOPackageImpl=cdopackage_1_.id where
> cdopackage_.CDOPackageImpl=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Insert 0: insert into cdo_modelelements (name, id) values (?, ?)
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Update 0: update cdo_modelelements set name=? where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Delete 0: delete from cdo_modelelements where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Insert 1: insert into cdo_packages (uri, ecore, dynamic,
> parentUri, metaIDStart, metaIDSize, CDOPackageImpl) values (?, ?, ?,
> ?, ?, ?, ?)
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Update 1: update cdo_packages set uri=?, ecore=?, dynamic=?,
> parentUri=?, metaIDStart=?, metaIDSize=? where CDOPackageImpl=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Delete 1: delete from cdo_packages where CDOPackageImpl=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Static SQL for entity:
> org.eclipse.emf.cdo.internal.protocol.model.CDOModelElementI mpl
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Version select: select id from cdo_modelelements where id =?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Snapshot select: select cdomodelel_.id, cdomodelel_.name as
> name0_ from cdo_modelelements cdomodelel_ where cdomodelel_.id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Insert 0: insert into cdo_modelelements (name, id) values (?, ?)
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Update 0: update cdo_modelelements set name=? where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Delete 0: delete from cdo_modelelements where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Static SQL for entity:
> org.eclipse.emf.cdo.internal.protocol.model.CDOClassProxy
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Version select: select id from cdo_classes_proxy where id =?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Snapshot select: select cdoclasspr_.id, cdoclasspr_.cdoclass as
> cdoclass2_ from cdo_classes_proxy cdoclasspr_ where cdoclasspr_.id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Insert 0: insert into cdo_classes_proxy (cdoclass, id) values
> (?, ?)
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Update 0: update cdo_classes_proxy set cdoclass=? where id=?
> 25.04.2008 16:02:13
> org.hibernate.persister.entity.AbstractEntityPersister logStaticSQL
> FEIN: Delete 0: delete from cdo_classes_proxy where id=?
> main [debug] Releasing hibernate session
> main [debug] Clearing session in threadlocal
> main [debug] Removing hibernate session
> net.sf.cglib.core.CodeGenerationException:
> java.lang.reflect.InvocationTargetException-->null
> at
> net.sf.cglib.core.AbstractClassGenerator.create(AbstractClas sGenerator.java:237)
>
> at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
> at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
> at
> org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxy Factory(CGLIBLazyInitializer.java:127)
>
> at
> org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstant iate(CGLIBProxyFactory.java:43)
>
> at
> org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFact ory(PojoEntityTuplizer.java:162)
>
> at
> org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)
>
> at
> org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
>
> at
> org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping . <init>(EntityEntityModeToTuplizerMapping.java:56)
>
> at
> org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:302)
>
> at
> org.hibernate.persister.entity.AbstractEntityPersister.<init >(AbstractEntityPersister.java:434)
>
> at
> org.hibernate.persister.entity.JoinedSubclassEntityPersister . <init>(JoinedSubclassEntityPersister.java:91)
>
> at
> org.hibernate.persister.PersisterFactory.createClassPersiste r(PersisterFactory.java:58)
>
> at
> org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
> at
> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1300)
>
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getSessionFactory(HibernatePackageHandler.java:273 )
>
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.readPackageInfos(HibernatePackageHandler.java:244)
>
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getCDOPackageInfos(HibernatePackageHandler.java:18 8)
>
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Reader.readPackageInfos(HibernateStoreReader.java:87)
>
> at
> org.eclipse.emf.cdo.internal.server.PackageManager.doActivat e(PackageManager.java:72)
>
> at
> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>
> at
> org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:263)
>
> at
> org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:250)
>
> at
> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>
> at
> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
>
> at
> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
>
> at
> org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
>
> at
> my.tests.WeightedLinkPersistenceTests.setUp(WeightedLinkPers istenceTests.java:92)
>
> 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.junit.internal.runners.BeforeAndAfterRunner.invokeMethod (BeforeAndAfterRunner.java:74)
>
> at
> org.junit.internal.runners.BeforeAndAfterRunner.runBefores(B eforeAndAfterRunner.java:50)
>
> at
> org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:33)
>
> at
> org.junit.internal.runners.TestMethodRunner.runMethod(TestMe thodRunner.java:75)
>
> at
> org.junit.internal.runners.TestMethodRunner.run(TestMethodRu nner.java:45)
> at
> org.junit.internal.runners.TestClassMethodsRunner.invokeTest Method(TestClassMethodsRunner.java:66)
>
> at
> org.junit.internal.runners.TestClassMethodsRunner.run(TestCl assMethodsRunner.java:35)
>
> at
> org.junit.internal.runners.TestClassRunner$1.runUnprotected( TestClassRunner.java:42)
>
> at
> org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:34)
>
> at
> org.junit.internal.runners.TestClassRunner.run(TestClassRunn er.java:52)
> at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:45)
>
> at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
>
> at
> org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunne r.main(RemotePluginTestRunner.java:62)
>
> at
> org.eclipse.pde.internal.junit.runtime.UITestApplication$1.r un(UITestApplication.java:118)
>
> at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
> at
> org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:130)
>
> at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3750)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3375)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2375)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2339)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 05)
> at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:478)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:288)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:473)
>
> at
> org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at
> org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
>
> at
> org.eclipse.pde.internal.junit.runtime.UITestApplication.sta rt(UITestApplication.java:52)
>
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:193)
>
> 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:362)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:175)
>
> 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: 549)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
> Caused by: java.lang.reflect.InvocationTargetException
> 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 net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java :384)
> at
> net.sf.cglib.core.AbstractClassGenerator.create(AbstractClas sGenerator.java:219)
>
> ... 74 more
> Caused by: java.lang.NoClassDefFoundError:
> org/hibernate/proxy/HibernateProxy
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(Unknown Source)
> ... 80 more
> Caused by: java.lang.ClassNotFoundException:
> org.hibernate.proxy.HibernateProxy
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl assInternal(BundleLoader.java:481)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:397)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:385)
>
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:87)
>
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
> ... 82 more
>
>
> Again a classloader problem, I think.
> Tried a lot of alternatives of moving hibernate3.jar around and create
> and delete copies of it.
> No effect.
>
> Giving up for today - maybe there's some light of wisdom coming to me
> (or you?).
>
> Anyway, have a nice weekend
>
> Stefan
>
>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: [CDO-Teneo-Hibernate] Experience report and errors: Migrating from classic MySQLAdapter-backed s [message #617949 is a reply to message #120152] |
Tue, 29 April 2008 14:28 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Stefan Winkler![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=stefan%40winklerweb.net) Messages: 307 Registered: July 2009 Location: Germany |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------010208080508020408020101
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Hi Martin,
Martin Taal schrieb:
> Hi Stefan,
> See my comments below.
>
> gr. Martin
>
> Stefan Winkler wrote:
>> Hi,
>>
>> today, I learned that Eclipse is always good for some extra fun.
>> For some reason it deleted the
>> <classpathentry kind="con"
>> path="org.eclipse.pde.core.requiredPlugins"/>
>> from the .classpath file in all project in my workspace. It is creepy
>> when Eclipse does not find a single dependency anymore.
>> Luckily I was able to locate the problem after some time - so now I
>> am back and ready to proceed.
>>
>> Thanks, Martin, for all your comments. As you might have guessed,
>> most errors I wrote were simple typos / paste errors:
>>>> Hi,
>>>>
>>>> since I had to convince some of the components of working together,
>>>> I'll report my steps and experiences here:
>>>> Since I did not have any official guide on how to set up
>>>> everything, I just did trial and error. So please comment, if there
>>>> is any easier or more conformant way of getting CDO-Hibernate to
>>>> run...
>>>>
>>>> - Downloaded Eclipse-3.4M6-modeling
>>>> - [added my favourite plugins - subversive, java2html, keepresident]
>>>> - [Create a working set for the sources of CDO etc. to keep them in
>>>> one place]
>>>> - CVS checkout of everything in
>>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD >
>>>> org.eclipse.emf > org.eclipse.emf.cdo > plugins
>>>> - CVS checkout of everything in
>>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD >
>>>> org.eclipse.emf > org.eclipse.emf.cdo > hibernate
>>>> [@Eike: there are two (conflicting) folders
>>>> org.eclipse.emf.cdo.server.hibernate one in plugins, one in hibernate]
>>> MT>> You should take the ones from the hibernate folder
>> Sure - this was just to report that it could cause misunderstandings.
>> @Eike: the folder in plugins is empty, you just get a conflict, if
>> you try to check out everything at once because of two folders /
>> projects with the same name.
>>>> - CVS checkout of everything in
>>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD >
>>>> org.eclipse.emf > org.eclipse.emf.cdo > tests
>>>> - CVS checkout of everything in
>>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD >
>>>> org.eclipse.emf > org.eclipse.emf.net4j > plugins
>>>> - CVS checkout of following projects in
>>>> :pserver:dev.eclipse.org:/cvsroot/modeling/ > HEAD >
>>>> org.eclipse.emf > org.eclipse.emf.teneo > plugins
>>>> * org.eclipse.emf.teneo
>>>> * org.eclipse.emf.teneo.annotations
>>>> * org.eclipse.emf.teneo.hibernate.mapper
>>> MT>> I think you also need org.eclipse.emf.teneo.libraries
>> Mhh .. it is not required and AFAIK there's only commons-logging.jar
>> in there, which has to be copied into
>> org.eclipse.emf.cdo.server.hibernate.libraries/lib anyway.
> MT2>> Yes you are right, I changed the dependencies method of the
> teneo plugins
> to import packages so as long as there is another plugin serving
> commons-logging.jar
> then you are okay.
>
>>
>>>> - get hold of these libraries:
>>>> * hibernate3.jar
>>>> * asm.jar
>>>> * cglib-2.1.3.jar
>>>> * commons-collections-2.1.1.jar
>>>> * commons-logging-1.0.4.jar
>>>> * dom4j-1.6.1.jar
>>>> * jta.jar
>>>> * mysql-connector-java-5.1.5-bin.jar
>>>> * hsqldb.jar
>>>> - copy hsqldb.jar to org.eclipse.net4j.db.hsqldb/lib
>>> MT>> org.eclipse.net4j.db.hsqldb is not used in the teneo-hibernate
>>> integration
>>>
>>>> - copy mysql-connector-java-5.1.5-bin.jar to
>>>> org.eclipse.net4j.db.mysql/lib
>>> MT>> org.eclipse.net4j.db.mysql is not used in the teneo-hibernate
>>> integration
>> You're right - one could completely leave out the net4j.db.*
>> libraries when using Hibernate.
>>>
>>>> - copy mysql-connector-java-5.1.5-bin.jar to
>>>> org.eclipse.emf.cdo.tests.hibernate
>>> MT>> should be to the lib directory in this plugin
>> Correct - typo. :-)
>>>
>>>> - copy the following libraries to
>>>> org.eclipse.emf.cdo.server.hibernate.libraries/lib
>>>> * hibernate3.jar
>>>> * asm.jar
>>>> * cglib-2.1.3.jar
>>>> * commons-collections-2.1.1.jar
>>>> * commons-logging-1.0.4.jar
>>>> * dom4j-1.6.1.jar
>>>> * jta.jar
>>>> * hsqldb.jar
>>>> - copy the following libraries to
>>>> org.eclipse.emf.teneo.hibernate.mapper:
>>>> * hibernate3.jar
>>>> * dom4j-1.6.1.jar
>>> MT>> It should not be necessary to copy jars to
>>> org.eclipse.emf.teneo.hibernate.mapper
>> Hmmm ... maybe that depends on how it is used / deployed?
>> I get build errors that those two libraries can not be resolved.
> MT2>> Can you post a screenshot then I can try to solve this as it should
> not be required.
You seem to have updated build.properties yesterday so now there's no
problem anymore.
>>>
>>>>
>>>> - Try out new store with small test case:
>>>>
>>>> |IManagedContainer container = IPluginContainer.INSTANCE;
>>>> acceptor = JVMUtil.getAcceptor(container, "default");
>>>> store = *new *HibernateStore(*new
>>>> *TeneoHibernateMappingProvider());
>>>> Map<String, String> props = *new
>>>> *HashMap<String, String>();
>>>> props.put(Props.PROP_OVERRIDE_UUID,
>>>> "f8188187-65de-4c8a-8e75-e0ce5949837a");
>>>> props.put(Props.PROP_SUPPORTING_AUDITS, "false");
>>>> props.put(Props.PROP_SUPPORTING_REVISION_DELTAS, "false");
>>>> props.put(Props.PROP_VERIFYING_REVISIONS, "false");
>>>> props.put(Props.PROP_CURRENT_LRU_CAPACITY, "10000");
>>>> props.put(Props.PROP_REVISED_LRU_CAPACITY, "10000");
>>>> props.put("hibernate.connection.autocommit","true");
>>>>
>>>> props.put("hibernate.cache.provider_class","=org.hibernate.cache.HashtableCacheProvider ");
>>>>
>>>>
>>>> props.put("hibernate.connection.driver_class","com.mysql.jdbc.Driver ");
>>>>
>>>>
>>>> props.put("hibernate.connection.url","jdbc:mysql://localhost:3306/"
>>>> + DB_NAME);
>>>> props.put("hibernate.connection.username", DB_USER);
>>>> props.put("hibernate.connection.password", DB_PASS);
>>>>
>>>> props.put("hibernate.dialect","org.hibernate.dialect.MySQLInnoDBDialect ");
>>>>
>>>> repository = CDOServerUtil.createRepository(repositoryName,
>>>> store,
>>>> props);
>>>> CDOServerUtil.addRepository(container, repository);
>>>> connector = JVMUtil.getConnector(container, "default");
>>>> session = CDOUtil.openSession(connector, repositoryName,
>>>> *true*);
>>>> transaction = session.openTransaction();
>>>>
>>>> session.getPackageRegistry().putEPackage(ArtifactBasePackage .eINSTANCE);
>>>>
>>>>
>>>> session.getPackageRegistry().putEPackage(RequipsePackage.eIN STANCE);
>>>>
>>>> session.getPackageRegistry().putEPackage(WeightedLinksPackag e.eINSTANCE);
>>>>
>>>> resource = transaction.getOrCreateResource(RESOURCE_PATH);
>>>> // etc ... (put stuff into repository)
>>>>
>>>> |
>>>>
>>>>
>>>> => I can't get hibernate to find the mysql driver class. Tried
>>>> putting mysql-connector-java-5.1.5-bin.jar in my test plugin, tried
>>>> exporting packages and using Eclipse-BuddyPolicy: dependent but no
>>>> success.
>>> MT>> In which plugin did you set dependent? It should be in the one
>>> with the hibernate libraries
>>> The mysql jar must be in the lib directory of the hibernate.test plugin
>> I created a new test plugin for my own stuff. But if I place the
>> mysql driver there, hibernate does not find it.
>>>
>>>> => temp solution: add mysql-connector-java-5.1.5-bin.jar to
>>>> org.eclipse.emf.cdo.server.hibernate.libraries project and add it
>>>> to that Bundle-ClassPath
>>> MT>> Yes this is also fine
>>>
>>>> => class is now found
>>>>
>>>> - next error is
>>>> 24.04.2008 16:58:54 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
>>>> FATAL: could not complete schema update
>>>> org.hibernate.MappingException: Could not determine type for:
>>>> org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOTy peUserType,
>>>> at table: cdo_features, for columns:
>>>> [org.hibernate.mapping.Column(type)]
>>>> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 69)
>>>> at org.hibernate.mapping.Column.getSqlTypeCode(Column.java:138)
>>>> at org.hibernate.mapping.Column.getSqlType(Column.java:182)
>>>> at org.hibernate.mapping.Table.sqlCreateString(Table.java:397)
>>>> at
>>>> org.hibernate.cfg.Configuration.generateSchemaUpdateScript(C onfiguration.java:962)
>>>>
>>>> at
>>>> org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate .java:140)
>>>> at
>>>> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.initSchema(HibernatePackageHandler.java:346)
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.doActivate(HibernatePackageHandler.java:307)
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore .doActivate(HibernateStore.java:205)
>>>>
>>>> at
>>>> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>>>>
>>>> at
>>>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
>>>>
>>>> at
>>>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:262)
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:250)
>>>>
>>>> at
>>>> org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
>>>>
>>>> at
>>>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
>>>>
>>>> at
>>>> org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
>>>>
>>>>
>>>> Giving up for today - maybe this error is familiar to someone?
>>>> Eike? Martin?
>>> MT>> Do you have this class
>>> (org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOT ypeUserType)
>>> in the org.eclipse.emf.cdo.server.hibernate plugin?
>> Yes.
>> The problem is, as far as I can see after some debugging, a
>> classloader problem.
>>
>> The mapping which makes problems is
>>
>> [...]
>> <joined-subclass name="CDOFeatureImpl" table="cdo_features"
>> extends="CDOModelElementImpl">
>> <key/>
>> <property name="featureID" column="feature" type="int"
>> not-null="true" />
>> / <property name="type"
>> type=" org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOTy peUserType "
>>
>> not-null="false" />
>> /[...]
>>
>> from org.eclipse.emf.cdo.server.hibernate/mappings/meta.hbm.xml
>>
>> When the schema is to be created, hibernate iterated through the
>> mappings and comes to the mapping above.
>> Then we are at org.hibernate.mapping.SimpleValue.getType() (line 260)
>>
>> Type result = TypeFactory.heuristicType(typeName, typeParameters);
>>
>> where he tries to load the type via ReflectHelper.classForName(
>> typeName ); and fails.
>>
>> After some trial and error, I found out that adding
>>
>> Eclipse-BuddyPolicy: dependent
>>
>> to the MANIFEST.MF of org.eclipse.emf.cdo.server.hibernate.libraries
>> does the trick. With this policy set, the class is found and I can
>> even again delete the mysql driver class from
>> org.eclipse.emf.cdo.server.hibernate.libraries.
> MT2>> Yes I was/am actually surprised that our testcases run without
> this Eclipse-Buddypolicy
> setting, so setting it seems a good idea.
Is there a testcase using an embedded server/client (meaning: a net4j
JVM connection?). I guess a lot of the trouble is caused by this setting.
I can run the standalone hibernate server for the testcases with no
problem, but has any of you two tried testing with server and client
inside one JVM?
I started over and wiped my workspace today.
I checked out:
org.eclipse.emf.cdo
org.eclipse.emf.cdo.protocol
org.eclipse.emf.cdo.server
org.eclipse.emf.cdo.server.hibernate
org.eclipse.emf.cdo.server.hibernate.id
org.eclipse.emf.cdo.server.hibernate.libraries
org.eclipse.emf.cdo.server.hibernate.teneo
org.eclipse.emf.teneo
org.eclipse.emf.teneo.annotations
org.eclipse.emf.teneo.hibernate.mapper
org.eclipse.net4j
org.eclipse.net4j.jvm
org.eclipse.net4j.util
and added these libraries:
/org.eclipse.emf.cdo.server.hibernate.libraries/lib/asm.jar
/org.eclipse.emf.cdo.server.hibernate.libraries/lib/cglib-2. 1.3.jar
/org.eclipse.emf.cdo.server.hibernate.libraries/lib/commons- collections-2.1.1.jar
/org.eclipse.emf.cdo.server.hibernate.libraries/lib/commons- logging-1.0.4.jar
/org.eclipse.emf.cdo.server.hibernate.libraries/lib/dom4j-1. 6.1.jar
/org.eclipse.emf.cdo.server.hibernate.libraries/lib/hibernat e3.jar
/org.eclipse.emf.cdo.server.hibernate.libraries/lib/jta.jar
and (for now):
/org.eclipse.emf.cdo.server.hibernate.libraries/lib/mysql-co nnector-java-5.1.5-bin.jar
I also added the mysql libraries to the runtime classpath.
To analyze class loading problems I turned on tracing of "debug/loader"
of the org.eclipse.osgi bundle.
With this configuration I get this issue:
29.04.2008 11:06:58 org.hibernate.cfg.Configuration
secondPassCompileForeignKeys
FEIN: resolving reference to class:
org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl
BundleClassLoader[org.eclipse.emf.cdo.server.hibernate.libra ries_0.8.0.qualifier].loadClass(org.eclipse.emf.cdo.server.i nternal.hibernate.tuplizer.CDOIDMetaRangeUserType)
BundleLoader[org.eclipse.emf.cdo.server.hibernate.libraries_ 0.8.0.qualifier].loadBundleClass(org.eclipse.emf.cdo.server. internal.hibernate.tuplizer.CDOIDMetaRangeUserType)
BundleLoader[org.eclipse.emf.cdo.server.hibernate.libraries_ 0.8.0.qualifier].findLocalClass(org.eclipse.emf.cdo.server.i nternal.hibernate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\hiberna te3.jar].findClass(org.eclipse.emf.cdo.server.internal.hiber nate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\asm.jar ].findClass(org.eclipse.emf.cdo.server.internal.hibernate.tu plizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\cglib-2 .1.3.jar].findClass(org.eclipse.emf.cdo.server.internal.hibe rnate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\commons -collections-2.1.1.jar].findClass(org.eclipse.emf.cdo.server .internal.hibernate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\commons -logging-1.0.4.jar].findClass(org.eclipse.emf.cdo.server.int ernal.hibernate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\dom4j-1 .6.1.jar].findClass(org.eclipse.emf.cdo.server.internal.hibe rnate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\jta.jar ].findClass(org.eclipse.emf.cdo.server.internal.hibernate.tu plizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\mysql-c onnector-java-5.1.5-bin.jar].findClass(org.eclipse.emf.cdo.s erver.internal.hibernate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[org.eclipse.emf.cdo.server.hibernate.libra ries_0.8.0.qualifier].loadClass(org.eclipse.emf.cdo.server.i nternal.hibernate.tuplizer.CDOIDMetaRangeUserType)
failed.
java.lang.ClassNotFoundException:
org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOID MetaRangeUserType
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl assInternal(BundleLoader.java:481)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:397)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:385)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:87)
at java.lang.ClassLoader.loadClass(Unknown Source)
at
org.eclipse.core.runtime.internal.adaptor.ContextFinder.load Class(ContextFinder.java:124)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper. java:95)
at org.hibernate.type.TypeFactory.heuristicType(TypeFactory.jav a:223)
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 60)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:2 53)
at org.hibernate.mapping.Property.isValid(Property.java:185)
at
org.hibernate.mapping.PersistentClass.validate(PersistentCla ss.java:440)
at org.hibernate.mapping.JoinedSubclass.validate(JoinedSubclass .java:40)
at org.hibernate.cfg.Configuration.validate(Configuration.java: 1108)
at
org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1293)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getSessionFactory(HibernatePackageHandler.java:332 )
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.readPackageInfos(HibernatePackageHandler.java:290)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getCDOPackageInfos(HibernatePackageHandler.java:21 2)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Reader.readPackageInfos(HibernateStoreReader.java:87)
at
org.eclipse.emf.cdo.internal.server.PackageManager.doActivat e(PackageManager.java:72)
at
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
at
org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:264)
at
org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:251)
at
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
at
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
at
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
at
org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
at mytest.MyTest.setUp(MyTest.java:88)
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.junit.internal.runners.BeforeAndAfterRunner.invokeMethod (BeforeAndAfterRunner.java:74)
at
org.junit.internal.runners.BeforeAndAfterRunner.runBefores(B eforeAndAfterRunner.java:50)
at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:33)
at
org.junit.internal.runners.TestMethodRunner.runMethod(TestMe thodRunner.java:75)
at
org.junit.internal.runners.TestMethodRunner.run(TestMethodRu nner.java:45)
at
org.junit.internal.runners.TestClassMethodsRunner.invokeTest Method(TestClassMethodsRunner.java:66)
at
org.junit.internal.runners.TestClassMethodsRunner.run(TestCl assMethodsRunner.java:35)
at
org.junit.internal.runners.TestClassRunner$1.runUnprotected( TestClassRunner.java:42)
at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:34)
at
org.junit.internal.runners.TestClassRunner.run(TestClassRunn er.java:52)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:45)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
at
org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunne r.main(RemotePluginTestRunner.java:62)
at
org.eclipse.pde.internal.junit.runtime.CoreTestApplication.r un(CoreTestApplication.java:23)
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.internal.app.EclipseAppContainer.callMet hod(EclipseAppContainer.java:565)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:195)
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:362)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:175)
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: 549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
BundleClassLoader[org.eclipse.emf.cdo.server.hibernate.libra ries_0.8.0.qualifier].loadClass(org.eclipse.emf.cdo.server.i nternal.hibernate.tuplizer.CDOIDMetaRangeUserType)
BundleLoader[org.eclipse.emf.cdo.server.hibernate.libraries_ 0.8.0.qualifier].loadBundleClass(org.eclipse.emf.cdo.server. internal.hibernate.tuplizer.CDOIDMetaRangeUserType)
BundleLoader[org.eclipse.emf.cdo.server.hibernate.libraries_ 0.8.0.qualifier].findLocalClass(org.eclipse.emf.cdo.server.i nternal.hibernate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\hiberna te3.jar].findClass(org.eclipse.emf.cdo.server.internal.hiber nate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\asm.jar ].findClass(org.eclipse.emf.cdo.server.internal.hibernate.tu plizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\cglib-2 .1.3.jar].findClass(org.eclipse.emf.cdo.server.internal.hibe rnate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\commons -collections-2.1.1.jar].findClass(org.eclipse.emf.cdo.server .internal.hibernate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\commons -logging-1.0.4.jar].findClass(org.eclipse.emf.cdo.server.int ernal.hibernate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\dom4j-1 .6.1.jar].findClass(org.eclipse.emf.cdo.server.internal.hibe rnate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\jta.jar ].findClass(org.eclipse.emf.cdo.server.internal.hibernate.tu plizer.CDOIDMetaRangeUserType)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate.libraries\lib\mysql-c onnector-java-5.1.5-bin.jar].findClass(org.eclipse.emf.cdo.s erver.internal.hibernate.tuplizer.CDOIDMetaRangeUserType)
BundleClassLoader[org.eclipse.emf.cdo.server.hibernate.libra ries_0.8.0.qualifier].loadClass(org.eclipse.emf.cdo.server.i nternal.hibernate.tuplizer.CDOIDMetaRangeUserType)
failed.
java.lang.ClassNotFoundException:
org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.CDOID MetaRangeUserType
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl assInternal(BundleLoader.java:481)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:397)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:385)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:87)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper. java:100)
at org.hibernate.type.TypeFactory.heuristicType(TypeFactory.jav a:223)
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 60)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:2 53)
at org.hibernate.mapping.Property.isValid(Property.java:185)
at
org.hibernate.mapping.PersistentClass.validate(PersistentCla ss.java:440)
at org.hibernate.mapping.JoinedSubclass.validate(JoinedSubclass .java:40)
at org.hibernate.cfg.Configuration.validate(Configuration.java: 1108)
at
org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1293)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getSessionFactory(HibernatePackageHandler.java:332 )
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.readPackageInfos(HibernatePackageHandler.java:290)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getCDOPackageInfos(HibernatePackageHandler.java:21 2)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Reader.readPackageInfos(HibernateStoreReader.java:87)
at
org.eclipse.emf.cdo.internal.server.PackageManager.doActivat e(PackageManager.java:72)
at
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
at
org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:264)
at
org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:251)
at
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
at
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
at
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
at
org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
at mytest.MyTest.setUp(MyTest.java:88)
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.junit.internal.runners.BeforeAndAfterRunner.invokeMethod (BeforeAndAfterRunner.java:74)
at
org.junit.internal.runners.BeforeAndAfterRunner.runBefores(B eforeAndAfterRunner.java:50)
at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:33)
at
org.junit.internal.runners.TestMethodRunner.runMethod(TestMe thodRunner.java:75)
at
org.junit.internal.runners.TestMethodRunner.run(TestMethodRu nner.java:45)
at
org.junit.internal.runners.TestClassMethodsRunner.invokeTest Method(TestClassMethodsRunner.java:66)
at
org.junit.internal.runners.TestClassMethodsRunner.run(TestCl assMethodsRunner.java:35)
at
org.junit.internal.runners.TestClassRunner$1.runUnprotected( TestClassRunner.java:42)
at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:34)
at
org.junit.internal.runners.TestClassRunner.run(TestClassRunn er.java:52)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:45)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
at
org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunne r.main(RemotePluginTestRunner.java:62)
at
org.eclipse.pde.internal.junit.runtime.CoreTestApplication.r un(CoreTestApplication.java:23)
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.internal.app.EclipseAppContainer.callMet hod(EclipseAppContainer.java:565)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:195)
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:362)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:175)
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: 549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
Ok - the problem seems to be that the
org.eclipse.emf.cdo.server.hibernate.libraries Bundle where
hibernate3.jar lives does not see org.eclipse.emf.cdo.server which
defines the mapping types.
Idea: add Eclipse-BuddyPolicy: dependent.
Thus, I also can move the mysql-driver to my test case Bundle.
This leads to:
BundleClassLoader[org.eclipse.emf.cdo.protocol_0.8.0.qualifi er].loadClass(org.hibernate.proxy.HibernateProxy)
BundleLoader[org.eclipse.emf.cdo.protocol_0.8.0.qualifier].l oadBundleClass(org.hibernate.proxy.HibernateProxy)
BundleLoader[org.eclipse.emf.cdo.protocol_0.8.0.qualifier].f indLocalClass(org.hibernate.proxy.HibernateProxy)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.protocol\bin].findClass(org.hibernate. proxy.HibernateProxy)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.protocol].findClass(org.hibernate.prox y.HibernateProxy)
BundleClassLoader[*org.eclipse.emf.cdo.protocol_0.8.0.qualif ier*].loadClass(org.hibernate.proxy.HibernateProxy)
failed.
java.lang.ClassNotFoundException: *org.hibernate.proxy.HibernateProxy*
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl assInternal(BundleLoader.java:481)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:397)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:385)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:87)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
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 net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java :384)
at
net.sf.cglib.core.AbstractClassGenerator.create(AbstractClas sGenerator.java:219)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
at
org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxy Factory(CGLIBLazyInitializer.java:127)
at
org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstant iate(CGLIBProxyFactory.java:43)
at
org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFact ory(PojoEntityTuplizer.java:162)
at
org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)
at
org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at
org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping . <init>(EntityEntityModeToTuplizerMapping.java:56)
at
org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:302)
at
org.hibernate.persister.entity.AbstractEntityPersister.<init >(AbstractEntityPersister.java:434)
at
org.hibernate.persister.entity.JoinedSubclassEntityPersister . <init>(JoinedSubclassEntityPersister.java:91)
at
org.hibernate.persister.PersisterFactory.createClassPersiste r(PersisterFactory.java:58)
at
org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
at
org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1300)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getSessionFactory(HibernatePackageHandler.java:332 )
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.readPackageInfos(HibernatePackageHandler.java:290)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getCDOPackageInfos(HibernatePackageHandler.java:21 2)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Reader.readPackageInfos(HibernateStoreReader.java:87)
at
org.eclipse.emf.cdo.internal.server.PackageManager.doActivat e(PackageManager.java:72)
at
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
at
org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:264)
at
org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:251)
at
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
at
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
at
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
at
org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
at mytest.MyTest.setUp(MyTest.java:88)
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.junit.internal.runners.BeforeAndAfterRunner.invokeMethod (BeforeAndAfterRunner.java:74)
at
org.junit.internal.runners.BeforeAndAfterRunner.runBefores(B eforeAndAfterRunner.java:50)
at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:33)
at
org.junit.internal.runners.TestMethodRunner.runMethod(TestMe thodRunner.java:75)
at
org.junit.internal.runners.TestMethodRunner.run(TestMethodRu nner.java:45)
at
org.junit.internal.runners.TestClassMethodsRunner.invokeTest Method(TestClassMethodsRunner.java:66)
at
org.junit.internal.runners.TestClassMethodsRunner.run(TestCl assMethodsRunner.java:35)
at
org.junit.internal.runners.TestClassRunner$1.runUnprotected( TestClassRunner.java:42)
at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:34)
at
org.junit.internal.runners.TestClassRunner.run(TestClassRunn er.java:52)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:45)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
at
org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunne r.main(RemotePluginTestRunner.java:62)
at
org.eclipse.pde.internal.junit.runtime.CoreTestApplication.r un(CoreTestApplication.java:23)
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.internal.app.EclipseAppContainer.callMet hod(EclipseAppContainer.java:565)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:195)
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:362)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:175)
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: 549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
BundleClassLoader[org.eclipse.emf.cdo.server.hibernate_0.8.0 .qualifier].loadClass(org.eclipse.emf.cdo.server.internal.hi bernate.HibernateThreadContext)
BundleLoader[org.eclipse.emf.cdo.server.hibernate_0.8.0.qual ifier].loadBundleClass(org.eclipse.emf.cdo.server.internal.h ibernate.HibernateThreadContext)
BundleLoader[org.eclipse.emf.cdo.server.hibernate_0.8.0.qual ifier].findLocalClass(org.eclipse.emf.cdo.server.internal.hi bernate.HibernateThreadContext)
BundleClassLoader[C:\work\work\diss\requipse-workspace-temp- 2\org.eclipse.emf.cdo.server.hibernate\bin].findClass(org.ec lipse.emf.cdo.server.internal.hibernate.HibernateThreadConte xt)
about to read 2680 bytes from
org/eclipse/emf/cdo/server/internal/hibernate/HibernateThrea dContext.class
read 2680 bytes from
C:\work\work\diss\requipse-workspace-temp-2\org.eclipse.emf. cdo.server.hibernate\bin/org/eclipse/emf/cdo/server/internal /hibernate/HibernateThreadContext.class
defining class
org.eclipse.emf.cdo.server.internal.hibernate.HibernateThrea dContext
BundleLoader[org.eclipse.emf.cdo.server.hibernate_0.8.0.qual ifier] found
local class
org.eclipse.emf.cdo.server.internal.hibernate.HibernateThrea dContext
net.sf.cglib.core.CodeGenerationException:
java.lang.reflect.InvocationTargetException-->null
at
net.sf.cglib.core.AbstractClassGenerator.create(AbstractClas sGenerator.java:237)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
at
org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxy Factory(CGLIBLazyInitializer.java:127)
at
org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstant iate(CGLIBProxyFactory.java:43)
at
org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFact ory(PojoEntityTuplizer.java:162)
at
org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)
at
org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at
org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping . <init>(EntityEntityModeToTuplizerMapping.java:56)
at
org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:302)
at
org.hibernate.persister.entity.AbstractEntityPersister.<init >(AbstractEntityPersister.java:434)
at
org.hibernate.persister.entity.JoinedSubclassEntityPersister . <init>(JoinedSubclassEntityPersister.java:91)
at
org.hibernate.persister.PersisterFactory.createClassPersiste r(PersisterFactory.java:58)
at
org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
at
org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1300)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getSessionFactory(HibernatePackageHandler.java:332 )
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.readPackageInfos(HibernatePackageHandler.java:290)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernatePacka geHandler.getCDOPackageInfos(HibernatePackageHandler.java:21 2)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Reader.readPackageInfos(HibernateStoreReader.java:87)
at
org.eclipse.emf.cdo.internal.server.PackageManager.doActivat e(PackageManager.java:72)
at
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
at
org.eclipse.emf.cdo.internal.server.Repository.activateRepos itory(Repository.java:264)
at
org.eclipse.emf.cdo.internal.server.Repository.doActivate(Re pository.java:251)
at
org.eclipse.net4j.internal.util.lifecycle.Lifecycle.activate (Lifecycle.java:57)
at
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:71)
at
org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(Life cycleUtil.java:61)
at
org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOSe rverUtil.java:68)
at mytest.MyTest.setUp(MyTest.java:88)
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.junit.internal.runners.BeforeAndAfterRunner.invokeMethod (BeforeAndAfterRunner.java:74)
at
org.junit.internal.runners.BeforeAndAfterRunner.runBefores(B eforeAndAfterRunner.java:50)
at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:33)
at
org.junit.internal.runners.TestMethodRunner.runMethod(TestMe thodRunner.java:75)
at
org.junit.internal.runners.TestMethodRunner.run(TestMethodRu nner.java:45)
at
org.junit.internal.runners.TestClassMethodsRunner.invokeTest Method(TestClassMethodsRunner.java:66)
at
org.junit.internal.runners.TestClassMethodsRunner.run(TestCl assMethodsRunner.java:35)
at
org.junit.internal.runners.TestClassRunner$1.runUnprotected( TestClassRunner.java:42)
at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected (BeforeAndAfterRunner.java:34)
at
org.junit.internal.runners.TestClassRunner.run(TestClassRunn er.java:52)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:45)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
at
org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunne r.main(RemotePluginTestRunner.java:62)
at
org.eclipse.pde.internal.junit.runtime.CoreTestApplication.r un(CoreTestApplication.java:23)
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.internal.app.EclipseAppContainer.callMet hod(EclipseAppContainer.java:565)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:195)
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:362)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:175)
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: 549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
Caused by: java.lang.reflect.InvocationTargetException
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 net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java :384)
at
net.sf.cglib.core.AbstractClassGenerator.create(AbstractClas sGenerator.java:219)
... 66 more
Caused by: java.lang.NoClassDefFoundError:
org/hibernate/proxy/HibernateProxy
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
... 72 more
Caused by: java.lang.ClassNotFoundException:
org.hibernate.proxy.HibernateProxy
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl assInternal(BundleLoader.java:481)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:397)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:385)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:87)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 74 more
As far as I can see, Java tries to load the class
*org.hibernate.proxy.HibernateProxy* from the bundle
*org.eclipse.emf.cdo.protocol_0.8.0.qualifier*. Why so? I think because of
net.sf.cglib.proxy.Enhancer.getDefaultClassLoader (Enhancer.java:386):
protected ClassLoader getDefaultClassLoader() {
if (superclass != null) {
return superclass.getClassLoader();
Superclass is org.eclipse.emf.cdo.internal.protocol.model.CDOFeatureImpl
in this call.
Maybe this is a bug in CGLib or Hibernate, because it implicitly assumes
that the class loader of the super class of a class to persist is able
to locate the HibernateProxy interface, which is not the case here. As a
workaround, I add the Eclipse-BuddyPolicy: dependent property to the
*org.eclipse.emf.cdo.protocol *bundle as well.
.... works (well, a bit): I am able to create the repository, session and
transaction, I can create my model and add it to a newly created repository.
However, I am not able to commit, because for some reason, the
cdo_resource table is not created.
FEIN: begin
29.04.2008 16:05:35 org.hibernate.jdbc.ConnectionManager openConnection
FEIN: opening JDBC connection
29.04.2008 16:05:35
org.hibernate.connection.DriverManagerConnectionProvider getConnection
AM FEINSTEN: total checked-out connections: 0
29.04.2008 16:05:35
org.hibernate.connection.DriverManagerConnectionProvider getConnection
AM FEINSTEN: using pooled JDBC connection, pool size: 0
29.04.2008 16:05:35 org.hibernate.transaction.JDBCTransaction begin
FEIN: current autocommit status: true
29.04.2008 16:05:35 org.hibernate.transaction.JDBCTransaction begin
FEIN: disabling autocommit
29.04.2008 16:05:35 org.hibernate.jdbc.JDBCContext afterTransactionBegin
AM FEINSTEN: after transaction begin
29.04.2008 16:05:35
org.hibernate.event.def.DefaultSaveOrUpdateEventListener entityIsTransient
AM FEINSTEN: saving transient instance
29.04.2008 16:05:35 org.hibernate.event.def.AbstractSaveEventListener
performSave
AM FEINSTEN: saving [CDOResource#<null>]
29.04.2008 16:05:35 org.hibernate.event.def.AbstractSaveEventListener
performSaveOrReplicate
AM FEINSTEN: executing insertions
29.04.2008 16:05:35 org.hibernate.engine.Cascade cascade
AM FEINSTEN: processing cascade ACTION_SAVE_UPDATE for: CDOResource
29.04.2008 16:05:35 org.hibernate.engine.Cascade cascade
AM FEINSTEN: done processing cascade ACTION_SAVE_UPDATE for: CDOResource
29.04.2008 16:05:35 org.hibernate.engine.Versioning seedVersion
AM FEINSTEN: using initial version: 1
29.04.2008 16:05:35 org.hibernate.event.def.WrapVisitor
processArrayOrNewCollection
AM FEINSTEN: Wrapped collection in role: CDOResource.contents
Thread-4 [debug] Stored hb list in threadlocal: CDOResource.contents
29.04.2008 16:05:35 org.hibernate.event.def.AbstractSaveEventListener
performSaveOrReplicate
FEIN: executing identity-insert immediately
29.04.2008 16:05:35
org.hibernate.persister.entity.AbstractEntityPersister insert
AM FEINSTEN: Inserting entity: CDOResource (native id)
29.04.2008 16:05:35
org.hibernate.persister.entity.AbstractEntityPersister insert
AM FEINSTEN: Version: 1
29.04.2008 16:05:35 org.hibernate.jdbc.AbstractBatcher
logOpenPreparedStatement
FEIN: about to open PreparedStatement (open PreparedStatements: 0,
globally: 0)
29.04.2008 16:05:35 org.hibernate.jdbc.AbstractBatcher log
FEIN: insert into `cdo_resources` (e_version, path, `dtype`) values (?,
?, 'cdoresource')
29.04.2008 16:05:35 org.hibernate.jdbc.AbstractBatcher getPreparedStatement
AM FEINSTEN: preparing statement
Thread-4 [debug] Clearing used hibernate session
Thread-4 [debug] Clearing commitcontext in threadlocal
29.04.2008 16:05:35
org.hibernate.persister.entity.AbstractEntityPersister dehydrate
AM FEINSTEN: Dehydrating entity: [CDOResource#<null>]
29.04.2008 16:05:35 org.hibernate.type.NullableType nullSafeSet
AM FEINSTEN: binding '1' to parameter: 1
29.04.2008 16:05:35 org.hibernate.type.NullableType nullSafeSet
AM FEINSTEN: binding '/my/test/resource' to parameter: 2
29.04.2008 16:05:35 org.hibernate.jdbc.AbstractBatcher
logClosePreparedStatement
FEIN: about to close PreparedStatement (open PreparedStatements: 1,
globally: 1)
29.04.2008 16:05:35 org.hibernate.jdbc.AbstractBatcher
closePreparedStatement
AM FEINSTEN: closing statement
29.04.2008 16:05:35 org.hibernate.util.JDBCExceptionReporter logExceptions
FEIN: could not insert: [CDOResource] [insert into `cdo_resources`
(e_version, path, `dtype`) values (?, ?, 'cdoresource')]
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table
'requipse.cdo_resources' doesn't exist
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Nativ e Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknow n Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Un known
Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.Util.getInstance(Util.java:381)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:103 1)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957 )
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3376)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3308)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1837)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1961)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:25 43)
at
com.mysql.jdbc.PreparedStatement.executeInternal(PreparedSta tement.java:1737)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedState ment.java:2022)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedState ment.java:1940)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedState ment.java:1925)
at
org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate. executeAndExtract(IdentityGenerator.java:73)
at
org.hibernate.id.insert.AbstractReturningDelegate.performIns ert(AbstractReturningDelegate.java:33)
at
org.hibernate.persister.entity.AbstractEntityPersister.inser t(AbstractEntityPersister.java:2163)
at
org.hibernate.persister.entity.AbstractEntityPersister.inser t(AbstractEntityPersister.java:2643)
at
org.hibernate.action.EntityIdentityInsertAction.execute(Enti tyIdentityInsertAction.java:51)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:27 9)
at
org.hibernate.event.def.AbstractSaveEventListener.performSav eOrReplicate(AbstractSaveEventListener.java:298)
at
org.hibernate.event.def.AbstractSaveEventListener.performSav e(AbstractSaveEventListener.java:181)
at
org.hibernate.event.def.AbstractSaveEventListener.saveWithGe neratedId(AbstractSaveEventListener.java:107)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.sav eWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener .java:187)
at
org.hibernate.event.def.DefaultSaveEventListener.saveWithGen eratedOrRequestedId(DefaultSaveEventListener.java:33)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.ent ityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
at
org.hibernate.event.def.DefaultSaveEventListener.performSave OrUpdate(DefaultSaveEventListener.java:27)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onS aveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibern
|
|
|
Re: [CDO-Teneo-Hibernate] Experience report and errors: Migrating from classic M [message #617951 is a reply to message #120575] |
Tue, 29 April 2008 15:03 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
|
Hi Stefan,
Looks as if you entered dependency hell ;-(
Only recently I stumbled over weird behaviour of PDE or OSGi which was
related to the "jars.extra.classpath" in some build.properties file. I had
the feeling that, once configured, PDE caches the chosen jar location and
it's hard to get rid of that cached setting. The result was that it always
searched for classes in that location although I already removed the
property from the build.properties. I really can't explain it better but I
was able to get rid of the hazzle by turning all "jars.extra.classpath"
properties by "bin.includes" + "Bundle-Classpath" (in MANIFEST.MF). Maybe
this is of help for you.
Nick and I also have hard times to integrate the Hibernate stuff into the
automated builds and tests ;-(
Cheers
/Eike
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
| |
Re: [CDO-Teneo-Hibernate] Experience report and errors: Migrating from classic M [message #617956 is a reply to message #120628] |
Wed, 30 April 2008 07:54 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Stefan Winkler![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=stefan%40winklerweb.net) Messages: 307 Registered: July 2009 Location: Germany |
Senior Member |
|
|
Hi,
Martin, this one's for you ;-)
Stefan Winkler schrieb:
> Hi Eike,
>
> well as of now, I "only" have the problem that the CDOResource does
> not register itself, or Hibernate does not create a table for this,
> respectively.
> Do you have any idea why this could be?
> Does not intuitively seem to be a dependency issue.
Solved that issue by setting
props.put("hibernate.hbm2ddl.auto","update");
Now I get a
org.hibernate.id.IdentifierGenerationException: ids for this class must
be manually assigned before calling save(): MyNode
at org.hibernate.id.Assigned.generate(Assigned.java:33)
at
org.hibernate.event.def.AbstractSaveEventListener.saveWithGe neratedId(AbstractSaveEventListener.java:99)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.sav eWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener .java:187)
at
org.hibernate.event.def.DefaultSaveEventListener.saveWithGen eratedOrRequestedId(DefaultSaveEventListener.java:33)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.ent ityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
at
org.hibernate.event.def.DefaultSaveEventListener.performSave OrUpdate(DefaultSaveEventListener.java:27)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onS aveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:535 )
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:523)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Writer.commit(HibernateStoreWriter.java:67)
at
org.eclipse.emf.cdo.internal.server.Transaction.commit(Trans action.java:179)
at
org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication.indicating(CommitTransactionIndication.java:109 )
at
org.eclipse.net4j.signal.IndicationWithResponse.execute(Indi cationWithResponse.java:46)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:143)
at org.eclipse.net4j.signal.Signal.run(Signal.java:124)
This one should be solveable.
As you might have guessed, MyNode is an element from my own model.
How do I have to prepare my model in order to be able to work with
CDO-Teneo-Hibernate?
And more particularly, how do I assign the id for my model class?
This is my test model:
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="mycontainer"
nsURI="http://www.fernuni-hagen.de/ST/mycontainer.ecore"
nsPrefix="mycontainer">
<eClassifiers xsi:type="ecore:EClass" name="MyContainer">
<eStructuralFeatures xsi:type="ecore:EReference" name="contents"
upperBound="-1"
eType="#//MyNode"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="MyNode">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="text"
eType="#//EString"
defaultValueLiteral="" iD="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EDataType" name="EString"
instanceClassName="java.lang.String"/>
</ecore:EPackage>
Thanks all the time for your support!
Cheers,
Stefan
>
> Cheers
> Stefan
>
>
> Eike Stepper schrieb:
>> Hi Stefan,
>>
>> Looks as if you entered dependency hell ;-(
>> Only recently I stumbled over weird behaviour of PDE or OSGi which
>> was related to the "jars.extra.classpath" in some build.properties
>> file. I had the feeling that, once configured, PDE caches the chosen
>> jar location and it's hard to get rid of that cached setting. The
>> result was that it always searched for classes in that location
>> although I already removed the property from the build.properties. I
>> really can't explain it better but I was able to get rid of the
>> hazzle by turning all "jars.extra.classpath" properties by
>> "bin.includes" + "Bundle-Classpath" (in MANIFEST.MF). Maybe this is
>> of help for you.
>>
>> Nick and I also have hard times to integrate the Hibernate stuff into
>> the automated builds and tests ;-(
>>
>> Cheers
>> /Eike
>>
>>
>>
|
|
|
Re: [CDO-Teneo-Hibernate] Experience report and errors: Migrating from classic M [message #617966 is a reply to message #120666] |
Wed, 30 April 2008 17:54 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Martin Taal![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=mtaal%40springsite.com) Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Stefan,
As a default Teneo will use the eattribute with id=true as the primary key of the eclass. In your
case the eattribute text has id=true. Afaics in your case you tried to persist an instance with a
null-value in the text eattribute which is not allowed (as it is the pk). You can either set this
eattribute before saving, or disable this default teneo behavior. For this you can set the option
PersistenceOptions.ID_FEATURE_AS_PRIMARY_KEY to "false". If you do this then a synthetic primary key
will be used.
gr. Martin
Stefan Winkler wrote:
> Hi,
>
> Martin, this one's for you ;-)
>
> Stefan Winkler schrieb:
>> Hi Eike,
>>
>> well as of now, I "only" have the problem that the CDOResource does
>> not register itself, or Hibernate does not create a table for this,
>> respectively.
>> Do you have any idea why this could be?
>> Does not intuitively seem to be a dependency issue.
>
> Solved that issue by setting
>
> props.put("hibernate.hbm2ddl.auto","update");
>
>
> Now I get a
>
>
> org.hibernate.id.IdentifierGenerationException: ids for this class must
> be manually assigned before calling save(): MyNode
> at org.hibernate.id.Assigned.generate(Assigned.java:33)
> at
> org.hibernate.event.def.AbstractSaveEventListener.saveWithGe neratedId(AbstractSaveEventListener.java:99)
>
> at
> org.hibernate.event.def.DefaultSaveOrUpdateEventListener.sav eWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener .java:187)
>
> at
> org.hibernate.event.def.DefaultSaveEventListener.saveWithGen eratedOrRequestedId(DefaultSaveEventListener.java:33)
>
> at
> org.hibernate.event.def.DefaultSaveOrUpdateEventListener.ent ityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
>
> at
> org.hibernate.event.def.DefaultSaveEventListener.performSave OrUpdate(DefaultSaveEventListener.java:27)
>
> at
> org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onS aveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
>
> at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:535 )
> at org.hibernate.impl.SessionImpl.save(SessionImpl.java:523)
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore Writer.commit(HibernateStoreWriter.java:67)
>
> at
> org.eclipse.emf.cdo.internal.server.Transaction.commit(Trans action.java:179)
>
> at
> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication.indicating(CommitTransactionIndication.java:109 )
>
> at
> org.eclipse.net4j.signal.IndicationWithResponse.execute(Indi cationWithResponse.java:46)
>
> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:143)
> at org.eclipse.net4j.signal.Signal.run(Signal.java:124)
>
>
> This one should be solveable.
> As you might have guessed, MyNode is an element from my own model.
>
> How do I have to prepare my model in order to be able to work with
> CDO-Teneo-Hibernate?
> And more particularly, how do I assign the id for my model class?
>
> This is my test model:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ecore:EPackage xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="mycontainer"
> nsURI="http://www.fernuni-hagen.de/ST/mycontainer.ecore"
> nsPrefix="mycontainer">
> <eClassifiers xsi:type="ecore:EClass" name="MyContainer">
> <eStructuralFeatures xsi:type="ecore:EReference" name="contents"
> upperBound="-1"
> eType="#//MyNode"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="MyNode">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="text"
> eType="#//EString"
> defaultValueLiteral="" iD="true"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EDataType" name="EString"
> instanceClassName="java.lang.String"/>
> </ecore:EPackage>
>
> Thanks all the time for your support!
>
> Cheers,
> Stefan
>
>
>
>
>
>
>
>
>
>
>>
>> Cheers
>> Stefan
>>
>>
>> Eike Stepper schrieb:
>>> Hi Stefan,
>>>
>>> Looks as if you entered dependency hell ;-(
>>> Only recently I stumbled over weird behaviour of PDE or OSGi which
>>> was related to the "jars.extra.classpath" in some build.properties
>>> file. I had the feeling that, once configured, PDE caches the chosen
>>> jar location and it's hard to get rid of that cached setting. The
>>> result was that it always searched for classes in that location
>>> although I already removed the property from the build.properties. I
>>> really can't explain it better but I was able to get rid of the
>>> hazzle by turning all "jars.extra.classpath" properties by
>>> "bin.includes" + "Bundle-Classpath" (in MANIFEST.MF). Maybe this is
>>> of help for you.
>>>
>>> Nick and I also have hard times to integrate the Hibernate stuff into
>>> the automated builds and tests ;-(
>>>
>>> Cheers
>>> /Eike
>>>
>>>
>>>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Goto Forum:
Current Time: Fri Aug 16 22:29:56 GMT 2024
Powered by FUDForum. Page generated in 0.06196 seconds
|