Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forums[CDO] Standalone Java Client - Help!
https://www.eclipse.org/forums/index.php/mv/msg/1087806/1769191/#msg_1769191
I am working on a standalone Java client and make it work with CDO with an H2 data store. I looked up on all related posts for establishing a standalone client (outside Eclipse container) and have CDO as it's persistence layer.
I have created a new model (two classes with two attributes each and a composition between them). I am able to generate a CDO native code using the GenModel and persist them in an XMI file (for experimentation).
However, I end up getting stuck when I am trying to persist the model elements in an H2 Data store. At first, I tried the standalone client and server but I have been facing a lot of issues getting it forward (will be requesting your help in another post).
I then focussed on EmbeddedRepository as suggested in this post. I retained EmbeddedRepositoryConfig and CDO Facade and just changed the Embedded Repository Example to make use of my model instead of the company model.
Here's the error that's thrown in my console:
Exception in thread "main" org.eclipse.net4j.util.transaction.TransactionException: Rollback in DBStore: java.lang.UnsupportedOperationException
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.doSave(ResourceImpl.java:1462)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:1430)
at org.eclipse.emf.cdo.common.model.EMFUtil.getEPackageBytes(EMFUtil.java:497)
at org.eclipse.emf.cdo.server.internal.db.MetaDataManager.getEPackageBytes(MetaDataManager.java:225)
at org.eclipse.emf.cdo.server.internal.db.MetaDataManager.fillSystemTables(MetaDataManager.java:254)
at org.eclipse.emf.cdo.server.internal.db.MetaDataManager.fillSystemTables(MetaDataManager.java:297)
at org.eclipse.emf.cdo.server.internal.db.MetaDataManager.writePackageUnits(MetaDataManager.java:142)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writePackageUnits(DBStoreAccessor.java:895)
at org.eclipse.emf.cdo.spi.server.StoreAccessor.doWrite(StoreAccessor.java:81)
at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.doWrite(DBStoreAccessor.java:877)
at org.eclipse.emf.cdo.spi.server.StoreAccessorBase.write(StoreAccessorBase.java:150)
at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.writeAccessor(TransactionCommitContext.java:1544)
at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.write(TransactionCommitContext.java:679)
at org.eclipse.emf.cdo.internal.server.Repository.initRootResource(Repository.java:2068)
at org.eclipse.emf.cdo.internal.server.Repository.doActivate(Repository.java:2227)
at org.eclipse.net4j.util.lifecycle.Lifecycle.internalActivate(Lifecycle.java:76)
at org.eclipse.net4j.util.lifecycle.ShareableLifecycle.internalActivate(ShareableLifecycle.java:43)
at org.eclipse.net4j.util.lifecycle.Lifecycle.activate(Lifecycle.java:162)
at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:127)
at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:117)
at org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOServerUtil.java:300)
at ca.mcgill.university.server.Server.main(Server.java:44)
at org.eclipse.emf.cdo.internal.server.Repository.initRootResource(Repository.java:2074)
at org.eclipse.emf.cdo.internal.server.Repository.doActivate(Repository.java:2227)
at org.eclipse.net4j.util.lifecycle.Lifecycle.internalActivate(Lifecycle.java:76)
at org.eclipse.net4j.util.lifecycle.ShareableLifecycle.internalActivate(ShareableLifecycle.java:43)
at org.eclipse.net4j.util.lifecycle.Lifecycle.activate(Lifecycle.java:162)
at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:127)
at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:117)
at org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOServerUtil.java:300)
at ca.mcgill.university.server.Server.main(Server.java:44)
Here's what I found in the repo.trace.db:
07-27 00:04:52 jdbc[2]: exception
org.h2.jdbc.JdbcSQLException: Table "CDO_PROPERTIES" not found; SQL statement:
SELECT VALUE FROM CDO_PROPERTIES WHERE NAME='org.eclipse.emf.cdo.server.db.schemaVersion' [42102-168]
I humbly request you to help me out on this regard.
I would also like to know if I can make use of our standalone application (which is built on top of EMF but runs outside an Eclipse container) as a client to connect to CDO server and persist the models in any DB store (say Oracle / H2 Data Store)? From what I read, I am certain that this is possible. But, setting things upfront is where I get halted. I would be extremely glad if you can point me to the right place to look for the information.
Regards,
Nirmal
]]>Nirmal Kanagasabai2017-07-27T12:49:48-00:00Re: [CDO] Standalone Java Client - Help!
https://www.eclipse.org/forums/index.php/mv/msg/1087806/1769218/#msg_1769218
Please clarify what you mean by "Eclipse container" - Eclipse IDE or Equinox?
If it is the first, i.e. you don't want any GUI, but want to run you app from the command line, or as a service, then you should build an Eclipse GUI-less product. There is a number of tutorials here - http://www.vogella.com/tutorials/ - although they are mostly about GUI apps.
If, on the other hand, you don't want to use Equinox, then I'm not sure if it is possible at all - CDO is built on top of OSGi. I've been down this path for EMF long time ago and managing dependencies becomes a huge problem pretty soon with a big question - why to go to all this trouble if OSGi/Tycho can do it for you?
I hope it helps.
---
Best regards, Pavel.]]>Pavel Vlasov2017-07-27T23:42:07-00:00Re: [CDO] Standalone Java Client - Help!
https://www.eclipse.org/forums/index.php/mv/msg/1087806/1769228/#msg_1769228
]]>Eike Stepper2017-07-28T05:39:39-00:00Re: [CDO] Standalone Java Client - Help!
https://www.eclipse.org/forums/index.php/mv/msg/1087806/1769485/#msg_1769485
Thank you for your valuable inputs. I am sorry for not structuring my question properly. By Eclipse container, I referred to Eclipse IDE.
We already have an application built that can create reusable concerns. As of now, the model elements are just persisted in an XMI file. I am currently focussing on having CDO as the generic persistence layer and persist the models in an H2 Data Store.
I will get back to you in case of any further queries. Thanks again.
Regards,
Nirmal]]>Nirmal Kanagasabai2017-08-01T03:20:10-00:00Re: [CDO] Standalone Java Client - Help!
https://www.eclipse.org/forums/index.php/mv/msg/1087806/1769487/#msg_1769487
Thank you very much. That did address my concern. I can now create a new model and persist the elements in an H2 Data Store using an embedded repository.
I will retry the same model with the Server and StandaloneClient example which you have provided and try to replicate the same. I will get back to you in case of any further clarifications.