CDO – Connected Data Objects

CDO – Connected Data Objects

An introduction to CDO

This framework, which is a component of the EMF project, allows the sharing of an EMF model.
Whereas with Teneo we can make each client access a database (implementing a two-tier client/server solution), with CDO we make each client access a server which shares them the same model instance adobe reader 무료.
In this tutorial we will see how to:

  • install CDO
  • create a CDO server
  • create a CDO client

You can find a detailed documentation about CDO at the following link
While you can download the various versions here

Installing CDO

Let’s see now how to install CDO starting from version Eclipse 4.3 (Kepler) Modeling. CDO can use several Store implementations; here we will prepare to use the DBStore.

Furthermore, since we will use a MySQL database, we have to make sure that the correspondent JDBC plug-in is installed (please note that if you followed the tutorial Teneo Setup for Eclipse 4.2 ÔÇô Juno you can skip this step) skt lte.
(Note: for a straightforward following of this tutorial it is advisable to use a MySQL version not beyond the 5.5)

Update Site =>

  • MySQL Connector/J

Now let’s install Net4j DB Adapter for MySQL
Update Site =>

Let’s expland the more recent category and select the following:

> Net4j DB Framework
>> Net4j DB Framework MYSQL Adapter

Creating a CDO server

In this section we will see how to create a feature-based Eclipse product that will handle the launch of a CDO server defined by an XML configuration file.
In Eclipse a feature is a set of plug-ins which collaborate in order to provide a software functionality.
So let’s create a Feature Project with File -> New -> Project… -> Plug-in Development -> Feature Project

press Next and at the next step give a name to our project, for example it.rcpvision.rcptutorial.cdo.server

then Finish 쉘부르의 우산 다운로드.

What we just obtained is an empty feature; let’s go to tab Plug-ins and add the following plug-ins using button Add…

Note: if you donÔÇÖt want to add them one by one, here is the content of file feature.xml, which you can modify with tab “feature.xml

Now let’s create a product based on this feature; just right-click on this project and select New -> Other… -> Plug-in Development -> Product Configuration

press Next.
At the next step give a name to our product, for instance CDO-Server.product,

select “Use an existing product” radio-button and in the combo next to the selected radio-button set the value “org.eclipse.emf.cdo.server.product.tcp_h2“, then Finish rhino mac.
What we just obtained is a product, but it is now plug-ins based.

in order to have it feature-based we need to select the correspondent radio-button

now, to list the features that make part of that product, select tab Dependencies

press button Add…

and select the just created feature (it.rcpvision.rcptutorial.cdo.server)

and save the product (Ctrl-S).

Now it’s time to define the XML configuration file for CDO. Let’s select the project and create a folder named “rootfiles” (right click, New -> Folder)
and then add another subfolder named “configuration

inside this folder let’s create a file (right click, New -> File) named cdo-server.xml and copy the following content inside

This configuration file indicates that a CDO server will be active on TCP port 2036 and it will make available a CDO repository named “demo생일축하 다운로드. Just after we find the database coordinates. Please note that at first startup or after a model change, it is advisable to drop the database; it will be created automatically at startup. Before launching the server we need yet to pass the location of the configuration file . In order to do so just select the product, go to Launching tab and in the VM Arguments section provide the following parameter value

save the product, get back to Overview tab and launch, with
Launch An Eclipse Application

The console should end with a message like this

Verify that the database is successfully created video from the web.
(Note: if you get error messages please ensure that your firewall is not blocking ports 2036 and 3306)

Well, now at the network address of this computer, at the configured Net4j port (2036), the CDO repository named “demo” is available.

Just one note: in order to be prepared when we will need to deploy the product, it is advisable to make the product include also the configuration file (otherwise it would not be exported) wget 폴더 다운로드. To do this let’s open the file, go to Build tab and in the “Binary Build” section just select the folder “rootfiles“.

Creating a CDO client

Here we will use the same EMF model (the plug-in it.rcpvision.rcptutorial.model) used in previous tutorials (see ) Tingalba download. In case you are going to do that tutorial again, consider that now, when creating the EMF Generator Model (.genmodel), at step “Select a Model Importer” you should select “Ecore model (CDO Native)“.
Otherwise, if you have the previous model plugin available (which was created without the CDO compatibility option) you can convert it by right-clicking file .genmodel and clicking on CDO -> Migrate EMF Generator Model (dynamic feature delegation)

and obviously re-generating model sources

further, in plug-in it.rcpvision.rcptutorial.model, we need to add a dependence on CDO

In the end we are ready to really create our client praises. Create an RCP application the usual way (see How to create an RCP application) and add the following dependences:

  • it.rcpvision.rcptutorial.model
  • org.eclipse.emf.cdo.net4j
  • org.eclipse.net4j.tcp
  • org.junit

Let’s create now a class named “TestCdoClient” in the main package, with the following content

As you can see it is a JUnit test that connects to the “demo” CDO repository which is available at address “localhost” (should the client be executed on a different computer you should obviously change this address with the one from the CDO server). Then some model instance are created and persisted inside a CDO transaction.

Let’s launch it with right-click Run As -> JUnit Test

If all run successfully you should see an ok outcome on JUnit View

and you should see the inserterd data on the database 침대렐라 다운로드.

Please note that we created an RCP application and then created and used a simple (stand-alone) JUnit class to access CDO. This was made for the following reasons:

  • to obtain quickly a CDO client (we just needed to add some Dependencies)
  • to demonstrate how easily is accessing to a CDO server (no need of OSGi/Equinox at runtime)

Moreover, in the next tutorials we will often start with an RCP application that access to a CDO server repository.

For CDO development or consulting, send an email to

For CDO training, send an email to

Back to index

2014-12-22T17:02:55+00:00By |


  1. umashankarsubramani Thursday December 8th, 2011 at 06:09 PM - Reply

    When I run the server as “Eclipse Application” from the overview tab, I got the following error. Could you please help me?

    java.lang.NoClassDefFoundError: Workspace\it/rcpvision/rcptutorial/cdo/server\rootfiles\configuration
    Caused by: java.lang.ClassNotFoundException: Workspace\it.rcpvision.rcptutorial.cdo.server\rootfiles\configuration
    at$ Source)
    at Method)
    at Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    Exception in thread “main”

    • Vincenzo Wednesday December 14th, 2011 at 12:27 AM - Reply

      did you added exactly the plug-ins listed in the Feature?
      Are you using Eclipse 3.7.1 and the Update Site indicated above?

      • umashankarsubramani Friday January 13th, 2012 at 06:15 PM - Reply

        I solved that problem. The location I specified was wrong.

        • Silvio Lopez Thursday October 3rd, 2013 at 11:45 PM - Reply

          how do you configure the location of server?

  2. umashankarsubramani Friday January 13th, 2012 at 06:13 PM - Reply

    The server configuration given here, does not work. Rather, I used the one given here:

    Is it okay, to use this server configuration?

  3. Giancarlo Tuesday February 7th, 2012 at 11:51 AM - Reply

    Ciao Vincenzo,

    innanzitutto complimenti per le guide.

    Ho un problema che non riesco a risolvere. Ho fatto tutti gli step, dall’app RCP alla creazione del server CDO.
    Però non riesco a far dialogare il server con il mio datasource. Non ho usato MySql perchè ho SQLServer, che devo dire, con gli altri esercizi funziona.
    Come posso ovviare al problema ?
    Ovviamente ho inserito nelle features quella della connessione a sqlserver. (
    Ti posto il datasource:

    Dove sbaglio ? L’errore della console è :

    ENTRY org.eclipse.emf.cdo.server 1 0 2012-02-07 11:31:10.953
    !MESSAGE CDO server starting
    [ERROR] Unknown DB adapter: sqlserver
    java.lang.IllegalArgumentException: Unknown DB adapter: sqlserver
    at org.eclipse.emf.cdo.server.internal.db.DBStoreFactory.getDBAdapter(
    at org.eclipse.emf.cdo.server.internal.db.DBStoreFactory.createStore(
    at org.eclipse.emf.cdo.spi.server.RepositoryConfigurator.createStore(
    at org.eclipse.emf.cdo.spi.server.RepositoryConfigurator.getRepository(
    at org.eclipse.emf.cdo.spi.server.RepositoryConfigurator.configure(
    at org.eclipse.emf.cdo.internal.server.bundle.CDOServerApplication.doStart(
    at Source)

    Grazie ciao….

    • Vincenzo Monday February 20th, 2012 at 11:32 PM - Reply

      Ciao Giancarlo,
      quando si cambia tipo di database la feature del driver JDBC (es. non è sufficiente.
      Occorre anche la feature dell’Adapter per Net4J (l’errore infatti dice “Unknown DB adapter: sqlserver”).
      Come puoi vedere nella figura in alto (sotto la dicitura “Net4j DB Framework MYSQL Adapter”) non è presente un Adapter per MsSQL al momento. Quindi se scegli CDO hai due strade: o scegli un tipo di database diverso (tra Derby, H2, HSQLDB, MYSQL, PostgreSQL) oppure implementi un Adapter per il database specifico.
      Se scegli invece Teneo (=il client accede direttamente al database, a differenza di CDO dove il client accede ad un server CDO il quale poi accede al db) allora potrai usare MsSQL (Teneo usa Hibernate, quindi basta cambiare il dialect).

  4. Giancarlo Tuesday February 7th, 2012 at 11:55 AM - Reply

    Ecco il datasource

    ..acceptor type=”tcp” listenAddr=”″ port=”2036″…
    …repository name=”demo”… type=”db”…
    …mappingStrategy type=”horizontal”/…
    …dbAdapter name=”sqlserver”/…

  5. Mark Rowe Saturday September 15th, 2012 at 09:01 PM - Reply

    Vincenzo, thanks for a really great tutorial. I wish I had read this earlier, will now continue with your series 🙂

  6. Julia Thursday November 8th, 2012 at 12:53 PM - Reply

    I’m trying to run the Client, but I got following error message:
    Exception in thread “main” org.eclipse.net4j.util.container.FactoryNotFoundException: Factory not found: org.eclipse.net4j.connectors[tcp]
    caused by:
    IConnector connector = (IConnector)container.getElement(“org.eclipse.net4j.connectors”, “tcp”, “localhost:2036”);
    I ‘m using Eclipse Indigo 3.7.2 and CDO 4.0
    Can you help me?

  7. Stefano Friday January 25th, 2013 at 11:37 AM - Reply

    io non ho questa opzione “org.eclipse.emf.cdo.server.product.tcp_h2“ come mai?

    • Stefano Friday January 25th, 2013 at 12:32 PM - Reply

      Risolto, mi mancavano dei plugin

  8. Modeji Thursday January 31st, 2013 at 10:49 AM - Reply

    Hello, I am trying to connect eclipse rcp 4 to a backend database (MySQL) using hibernate. I tried to follow your tutorial to do just that, however, am getting this error:

    SEVERE: Could not find EPackage “”.
    org.xml.sax.SAXException: Could not find EPackage “”.
    at org.eclipse.emf.teneo.annotations.xml.XmlPersistenceContentHandler.startElement(
    at org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initialize(
    at org.eclipse.emf.teneo.hibernate.examples.samples.Tutorial.main(

    I then commented out the following line:
    hibernateProperties.setProperty(PersistenceOptions.PERSISTENCE_XML, “org/eclipse/emf/teneo/hibernate/examples/annotations.xml”);

    I am now getting this error:

    Exception in thread “main” org.hibernate.QueryException: could not resolve property: name of: Writer [SELECT book FROM Book book, Writer writ WHERE book.title=’1984′ AND AND’G. Orwell’]
    at org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(
    at org.hibernate.internal.SessionImpl.createQuery(
    at org.eclipse.emf.teneo.hibernate.examples.samples.Tutorial.main(

    Please could you let me know where is it that am going wrong.

    • Vincenzo Friday February 1st, 2013 at 05:30 PM - Reply

      Hi Modeji,
      in CDO there exists several implementation of ‘Stores’, e.g. DBStore, HibernateStore, DB4OStore, MEMStore, ObjectivityStore.
      In this tutorial we use DBStore, which does not uses Hibernate.
      I suppose you are using HibernateStore instead, do you?
      In this case I cannot help unless you provide all sources and xml files content.


      • Modeji Friday February 1st, 2013 at 09:43 PM - Reply

        Hi Vincezo, thank you for the response.

        That was very informative. I am very new to the CDO project. I was actually trying to do databinding to an Elipse RCP SWT widget with the sample ExtlibraryPackage project. I tried to do so by following the above tutorial and the “WindowBuilder: installing and EMF databinding” tutorial.

        The most important question that I have is that: can I actually use the CDO HibernateStore to perform CRUD in Eclipse RCP without going through or creating the whole .genmodel, .ecore and ecore_diagram stuff? If so is there any example code that I could follow?

        • Vincenzo Saturday February 2nd, 2013 at 01:04 AM - Reply

          Hi Modeji,
          HibernateStore is just another way to let CDO persist data on a RDBMS, so, unless you need it for particular purposes (e.g. want to use a database supported by Hibernate, but not yet supported by DBStore) you barely see differences in a simple application.
          CDO works with an EMF Model, so, yes, you have to go through .ecore (diagram is not necessary, it’s just a different way to handle .ecore) and then .genmodel

  9. Modeji Thursday January 31st, 2013 at 10:52 AM - Reply

    I am using eclipse 4.2 (Juno) and CDO 4.1

  10. Ivan Alejandro Wednesday May 8th, 2013 at 01:10 AM - Reply

    ciao Vincenzo

    the method named “add” doesnt exist on the class “Author”,
    what should i do ?


    Author author = LibraryFactory.eINSTANCE.createAuthor();
    book.getAuthor().add(author); //ERROR

  11. Vincenzo Wednesday May 8th, 2013 at 09:24 AM - Reply

    Ciao Alejandro,
    the article has a reference to the (prerequiste) following tutorial
    At the end of this tutorial the model is changed in order to allow multiple authors for a book.
    Probably you did not followed this last step.
    Alternatively (if you want to keep a single author for a book) you can do just:


    Let me know

  12. Ivan Alejandro Tuesday May 28th, 2013 at 12:58 AM - Reply

    ciao vincezo,

    When I run the server as “Eclipse Application” from the overview tab, I got the following error. Could you please help me?

    [INFO] CDO server starting
    !SESSION 2013-05-27 18:48:36.356 ———————————————–
    java.vendor=Sun Microsystems Inc.
    BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=es_CO
    Framework arguments: -product org.eclipse.emf.cdo.server.product.tcp_h2
    Command-line arguments: -product org.eclipse.emf.cdo.server.product.tcp_h2 -data F:\tesis\eclipse\workspace_rcpvision/../runtime-CDO-server.product -dev file:F:/tesis/eclipse/workspace_rcpvision/.metadata/.plugins/org.eclipse.pde.core/CDO-Server.product/ -os win32 -ws win32 -arch x86 -consoleLog

    !ENTRY org.eclipse.emf.cdo.server 1 0 2013-05-27 18:48:37.183
    !MESSAGE CDO server starting
    [ERROR] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘OPTION SQL_SELECT_LIMIT=DEFAULT’ at line 1
    com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘OPTION SQL_SELECT_LIMIT=DEFAULT’ at line 1
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
    at java.lang.reflect.Constructor.newInstance(
    at com.mysql.jdbc.Util.handleNewInstance(
    at com.mysql.jdbc.Util.getInstance(
    at com.mysql.jdbc.SQLError.createSQLException(
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(
    at com.mysql.jdbc.MysqlIO.sendCommand(
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(
    at com.mysql.jdbc.ConnectionImpl.execSQL(
    at com.mysql.jdbc.ConnectionImpl.unsetMaxRows(
    at com.mysql.jdbc.StatementImpl.realClose(
    at com.mysql.jdbc.StatementImpl.close(
    at org.eclipse.net4j.db.DBUtil.close(
    at org.eclipse.net4j.spi.db.DBAdapter.createTables(
    at org.eclipse.net4j.spi.db.DBSchema.create(
    at org.eclipse.emf.cdo.server.internal.db.DBStore.doActivate(
    at org.eclipse.net4j.util.lifecycle.Lifecycle.activate(
    at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(
    at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(
    at org.eclipse.emf.cdo.internal.server.Repository.doActivate(
    at org.eclipse.net4j.util.lifecycle.Lifecycle.activate(
    at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(
    at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(
    at org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(
    at org.eclipse.emf.cdo.spi.server.RepositoryConfigurator.configure(
    at org.eclipse.emf.cdo.internal.server.bundle.CDOServerApplication.doStart(

    [ERROR] Problem with table cdo_lobs: SELECT id, size, bdata, cdata FROM cdo_lobs
    org.eclipse.net4j.db.DBException: Problem with table cdo_lobs: SELECT id, size, bdata, cdata FROM cdo_lobs..

    :'( … another question -> do you speak spanish ?( Español )

    • Vincenzo Tuesday May 28th, 2013 at 10:06 PM - Reply

      Ciao Ivan,
      no, I don’t speak spanish, although, being italian probably I could easily understand most words 😉
      Anyway, I never saw the problem you are reporting.
      Could you please provide the exact versions of the following items?
      – Eclipse Juno SR1 or SR2?
      – Juno Modeling package or other?
      – versions of CDO R…, Net4j DB Framework, Net4j DB Framework MYSQL Adapter
      – version of MySQL
      Thank you

      • Ivan Alejandro Wednesday May 29th, 2013 at 11:38 PM - Reply

        vincenzo mira

        – Juno Service Release 2
        – Eclipse Modeling Framework Runtime and Tools Version: 2.8.3.
        – CDO Model Repository Client Version: 4.1.2
        – CDO Model Repository Server Version: 4.1.2
        – Net4j DB Framework Version: 4.1.2
        – Net4j DB Framework MYSQL Adapter Version: 4.1.0
        – MySQL Server 5.6

        Ojalá y pueda ayudarme, gracias!!

        • Darren Thursday May 30th, 2013 at 12:27 PM - Reply

          The problem is that in MySQL 56 they removed the SET OPTION syntax and replaced it with just SET, so
          SET SQL_SELECT_LIMIT=10;
          works, but:

          It seems that something in CDO/Net4j etc. is making statements that use the old and now defunct syntax, which means that CDO etc. is probably not compatible with MySQL 56 at present (unless there are later versions of the features used in this tutorial).


          • Ivan Alejandro Friday May 31st, 2013 at 12:05 AM

            Is it necessary to change my version of MySQL?

          • Vincenzo Friday May 31st, 2013 at 05:23 PM

            the problem is summarized here
            For now you can do two things: either install MySQL 5.5 or do the following trick.
            – open view “Plug-ins”, select “com.mysql.jdbc”, right-click “Import as” -> “Source project”
            – go back to “Package Explorer” view
            – remove file “mysql-connector… .jar” and copy here the one you can find in your MySQL 5.6 installation (if you downloaded the Installer version and followed the default wizard you’ll find it in \Program Files\MySQL\Connector J 5.1.24\mysql-connector-java-5.1.24-bin.jar)
            – rename the file into com.mysql.jdbc_5.1.11.201210222237.jar
            – go to MANIFEST.MF, tab Runtime and add the correct jar in the Classpath section and Export all its packages in the Exported Packages section
            then it works!

  13. Simone Wednesday July 24th, 2013 at 03:08 PM - Reply

    ho dovuto modificare il tuo metodo openSession con il seguente codice:

    public static CDOSession openSession() {
    CDONet4jSessionConfiguration sc = CDONet4jUtil.createNet4jSessionConfiguration();
    IManagedContainer container = IPluginContainer.INSTANCE;
    Net4jUtil.prepareContainer(container); // Register Net4j factories
    TCPUtil.prepareContainer(container); // Register TCP factories
    CDONet4jUtil.prepareContainer(container); // Register CDO factories
    sc.setConnector(Net4jUtil.getConnector(container, “tcp://” + CONNECTION_ADDRESS));
    CDONet4jSession session = sc.openNet4jSession();
    return session;

    In questo modo sono riuscito a farlo funzionare. Magari può essere di aiuto a qualcun altro 🙂
    Complimenti per l’ottimo tutorial che hai scritto 🙂 Mi hai fatto risparmiare tantissimo tempo.

  14. Silvio Lopez Monday September 9th, 2013 at 10:22 PM - Reply

    I need help, I do “data binding” but not on the tutotial of cdo but on the local database, then I call the resource from the class “ViewPart”, but I run praises “data binding”, Am I doing wrong? :
    UriStr String = “hibernate :/ /?” + HibernateResource.DS_NAME_PARAM + “= mydb”;
    URI uri = URI.createURI end (uriStr);
    ResourceSetImpl resourceSet = new ();
    Resource resource = (Resource) resourceSet.getResources ();

    try {
    resource.load (null);
    library = (Library) resource.getContents (). get (0);
    resource.getContents (). add (LibraryFactory.eINSTANCE.createLibrary ()); (null);

    } Catch (Exception e) {
    / / TODO Auto-generated catch block
    e.printStackTrace ();

  15. Vincenzo Tuesday September 10th, 2013 at 10:37 PM - Reply

    Hi Silvio,
    can you describe better your use case?
    Looking at the code above seems that you are first loading the first (0) library object in the resource, then adding a new (second) library to the same resource and in the end saving. So at each execution you are adding a new library, but just the first is always assigned to library variable, while the others are discarded.
    Apart from this, what is the problem with data binding?

Leave A Comment