Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] RootResourceID is null; is the repository not yet initialized?
[CDO] RootResourceID is null; is the repository not yet initialized? [message #1253353] Sat, 22 February 2014 06:30 Go to next message
KW is currently offline KWFriend
Messages: 12
Registered: July 2009
Junior Member
Hi all,

at the moment I am having trouble to proceed with a cdo application that
uses the CDO Initialization which worked with CDO 4.1 (see the code at
the end). When I run this with a kepler / cod 4.2 target platform, I get
the following exception:

Caused by: java.lang.IllegalStateException: RootResourceID is null; is
the repository not yet initialized?
at
org.eclipse.emf.internal.cdo.view.AbstractCDOView.getRootResource(AbstractCDOView.java:316)
at
org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.attachNewResourceNode(CDOTransactionImpl.java:1022)
at
org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.attachNewResource(CDOTransactionImpl.java:952)
at
org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.attachResource(CDOTransactionImpl.java:941)
at
org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl.basicSetResourceSet(CDOResourceImpl.java:1554)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$ResourcesEList.inverseAdd(ResourceSetImpl.java:586)
at
org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:286)
at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:303)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.createResource(ResourceSetImpl.java:435)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.createResource(ResourceSetImpl.java:423)
at
org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.createResource(CDOTransactionImpl.java:852)
at
org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.getOrCreateResource(CDOTransactionImpl.java:872)

Do I have to provide an additional repository id or is something wrong
with the setup of cdo plugins / server and the code below should also
work with cdo 4.2?

Thanks!
Kris

public class CDOServerInitializerJVM implements CDOServerInitializer {



private final String repositoryName;
private final String resourceName;

private IManagedContainer container;

private IRepository repository;

private IJVMConnector connector;

private IJVMAcceptor acceptor;

private CDONet4jSessionConfiguration sessionConfiguration;

private CDOBlob myBlob;

private final DBConnectionParams dbConnectionParams;

public CDOServerInitializerJVM(final String repositoryName, final
String resourceName,
final DBConnectionParams dbConnectionParams) {
this.repositoryName = repositoryName;
this.resourceName = resourceName;
this.dbConnectionParams = dbConnectionParams;

}

/**
* Initializes the connection and creates a {@link
CDOSessionConfiguration} which is stored in a member of this
* class.
*/
@Override
public void initialize() {
OMPlatform.INSTANCE.setDebugging(true);
OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);

this.container = createContainer();
initializeAcceptor(container);

final IStore store = createStore();
this.repository = createRepository(repositoryName, store);


addRepository(container, repository);

final IConnector connector = createConnector(container);
this.sessionConfiguration = createSessionConfiguration(connector);

}

@Override
public String getResourceName() {
return this.resourceName;
}

@Override
public void deactivate() {
if (acceptor != null) {
LifecycleUtil.deactivate(acceptor);
}

if (connector != null) {
LifecycleUtil.deactivate(connector);
}

if (repository != null) {
LifecycleUtil.deactivate(repository);
}
}

/**
* {@inheritDoc}
*/
@Override
public CDOSession openSession() {
final CDONet4jSession session =
this.sessionConfiguration.openNet4jSession();
return session;
}

private IManagedContainer createContainer() {
// Prepare container
// final IManagedContainer container =
ContainerUtil.createContainer();
final IManagedContainer container = IPluginContainer.INSTANCE;
Net4jUtil.prepareContainer(container); // Register Net4j factories
JVMUtil.prepareContainer(container);
CDONet4jUtil.prepareContainer(container); // Register CDO factories
container.activate();

return container;
}

private IRepository createRepository(final String repositoryName,
final IStore store) {
final Map<String, String> props = new HashMap<String, String>();
props.put("supportingAudits", "false");
return CDOServerUtil.createRepository(repositoryName, store,
props);
}

private IStore createStore() {

final Properties teneoProps = new Properties();

teneoProps.put("teneo.mapping.cascade_policy_on_non_containment",
"PERSIST,MERGE");
teneoProps.put("teneo.mapping.inheritance", "JOINED");
teneoProps.put("teneo.mapping.add_index_for_fk", "true");
teneoProps.put("teneo.naming.default_id_column", "id");
final TeneoHibernateMappingProvider mappingProvider = new
TeneoHibernateMappingProvider();
mappingProvider.setMappingProviderProperties(teneoProps);

final Properties props = new Properties();
props.put("hibernate.hbm2ddl.auto", "update");
props.put("hibernate.show_sql", "true");
props.put("hibernate.connection.pool_size", "10");
props.put("hibernate.cache.provider_class",
"org.hibernate.cache.HashtableCacheProvider");
props.put("hibernate.dialect",
"org.hibernate.dialect.HSQLDialect");
props.put("hibernate.connection.driver_class",
"org.hsqldb.jdbcDriver");
props.put("hibernate.connection.url", "jdbc:hsqldb:file:" +
dbConnectionParams.getConnectionString());
props.put("hibernate.connection.username",
dbConnectionParams.getUsername());
props.put("hibernate.connection.password",
dbConnectionParams.getPassword());

final HibernateStore store = new
HibernateStore(mappingProvider, props);

return store;
}

private IConnector createConnector(final IManagedContainer container) {
this.connector = JVMUtil.getConnector(container, "default");
return connector;
}

private void addRepository(final IManagedContainer container, final
IRepository repository) {
CDOServerUtil.addRepository(container, repository);
}

private void initializeAcceptor(final IManagedContainer container) {
// initialize acceptor
this.acceptor = JVMUtil.getAcceptor(container, "default");
}

private CDONet4jSessionConfiguration
createSessionConfiguration(final IConnector connector) {

sessionConfiguration =
CDONet4jUtil.createNet4jSessionConfiguration();
sessionConfiguration.setConnector(connector);
sessionConfiguration.setRepositoryName(repositoryName);


return sessionConfiguration;
}


}
Re: [CDO] RootResourceID is null; is the repository not yet initialized? [message #1259772 is a reply to message #1253353] Fri, 28 February 2014 19:44 Go to previous messageGo to next message
KW is currently offline KWFriend
Messages: 12
Registered: July 2009
Junior Member
Hi all,

I still did not find out whats the reason for the error message when
trying to get or create a resource. May the always on legacy-mode in 4.2
be the reason or am I doing something wrong when initializing the
connection?

I am thankful for any hint to overcome this stopper.

Thanks!
Kris


Am 22.02.14 07:30, schrieb KW:
> Hi all,
>
> at the moment I am having trouble to proceed with a cdo application that
> uses the CDO Initialization which worked with CDO 4.1 (see the code at
> the end). When I run this with a kepler / cod 4.2 target platform, I get
> the following exception:
>
> Caused by: java.lang.IllegalStateException: RootResourceID is null; is
> the repository not yet initialized?
> at
> org.eclipse.emf.internal.cdo.view.AbstractCDOView.getRootResource(AbstractCDOView.java:316)
>
> at
> org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.attachNewResourceNode(CDOTransactionImpl.java:1022)
>
> at
> org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.attachNewResource(CDOTransactionImpl.java:952)
>
> at
> org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.attachResource(CDOTransactionImpl.java:941)
>
> at
> org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl.basicSetResourceSet(CDOResourceImpl.java:1554)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$ResourcesEList.inverseAdd(ResourceSetImpl.java:586)
>
> at
> org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:286)
>
> at
> org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:303)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.createResource(ResourceSetImpl.java:435)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.createResource(ResourceSetImpl.java:423)
>
> at
> org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.createResource(CDOTransactionImpl.java:852)
>
> at
> org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.getOrCreateResource(CDOTransactionImpl.java:872)
>
>
> Do I have to provide an additional repository id or is something wrong
> with the setup of cdo plugins / server and the code below should also
> work with cdo 4.2?
>
> Thanks!
> Kris
>
> public class CDOServerInitializerJVM implements CDOServerInitializer {
>
>
>
> private final String repositoryName;
> private final String resourceName;
>
> private IManagedContainer container;
>
> private IRepository repository;
>
> private IJVMConnector connector;
>
> private IJVMAcceptor acceptor;
>
> private CDONet4jSessionConfiguration sessionConfiguration;
>
> private CDOBlob myBlob;
>
> private final DBConnectionParams dbConnectionParams;
>
> public CDOServerInitializerJVM(final String repositoryName, final
> String resourceName,
> final DBConnectionParams dbConnectionParams) {
> this.repositoryName = repositoryName;
> this.resourceName = resourceName;
> this.dbConnectionParams = dbConnectionParams;
>
> }
>
> /**
> * Initializes the connection and creates a {@link
> CDOSessionConfiguration} which is stored in a member of this
> * class.
> */
> @Override
> public void initialize() {
> OMPlatform.INSTANCE.setDebugging(true);
> OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
> OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);
>
> this.container = createContainer();
> initializeAcceptor(container);
>
> final IStore store = createStore();
> this.repository = createRepository(repositoryName, store);
>
>
> addRepository(container, repository);
>
> final IConnector connector = createConnector(container);
> this.sessionConfiguration = createSessionConfiguration(connector);
>
> }
>
> @Override
> public String getResourceName() {
> return this.resourceName;
> }
>
> @Override
> public void deactivate() {
> if (acceptor != null) {
> LifecycleUtil.deactivate(acceptor);
> }
>
> if (connector != null) {
> LifecycleUtil.deactivate(connector);
> }
>
> if (repository != null) {
> LifecycleUtil.deactivate(repository);
> }
> }
>
> /**
> * {@inheritDoc}
> */
> @Override
> public CDOSession openSession() {
> final CDONet4jSession session =
> this.sessionConfiguration.openNet4jSession();
> return session;
> }
>
> private IManagedContainer createContainer() {
> // Prepare container
> // final IManagedContainer container =
> ContainerUtil.createContainer();
> final IManagedContainer container = IPluginContainer.INSTANCE;
> Net4jUtil.prepareContainer(container); // Register Net4j factories
> JVMUtil.prepareContainer(container);
> CDONet4jUtil.prepareContainer(container); // Register CDO
> factories
> container.activate();
>
> return container;
> }
>
> private IRepository createRepository(final String repositoryName,
> final IStore store) {
> final Map<String, String> props = new HashMap<String, String>();
> props.put("supportingAudits", "false");
> return CDOServerUtil.createRepository(repositoryName, store,
> props);
> }
>
> private IStore createStore() {
>
> final Properties teneoProps = new Properties();
>
> teneoProps.put("teneo.mapping.cascade_policy_on_non_containment",
> "PERSIST,MERGE");
> teneoProps.put("teneo.mapping.inheritance", "JOINED");
> teneoProps.put("teneo.mapping.add_index_for_fk", "true");
> teneoProps.put("teneo.naming.default_id_column", "id");
> final TeneoHibernateMappingProvider mappingProvider = new
> TeneoHibernateMappingProvider();
> mappingProvider.setMappingProviderProperties(teneoProps);
>
> final Properties props = new Properties();
> props.put("hibernate.hbm2ddl.auto", "update");
> props.put("hibernate.show_sql", "true");
> props.put("hibernate.connection.pool_size", "10");
> props.put("hibernate.cache.provider_class",
> "org.hibernate.cache.HashtableCacheProvider");
> props.put("hibernate.dialect",
> "org.hibernate.dialect.HSQLDialect");
> props.put("hibernate.connection.driver_class",
> "org.hsqldb.jdbcDriver");
> props.put("hibernate.connection.url", "jdbc:hsqldb:file:" +
> dbConnectionParams.getConnectionString());
> props.put("hibernate.connection.username",
> dbConnectionParams.getUsername());
> props.put("hibernate.connection.password",
> dbConnectionParams.getPassword());
>
> final HibernateStore store = new
> HibernateStore(mappingProvider, props);
>
> return store;
> }
>
> private IConnector createConnector(final IManagedContainer
> container) {
> this.connector = JVMUtil.getConnector(container, "default");
> return connector;
> }
>
> private void addRepository(final IManagedContainer container, final
> IRepository repository) {
> CDOServerUtil.addRepository(container, repository);
> }
>
> private void initializeAcceptor(final IManagedContainer container) {
> // initialize acceptor
> this.acceptor = JVMUtil.getAcceptor(container, "default");
> }
>
> private CDONet4jSessionConfiguration
> createSessionConfiguration(final IConnector connector) {
>
> sessionConfiguration =
> CDONet4jUtil.createNet4jSessionConfiguration();
> sessionConfiguration.setConnector(connector);
> sessionConfiguration.setRepositoryName(repositoryName);
>
>
> return sessionConfiguration;
> }
>
>
> }
Re: [CDO] RootResourceID is null; is the repository not yet initialized? [message #1281059 is a reply to message #1253353] Mon, 31 March 2014 09:52 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Hi Kristian,

Sorry for the long delay. Comments below...

Am 22.02.2014 07:30, schrieb KW:
> Hi all,
>
> at the moment I am having trouble to proceed with a cdo application that uses the CDO Initialization which worked with
> CDO 4.1 (see the code at the end). When I run this with a kepler / cod 4.2 target platform, I get the following
> exception:
>
> Caused by: java.lang.IllegalStateException: RootResourceID is null; is the repository not yet initialized?
This is really an exception that indicates either
a) an implementation bug (in CDO, Teneo, or the integration layer between them, i.e., HibernateStore)
b) or a problem with the actual data (e.g., mismatch between actual schema/data and running code)

To exclude a) can you run with CDO's DBStore (which implies that you start a fresh db)?
To exclude b) can you run with your normal code (i.e. HibernateStore) but with a fresh db?

> at org.eclipse.emf.internal.cdo.view.AbstractCDOView.getRootResource(AbstractCDOView.java:316)
> at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.attachNewResourceNode(CDOTransactionImpl.java:1022)
> at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.attachNewResource(CDOTransactionImpl.java:952)
> at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.attachResource(CDOTransactionImpl.java:941)
> at org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl.basicSetResourceSet(CDOResourceImpl.java:1554)
> at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$ResourcesEList.inverseAdd(ResourceSetImpl.java:586)
> at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:286)
> at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:303)
> at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.createResource(ResourceSetImpl.java:435)
> at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.createResource(ResourceSetImpl.java:423)
> at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.createResource(CDOTransactionImpl.java:852)
> at org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.getOrCreateResource(CDOTransactionImpl.java:872)
>
> Do I have to provide an additional repository id or is something wrong with the setup of cdo plugins / server and the
> code below should also work with cdo 4.2?
I don't think so.

>
> Thanks!
> Kris
>
> public class CDOServerInitializerJVM implements CDOServerInitializer {
I didn't run it but your CDOServerInitializerJVM looks okay to me.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


>
>
>
> private final String repositoryName;
> private final String resourceName;
>
> private IManagedContainer container;
>
> private IRepository repository;
>
> private IJVMConnector connector;
>
> private IJVMAcceptor acceptor;
>
> private CDONet4jSessionConfiguration sessionConfiguration;
>
> private CDOBlob myBlob;
>
> private final DBConnectionParams dbConnectionParams;
>
> public CDOServerInitializerJVM(final String repositoryName, final String resourceName,
> final DBConnectionParams dbConnectionParams) {
> this.repositoryName = repositoryName;
> this.resourceName = resourceName;
> this.dbConnectionParams = dbConnectionParams;
>
> }
>
> /**
> * Initializes the connection and creates a {@link CDOSessionConfiguration} which is stored in a member of this
> * class.
> */
> @Override
> public void initialize() {
> OMPlatform.INSTANCE.setDebugging(true);
> OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
> OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);
>
> this.container = createContainer();
> initializeAcceptor(container);
>
> final IStore store = createStore();
> this.repository = createRepository(repositoryName, store);
>
>
> addRepository(container, repository);
>
> final IConnector connector = createConnector(container);
> this.sessionConfiguration = createSessionConfiguration(connector);
>
> }
>
> @Override
> public String getResourceName() {
> return this.resourceName;
> }
>
> @Override
> public void deactivate() {
> if (acceptor != null) {
> LifecycleUtil.deactivate(acceptor);
> }
>
> if (connector != null) {
> LifecycleUtil.deactivate(connector);
> }
>
> if (repository != null) {
> LifecycleUtil.deactivate(repository);
> }
> }
>
> /**
> * {@inheritDoc}
> */
> @Override
> public CDOSession openSession() {
> final CDONet4jSession session = this.sessionConfiguration.openNet4jSession();
> return session;
> }
>
> private IManagedContainer createContainer() {
> // Prepare container
> // final IManagedContainer container = ContainerUtil.createContainer();
> final IManagedContainer container = IPluginContainer.INSTANCE;
> Net4jUtil.prepareContainer(container); // Register Net4j factories
> JVMUtil.prepareContainer(container);
> CDONet4jUtil.prepareContainer(container); // Register CDO factories
> container.activate();
>
> return container;
> }
>
> private IRepository createRepository(final String repositoryName, final IStore store) {
> final Map<String, String> props = new HashMap<String, String>();
> props.put("supportingAudits", "false");
> return CDOServerUtil.createRepository(repositoryName, store, props);
> }
>
> private IStore createStore() {
>
> final Properties teneoProps = new Properties();
>
> teneoProps.put("teneo.mapping.cascade_policy_on_non_containment", "PERSIST,MERGE");
> teneoProps.put("teneo.mapping.inheritance", "JOINED");
> teneoProps.put("teneo.mapping.add_index_for_fk", "true");
> teneoProps.put("teneo.naming.default_id_column", "id");
> final TeneoHibernateMappingProvider mappingProvider = new TeneoHibernateMappingProvider();
> mappingProvider.setMappingProviderProperties(teneoProps);
>
> final Properties props = new Properties();
> props.put("hibernate.hbm2ddl.auto", "update");
> props.put("hibernate.show_sql", "true");
> props.put("hibernate.connection.pool_size", "10");
> props.put("hibernate.cache.provider_class", "org.hibernate.cache.HashtableCacheProvider");
> props.put("hibernate.dialect", "org.hibernate.dialect.HSQLDialect");
> props.put("hibernate.connection.driver_class", "org.hsqldb.jdbcDriver");
> props.put("hibernate.connection.url", "jdbc:hsqldb:file:" + dbConnectionParams.getConnectionString());
> props.put("hibernate.connection.username", dbConnectionParams.getUsername());
> props.put("hibernate.connection.password", dbConnectionParams.getPassword());
>
> final HibernateStore store = new HibernateStore(mappingProvider, props);
>
> return store;
> }
>
> private IConnector createConnector(final IManagedContainer container) {
> this.connector = JVMUtil.getConnector(container, "default");
> return connector;
> }
>
> private void addRepository(final IManagedContainer container, final IRepository repository) {
> CDOServerUtil.addRepository(container, repository);
> }
>
> private void initializeAcceptor(final IManagedContainer container) {
> // initialize acceptor
> this.acceptor = JVMUtil.getAcceptor(container, "default");
> }
>
> private CDONet4jSessionConfiguration createSessionConfiguration(final IConnector connector) {
>
> sessionConfiguration = CDONet4jUtil.createNet4jSessionConfiguration();
> sessionConfiguration.setConnector(connector);
> sessionConfiguration.setRepositoryName(repositoryName);
>
>
> return sessionConfiguration;
> }
>
>
> }


Re: [CDO] RootResourceID is null; is the repository not yet initialized? [message #1290389 is a reply to message #1281059] Thu, 10 April 2014 04:56 Go to previous message
KW is currently offline KWFriend
Messages: 12
Registered: July 2009
Junior Member
Hello Eike,

apparently it is my fate that I find my own faults not until I get a
response from you in this newsgroup :) sorry for that…

I tried with a clean DB, but the error was still there. After your
feedback that the CDOServerInitializerJVM is correct, I was clueless
and decided to try with a CDOServerInitializerTCP and standalone CDO
Server. I don’t have worked with the CDODBStore yet (only with
HibernateStore) and was afraid of several reconfigurations leading to
other problems not related to the initial one, thats why I tried tried
the TCP-way first.

This resulted in a few developer-made-errors. One was due to a wrong use
of teneo jpa annotation (error: HbAnnotatedEClass does not have an
efeature for Id"). Another was an apparently missing
org.eclipse.emf.cdo.server.netj4 in one of my plugins. However it was
there actually - by touching (reorganized the list of required plugins a
little in the manifest), this error was gone also. Afterwards I had a
working solution with a standalone cdo server and a tcp connection.
Afterwards, I switched back to the all-in-one CDOServerInitializerJVM
variant and the initial problem was gone, too!

To investigate to original problem with the JVM-based ServerInitializer,
I tried to reproduce it by reverting my changes. Unfortunately (just in
this case :-) I don't get the „java.lang.IllegalStateException:
RootResourceID is null; is the repository not yet initialized?“ back no
more. I am afraid that I cannot contribute information on what really
caused this problem, it is not reproducable anymore :-(

Many thanks for you reply in this thread - your info that the
CDOServerInitializerJVM seems correct made me think in different
directions for error analysis...

Regards
Kris

Am 31.03.14 11:52, schrieb Eike Stepper:
> Hi Kristian,
>
> Sorry for the long delay. Comments below...
>
> Am 22.02.2014 07:30, schrieb KW:
>> Hi all,
>>
>> at the moment I am having trouble to proceed with a cdo application
>> that uses the CDO Initialization which worked with CDO 4.1 (see the
>> code at the end). When I run this with a kepler / cod 4.2 target
>> platform, I get the following exception:
>>
>> Caused by: java.lang.IllegalStateException: RootResourceID is null; is
>> the repository not yet initialized?
> This is really an exception that indicates either
> a) an implementation bug (in CDO, Teneo, or the integration layer
> between them, i.e., HibernateStore)
> b) or a problem with the actual data (e.g., mismatch between actual
> schema/data and running code)
>
> To exclude a) can you run with CDO's DBStore (which implies that you
> start a fresh db)?
> To exclude b) can you run with your normal code (i.e. HibernateStore)
> but with a fresh db?
>
>> at
>> org.eclipse.emf.internal.cdo.view.AbstractCDOView.getRootResource(AbstractCDOView.java:316)
>>
>> at
>> org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.attachNewResourceNode(CDOTransactionImpl.java:1022)
>>
>> at
>> org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.attachNewResource(CDOTransactionImpl.java:952)
>>
>> at
>> org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.attachResource(CDOTransactionImpl.java:941)
>>
>> at
>> org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl.basicSetResourceSet(CDOResourceImpl.java:1554)
>>
>> at
>> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$ResourcesEList.inverseAdd(ResourceSetImpl.java:586)
>>
>> at
>> org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:286)
>>
>> at
>> org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:303)
>> at
>> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.createResource(ResourceSetImpl.java:435)
>>
>> at
>> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.createResource(ResourceSetImpl.java:423)
>>
>> at
>> org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.createResource(CDOTransactionImpl.java:852)
>>
>> at
>> org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl.getOrCreateResource(CDOTransactionImpl.java:872)
>>
>>
>> Do I have to provide an additional repository id or is something wrong
>> with the setup of cdo plugins / server and the code below should also
>> work with cdo 4.2?
> I don't think so.
>
>>
>> Thanks!
>> Kris
>>
>> public class CDOServerInitializerJVM implements CDOServerInitializer {
> I didn't run it but your CDOServerInitializerJVM looks okay to me.
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>>
>>
>>
>> private final String repositoryName;
>> private final String resourceName;
>>
>> private IManagedContainer container;
>>
>> private IRepository repository;
>>
>> private IJVMConnector connector;
>>
>> private IJVMAcceptor acceptor;
>>
>> private CDONet4jSessionConfiguration sessionConfiguration;
>>
>> private CDOBlob myBlob;
>>
>> private final DBConnectionParams dbConnectionParams;
>>
>> public CDOServerInitializerJVM(final String repositoryName, final
>> String resourceName,
>> final DBConnectionParams dbConnectionParams) {
>> this.repositoryName = repositoryName;
>> this.resourceName = resourceName;
>> this.dbConnectionParams = dbConnectionParams;
>>
>> }
>>
>> /**
>> * Initializes the connection and creates a {@link
>> CDOSessionConfiguration} which is stored in a member of this
>> * class.
>> */
>> @Override
>> public void initialize() {
>> OMPlatform.INSTANCE.setDebugging(true);
>> OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
>> OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);
>>
>> this.container = createContainer();
>> initializeAcceptor(container);
>>
>> final IStore store = createStore();
>> this.repository = createRepository(repositoryName, store);
>>
>>
>> addRepository(container, repository);
>>
>> final IConnector connector = createConnector(container);
>> this.sessionConfiguration =
>> createSessionConfiguration(connector);
>>
>> }
>>
>> @Override
>> public String getResourceName() {
>> return this.resourceName;
>> }
>>
>> @Override
>> public void deactivate() {
>> if (acceptor != null) {
>> LifecycleUtil.deactivate(acceptor);
>> }
>>
>> if (connector != null) {
>> LifecycleUtil.deactivate(connector);
>> }
>>
>> if (repository != null) {
>> LifecycleUtil.deactivate(repository);
>> }
>> }
>>
>> /**
>> * {@inheritDoc}
>> */
>> @Override
>> public CDOSession openSession() {
>> final CDONet4jSession session =
>> this.sessionConfiguration.openNet4jSession();
>> return session;
>> }
>>
>> private IManagedContainer createContainer() {
>> // Prepare container
>> // final IManagedContainer container =
>> ContainerUtil.createContainer();
>> final IManagedContainer container = IPluginContainer.INSTANCE;
>> Net4jUtil.prepareContainer(container); // Register Net4j
>> factories
>> JVMUtil.prepareContainer(container);
>> CDONet4jUtil.prepareContainer(container); // Register CDO
>> factories
>> container.activate();
>>
>> return container;
>> }
>>
>> private IRepository createRepository(final String repositoryName,
>> final IStore store) {
>> final Map<String, String> props = new HashMap<String, String>();
>> props.put("supportingAudits", "false");
>> return CDOServerUtil.createRepository(repositoryName, store,
>> props);
>> }
>>
>> private IStore createStore() {
>>
>> final Properties teneoProps = new Properties();
>>
>> teneoProps.put("teneo.mapping.cascade_policy_on_non_containment",
>> "PERSIST,MERGE");
>> teneoProps.put("teneo.mapping.inheritance", "JOINED");
>> teneoProps.put("teneo.mapping.add_index_for_fk", "true");
>> teneoProps.put("teneo.naming.default_id_column", "id");
>> final TeneoHibernateMappingProvider mappingProvider = new
>> TeneoHibernateMappingProvider();
>> mappingProvider.setMappingProviderProperties(teneoProps);
>>
>> final Properties props = new Properties();
>> props.put("hibernate.hbm2ddl.auto", "update");
>> props.put("hibernate.show_sql", "true");
>> props.put("hibernate.connection.pool_size", "10");
>> props.put("hibernate.cache.provider_class",
>> "org.hibernate.cache.HashtableCacheProvider");
>> props.put("hibernate.dialect",
>> "org.hibernate.dialect.HSQLDialect");
>> props.put("hibernate.connection.driver_class",
>> "org.hsqldb.jdbcDriver");
>> props.put("hibernate.connection.url", "jdbc:hsqldb:file:" +
>> dbConnectionParams.getConnectionString());
>> props.put("hibernate.connection.username",
>> dbConnectionParams.getUsername());
>> props.put("hibernate.connection.password",
>> dbConnectionParams.getPassword());
>>
>> final HibernateStore store = new
>> HibernateStore(mappingProvider, props);
>>
>> return store;
>> }
>>
>> private IConnector createConnector(final IManagedContainer
>> container) {
>> this.connector = JVMUtil.getConnector(container, "default");
>> return connector;
>> }
>>
>> private void addRepository(final IManagedContainer container,
>> final IRepository repository) {
>> CDOServerUtil.addRepository(container, repository);
>> }
>>
>> private void initializeAcceptor(final IManagedContainer container) {
>> // initialize acceptor
>> this.acceptor = JVMUtil.getAcceptor(container, "default");
>> }
>>
>> private CDONet4jSessionConfiguration
>> createSessionConfiguration(final IConnector connector) {
>>
>> sessionConfiguration =
>> CDONet4jUtil.createNet4jSessionConfiguration();
>> sessionConfiguration.setConnector(connector);
>> sessionConfiguration.setRepositoryName(repositoryName);
>>
>>
>> return sessionConfiguration;
>> }
>>
>>
>> }
>
Previous Topic:Strange behaviour of DELETE operation
Next Topic:[Oomph] Targlet resolve fails for feature with mixed plugin locations
Goto Forum:
  


Current Time: Tue Apr 23 15:38:44 GMT 2024

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

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

Back to the top