Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Server in non-OSGi environment
[CDO] Server in non-OSGi environment [message #986376] Tue, 20 November 2012 04:38 Go to next message
Jan Rosczak is currently offline Jan Rosczak
Messages: 25
Registered: July 2009
Location: Hamburg, Germany
Junior Member
Hi,

I am trying to start a CDO 4.1 server in a non-OSGi environment and ran into a couple of issues.

I initialise my server container as follows:
IManagedContainer repositoryContainer = ContainerUtil.createContainer();

Net4jUtil.prepareContainer(repositoryContainer);
TCPUtil.prepareContainer(repositoryContainer);
JVMUtil.prepareContainer(repositoryContainer);
CDONet4jServerUtil.prepareContainer(repositoryContainer);
OCLQueryHandler.prepareContainer(repositoryContainer);

LifecycleUtil.activate(repositoryContainer);


I am using a H2 db store with no audit and no branching enabled.

When starting the server for the first time I get the following exception:

java.lang.UnsupportedOperationException
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.doSave(ResourceImpl.java:1449)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:1417)
	at org.eclipse.emf.cdo.common.model.EMFUtil.getEPackageBytes(EMFUtil.java:276)
	at org.eclipse.emf.cdo.server.internal.db.MetaDataManager.getEPackageBytes(MetaDataManager.java:221)
	at org.eclipse.emf.cdo.server.internal.db.MetaDataManager.fillSystemTables(MetaDataManager.java:248)
	at org.eclipse.emf.cdo.server.internal.db.MetaDataManager.fillSystemTables(MetaDataManager.java:291)
	at org.eclipse.emf.cdo.server.internal.db.MetaDataManager.writePackageUnits(MetaDataManager.java:138)
	at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writePackageUnits(DBStoreAccessor.java:822)
	at org.eclipse.emf.cdo.internal.server.Repository.initSystemPackages(Repository.java:1669)
	at org.eclipse.emf.cdo.internal.server.Repository.doActivate(Repository.java:1864)


Do I have to initialise EMF in some way which would normally be done by the Equinox Extenstion Registry?

The second thing I do not understand is, why I need the following two jars if I am in a non-OSGi environment:
org.eclipse.equinox.common
org.eclipse.equinox.registry

Maybe that is related to the fact that the class org.eclipse.emf.cdo.server.internal.db.mapping.TypeMappingRegistry always
returns an instance of IPluginContainer as its container. I thought it should use the managed container that is used to create the repository ("repositoryContainer" in my example above).

  protected IManagedContainer getContainer()
  {
    return IPluginContainer.INSTANCE;
  }


Thanks
Jan
Re: [CDO] Server in non-OSGi environment [message #986386 is a reply to message #986376] Tue, 20 November 2012 05:03 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5446
Registered: July 2009
Senior Member
Am 20.11.2012 10:38, schrieb Jan Rosczak:
> Hi,
>
> I am trying to start a CDO 4.1 server in a non-OSGi environment and ran into a couple of issues.
>
> I initialise my server container as follows:
>
> IManagedContainer repositoryContainer = ContainerUtil.createContainer();
>
> Net4jUtil.prepareContainer(repositoryContainer);
> TCPUtil.prepareContainer(repositoryContainer);
> JVMUtil.prepareContainer(repositoryContainer);
> CDONet4jServerUtil.prepareContainer(repositoryContainer);
> OCLQueryHandler.prepareContainer(repositoryContainer);
It's usually easier to prepare IPluginContainer.INSTANCE because many components use that by default, e.g., the
TypeMappingRegistry.

>
> LifecycleUtil.activate(repositoryContainer);
>
>
> I am using a H2 db store with no audit and no branching enabled.
>
> When starting the server for the first time I get the following exception:
>
>
> java.lang.UnsupportedOperationException
> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.doSave(ResourceImpl.java:1449)
> at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:1417)
> at org.eclipse.emf.cdo.common.model.EMFUtil.getEPackageBytes(EMFUtil.java:276)
> at org.eclipse.emf.cdo.server.internal.db.MetaDataManager.getEPackageBytes(MetaDataManager.java:221)
> at org.eclipse.emf.cdo.server.internal.db.MetaDataManager.fillSystemTables(MetaDataManager.java:248)
> at org.eclipse.emf.cdo.server.internal.db.MetaDataManager.fillSystemTables(MetaDataManager.java:291)
> at org.eclipse.emf.cdo.server.internal.db.MetaDataManager.writePackageUnits(MetaDataManager.java:138)
> at org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.writePackageUnits(DBStoreAccessor.java:822)
> at org.eclipse.emf.cdo.internal.server.Repository.initSystemPackages(Repository.java:1669)
> at org.eclipse.emf.cdo.internal.server.Repository.doActivate(Repository.java:1864)
Are you sure that you've deployed org.eclipse.emf.ecore.xmi and org.eclipse.emf.ecore.change properly?

>
>
> Do I have to initialise EMF in some way which would normally be done by the Equinox Extenstion Registry?
>
> The second thing I do not understand is, why I need the following two jars if I am in a non-OSGi environment:
> org.eclipse.equinox.common
> org.eclipse.equinox.registry
That's most likely because we expose some Platform interfaces, e.g., IAdaptable or IProgressMonitor.

>
> Maybe that is related to the fact that the class org.eclipse.emf.cdo.server.internal.db.mapping.TypeMappingRegistry
> always
> returns an instance of IPluginContainer as its container. I thought it should use the managed container that is used
> to create the repository ("repositoryContainer" in my example above).
>
>
> protected IManagedContainer getContainer()
> {
> return IPluginContainer.INSTANCE;
> }
See above.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] Server in non-OSGi environment [message #986390 is a reply to message #986386] Tue, 20 November 2012 05:13 Go to previous messageGo to next message
Jan Rosczak is currently offline Jan Rosczak
Messages: 25
Registered: July 2009
Location: Hamburg, Germany
Junior Member
Hi,

I was missing org.eclipse.emf.ecore.xmi. Now it works and I will refactor my code to use IPluginContainer.INSTANCE.

Thanks
Jan
Re: [CDO] Server in non-OSGi environment [message #986405 is a reply to message #986390] Tue, 20 November 2012 05:39 Go to previous message
Eike Stepper is currently offline Eike Stepper
Messages: 5446
Registered: July 2009
Senior Member
Am 20.11.2012 11:13, schrieb Jan Rosczak:
> Hi,
>
> I was missing org.eclipse.emf.ecore.xmi. Now it works and I will refactor my code to use IPluginContainer.INSTANCE.

Excellent ;-)

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Previous Topic:[CDO] CDOResource name equal
Next Topic:emf.sdk feature on Kepler milestone ?
Goto Forum:
  


Current Time: Fri Apr 18 01:53:20 EDT 2014

Powered by FUDForum. Page generated in 0.02234 seconds