[CDO] running stand alone? [message #762819] |
Thu, 08 December 2011 17:02 |
Missing name Missing name Messages: 4 Registered: December 2011 |
Junior Member |
|
|
Hi,
I'm trying to find details on how to run CDO standalone without the needs for an equinox OSGi container. I've done lots of Google searches and forum searches but the best I've found is people saying it can be done, but no instructions.
I'm using CDO 4.0.0.v20110608-1440
I found this post here:
*topic and message, can't post links* CDO+standalone#msg_728087
Which obviously is a start of the puzzle, and I found the snippet on the wiki about defining it in Spring but half the classes don't seem to exist any more
*remove link as I can't post it*
So again this got me no further.
Specifically I'm after using Teneo and Hibernate with a simple MySQL back end. I have a config.xml that works perfectly when running inside eclipse/OSGi but I cannot get it to boot strap inside a simple java main class.
So far my attempt is:
final IManagedContainer container = IPluginContainer.INSTANCE;
Net4jUtil.prepareContainer(container); // Prepare the Net4j kernel
TCPUtil.prepareContainer(container); // Prepare the TCP transport (optional)
CDONet4jServerUtil.prepareContainer(container); // Prepare the CDO server for Net4j
final RepositoryConfigurator repositoryConfigurator = new RepositoryConfigurator(container);
final File configFile = new File("cdo-server.xml");
repositories = repositoryConfigurator.configure(configFile);
if ((this.repositories == null) || (this.repositories.length == 0)) {
System.err.println("Failed to find config file: " + configFile.getAbsolutePath());
}
final String port = OMPlatform.INSTANCE.getProperty("org.eclipse.emf.cdo.server.browser.port");
if (port != null) {
container.getElement("org.eclipse.emf.cdo.server.browsers", "default", port);
}
final Net4jAppExtension net4j = new Net4jAppExtension();
net4j.start(configFile);
Thread.sleep(Long.MAX_VALUE);
Which is mostly taken from the application that is launched by eclipse. However it blows up with an NPE when trying to call the repositoryConfigurator.configure line:
Exception in thread "main" java.lang.NullPointerException
at org.eclipse.emf.cdo.spi.server.RepositoryConfigurator.createExecutableExtension(RepositoryConfigurator.java:329)
at org.eclipse.emf.cdo.spi.server.RepositoryConfigurator.getStoreFactory(RepositoryConfigurator.java:275)
at org.eclipse.emf.cdo.spi.server.RepositoryConfigurator.createStore(RepositoryConfigurator.java:290)
at org.eclipse.emf.cdo.spi.server.RepositoryConfigurator.getRepository(RepositoryConfigurator.java:163)
at org.eclipse.emf.cdo.spi.server.RepositoryConfigurator.configure(RepositoryConfigurator.java:105)
Which looks like it is trying to go off down eclipse extension point route, so is clearly wrong.
Any pointers would be greatfuly received.
Thank you.
[Updated on: Thu, 08 December 2011 17:03] Report message to a moderator
|
|
|
Re: [CDO] running stand alone? [message #762840 is a reply to message #762819] |
Thu, 08 December 2011 17:34 |
|
Am 08.12.2011 18:02, schrieb stephen.rowles:
> Hi,
>
> I'm trying to find details on how to run CDO standalone without the needs for an equinox OSGi container. I've done
> lots of Google searches and forum searches but the best I've found is people saying it can be done, but no instructions.
>
> I'm using CDO 4.0.0.v20110608-1440
>
> I found this post here:
>
> *topic and message, can't post links* CDO+standalone#msg_728087
>
> Which obviously is a start of the puzzle, and I found the snippet on the wiki about defining it in Spring but half the
> classes don't seem to exist any more
>
> *remove link as I can't post it*
>
> So again this got me no further.
>
> Specifically I'm after using Teneo and Hibernate with a simple MySQL back end. I have a config.xml that works
> perfectly when running inside eclipse/OSGi but I cannot get it to boot strap inside a simple java main class.
>
> So far my attempt is:
>
>
> final IManagedContainer container = IPluginContainer.INSTANCE;
> Net4jUtil.prepareContainer(container); // Prepare the Net4j kernel
> TCPUtil.prepareContainer(container); // Prepare the TCP transport (optional)
> CDONet4jServerUtil.prepareContainer(container); // Prepare the CDO server for Net4j
Please add this for standalone:
container.activate();
>
> final RepositoryConfigurator repositoryConfigurator = new RepositoryConfigurator(container);
Please add this for standalone:
repositoryConfigurator.getStoreFactories().put(HibernateStore.TYPE, new HibernateStoreFactory());
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
> final File configFile = new File("cdo-server.xml");
> repositories = repositoryConfigurator.configure(configFile);
> if ((this.repositories == null) || (this.repositories.length == 0)) {
> System.err.println("Failed to find config file: " + configFile.getAbsolutePath());
> }
>
> final String port = OMPlatform.INSTANCE.getProperty("org.eclipse.emf.cdo.server.browser.port");
> if (port != null) {
> container.getElement("org.eclipse.emf.cdo.server.browsers", "default", port);
> }
>
> final Net4jAppExtension net4j = new Net4jAppExtension();
> net4j.start(configFile);
> Thread.sleep(Long.MAX_VALUE);
>
>
> Which is mostly taken from the application that is launched by eclipse. However it blows up with an NPE when trying to
> call the repositoryConfigurator.configure line:
>
>
> Exception in thread "main" java.lang.NullPointerException
> at org.eclipse.emf.cdo.spi.server.RepositoryConfigurator.createExecutableExtension(RepositoryConfigurator.java:329)
> at org.eclipse.emf.cdo.spi.server.RepositoryConfigurator.getStoreFactory(RepositoryConfigurator.java:275)
> at org.eclipse.emf.cdo.spi.server.RepositoryConfigurator.createStore(RepositoryConfigurator.java:290)
> at org.eclipse.emf.cdo.spi.server.RepositoryConfigurator.getRepository(RepositoryConfigurator.java:163)
> at org.eclipse.emf.cdo.spi.server.RepositoryConfigurator.configure(RepositoryConfigurator.java:105)
>
>
> Which looks like it is trying to go off down eclipse extension point route, so is clearly wrong.
>
> Any pointers would be greatfuly received.
>
> Thank you.
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
|
Re: [CDO] running stand alone? [message #763153 is a reply to message #763125] |
Fri, 09 December 2011 09:09 |
|
Am 09.12.2011 09:20, schrieb stephen.rowles:
> Thank you for the pointer, that's got be a bit further. However I now have a new NPE, again from registry point
> processing, but this time inside the HibernateUtil class. Having looked through the code I can't work out how to avoid
> it going down that route. Should I not be using the repositoryConfigurator.configure(configFile) method?
>
>
> Exception in thread "main" java.lang.NullPointerException
> at org.eclipse.emf.cdo.server.internal.hibernate.HibernateUtil.createMappingProviderFactory(HibernateUtil.java:194)
> at
> org.eclipse.emf.cdo.server.internal.hibernate.HibernateStoreFactory.getMappingProvider(HibernateStoreFactory.java:73)
> at org.eclipse.emf.cdo.server.internal.hibernate.HibernateStoreFactory.createStore(HibernateStoreFactory.java:49)
> at org.eclipse.emf.cdo.spi.server.RepositoryConfigurator.createStore(RepositoryConfigurator.java:291)
> at org.eclipse.emf.cdo.spi.server.RepositoryConfigurator.getRepository(RepositoryConfigurator.java:163)
> at org.eclipse.emf.cdo.spi.server.RepositoryConfigurator.configure(RepositoryConfigurator.java:105)
I think Martin (cc'ed) should factor the call to HibernateUtil.getInstance().createMappingProviderFactory() into a
protected method that you can override in your derived implementation. Please submit a bugzilla.
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
>
>
> My code now looks like this but again it still fails as the repositoryConfigurator.configure(configFile) line with the
> above stack trace.
>
>
> final IManagedContainer container = IPluginContainer.INSTANCE;
> Net4jUtil.prepareContainer(container); // Prepare the Net4j kernel
> TCPUtil.prepareContainer(container); // Prepare the TCP transport (optional)
> CDONet4jServerUtil.prepareContainer(container); // Prepare the CDO server for Net4j
> container.activate();
>
> final RepositoryConfigurator repositoryConfigurator = new RepositoryConfigurator(container);
> repositoryConfigurator.getStoreFactories().put(HibernateStore.TYPE, new HibernateStoreFactory());
> final File configFile = new File("cdo-server.xml");
> repositories = repositoryConfigurator.configure(configFile);
> if ((this.repositories == null) || (this.repositories.length == 0)) {
> System.err.println("Failed to find config file: " + configFile.getAbsolutePath());
> }
>
> final String port = OMPlatform.INSTANCE.getProperty("org.eclipse.emf.cdo.server.browser.port");
> if (port != null) {
> container.getElement("org.eclipse.emf.cdo.server.browsers", "default", port);
> }
>
> final Net4jAppExtension net4j = new Net4jAppExtension();
> net4j.start(configFile);
> Thread.sleep(Long.MAX_VALUE);
>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04825 seconds