Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] How to do jvm connection to the same repo as the tcp acceptor/connection
[CDO] How to do jvm connection to the same repo as the tcp acceptor/connection [message #686834] Sun, 22 May 2011 22:11 Go to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi,
I want to accomplish the following:
1- have a cdo server running, rcp clients connect to is using the tcp connections
2- on the server have business logic running which connects to the same cdo server/repository through the jvm connector.

The first works fine. For the second I have problems, I use this code snippet with the same repo name as used for the rcp
final IManagedContainer container = ContainerUtil.createContainer();
Net4jUtil.prepareContainer(container); // Register Net4j factories
JVMUtil.prepareContainer(container);
CDONet4jServerUtil.prepareContainer(container); // Prepare the CDO server
CDONet4jUtil.prepareContainer(container); // Register CDO factories
container.activate();

final IJVMAcceptor acceptor = JVMUtil.getAcceptor(container, repoName);
final IConnector connector = JVMUtil.getConnector(container, repoName);

// Create configuration
sessionConfiguration = CDONet4jUtil.createSessionConfiguration();
sessionConfiguration.setConnector(connector);
sessionConfiguration.setRepositoryName(repoName);

But I get this exception when opening a session:
[ERROR] Factory not found: org.eclipse.emf.cdo.server.repositories[default]
org.eclipse.net4j.util.container.FactoryNotFoundException: Factory not found:
org.eclipse.emf.cdo.server.repositories[default]
at org.eclipse.net4j.util.container.ManagedContainer.getFactory(ManagedContainer.java:193)
at org.eclipse.net4j.util.container.ManagedContainer.createElement(ManagedContainer.java:490)
at org.eclipse.net4j.util.container.ManagedContainer.getElement(ManagedContainer.java:281)
at org.eclipse.net4j.util.container.ManagedContainer.getElement(ManagedContainer.java:265)
at org.eclipse.emf.cdo.spi.server.RepositoryFactory.get(RepositoryFactory.java:43)
at org.eclipse.emf.cdo.spi.server.ContainerRepositoryProvider.getRepository(ContainerRepositoryProvider.java:41)
at org.eclipse.emf.cdo.server.internal.net4j.protocol.OpenSessionIndication.responding(OpenSessionIndication.java:98)
at
org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndicationWithMonitoring.responding(CDOServerIndicationWithMonitoring.java:170)
at org.eclipse.net4j.signal.IndicationWithMonitoring.responding(IndicationWithMonitoring.java:90)
at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedOutput(IndicationWithResponse.java:96)
at org.eclipse.net4j.signal.Signal.doOutput(Signal.java:296)
at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:65)
at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:63)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)
[ERROR] Repository not found: repo1
org.eclipse.emf.cdo.server.RepositoryNotFoundException: Repository not found: repo1
at org.eclipse.emf.cdo.server.internal.net4j.protocol.OpenSessionIndication.responding(OpenSessionIndication.java:101)
at
org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndicationWithMonitoring.responding(CDOServerIndicationWithMonitoring.java:170)
at org.eclipse.net4j.signal.IndicationWithMonitoring.responding(IndicationWithMonitoring.java:90)
at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedOutput(IndicationWithResponse.java:96)
at org.eclipse.net4j.signal.Signal.doOutput(Signal.java:296)
at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:65)
at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:63)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)
[ERROR] org.eclipse.emf.cdo.server.RepositoryNotFoundException
java.lang.ClassNotFoundException: org.eclipse.emf.cdo.server.RepositoryNotFoundException
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at org.eclipse.net4j.util.io.ExtendedIOUtil$ClassLoaderClassResolver.resolveClass(ExtendedIOUtil.java:278)
at org.eclipse.net4j.util.io.ExtendedIOUtil$3.resolveClass(ExtendedIOUtil.java:143)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1592)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1513)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1749)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:368)
at org.eclipse.net4j.util.io.ExtendedIOUtil.readObject(ExtendedIOUtil.java:157)
at org.eclipse.net4j.util.io.ExtendedIOUtil.readObject(ExtendedIOUtil.java:111)
at org.eclipse.net4j.signal.RemoteExceptionIndication.deserializeThrowable(RemoteExceptionIndication.java:72)
at org.eclipse.net4j.signal.RemoteExceptionIndication.indicating(RemoteExceptionIndication.java:51)
at org.eclipse.net4j.signal.Indication.doExtendedInput(Indication.java:55)
at org.eclipse.net4j.signal.Signal.doInput(Signal.java:326)
at org.eclipse.net4j.signal.Indication.execute(Indication.java:49)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)
[ERROR] org.eclipse.emf.cdo.common.util.CDOException
java.lang.ClassNotFoundException: org.eclipse.emf.cdo.common.util.CDOException
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at org.eclipse.net4j.util.io.ExtendedIOUtil$ClassLoaderClassResolver.resolveClass(ExtendedIOUtil.java:278)
at org.eclipse.net4j.util.io.ExtendedIOUtil$3.resolveClass(ExtendedIOUtil.java:143)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1592)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1513)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1600)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1513)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1749)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:368)
at org.eclipse.net4j.util.io.ExtendedIOUtil.readObject(ExtendedIOUtil.java:157)
at org.eclipse.net4j.util.io.ExtendedIOUtil.readObject(ExtendedIOUtil.java:111)
at org.eclipse.net4j.signal.RemoteExceptionIndication.deserializeThrowable(RemoteExceptionIndication.java:72)
at org.eclipse.net4j.signal.RemoteExceptionIndication.indicating(RemoteExceptionIndication.java:51)
at org.eclipse.net4j.signal.Indication.doExtendedInput(Indication.java:55)
at org.eclipse.net4j.signal.Signal.doInput(Signal.java:326)
at org.eclipse.net4j.signal.Indication.execute(Indication.java:49)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)
[ERROR] org.eclipse.emf.cdo.server.RepositoryNotFoundException
java.lang.ClassNotFoundException: org.eclipse.emf.cdo.server.RepositoryNotFoundException
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:621)
at org.eclipse.net4j.util.io.ExtendedIOUtil$3.resolveClass(ExtendedIOUtil.java:150)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1592)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1513)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1749)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:368)
at org.eclipse.net4j.util.io.ExtendedIOUtil.readObject(ExtendedIOUtil.java:157)
at org.eclipse.net4j.util.io.ExtendedIOUtil.readObject(ExtendedIOUtil.java:111)
at org.eclipse.net4j.signal.RemoteExceptionIndication.deserializeThrowable(RemoteExceptionIndication.java:72)
at org.eclipse.net4j.signal.RemoteExceptionIndication.indicating(RemoteExceptionIndication.java:51)
at org.eclipse.net4j.signal.Indication.doExtendedInput(Indication.java:55)
at org.eclipse.net4j.signal.Signal.doInput(Signal.java:326)
at org.eclipse.net4j.signal.Indication.execute(Indication.java:49)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)





--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [CDO] How to do jvm connection to the same repo as the tcp acceptor/connection [message #687022 is a reply to message #686834] Mon, 23 May 2011 07:24 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 23.05.2011 00:11, schrieb Martin Taal:
> Hi,
> I want to accomplish the following:
> 1- have a cdo server running, rcp clients connect to is using the tcp connections
> 2- on the server have business logic running which connects to the same cdo server/repository through the jvm connector.
>
> The first works fine. For the second I have problems, I use this code snippet with the same repo name as used for the rcp
> final IManagedContainer container = ContainerUtil.createContainer();
> Net4jUtil.prepareContainer(container); // Register Net4j factories
> JVMUtil.prepareContainer(container);
> CDONet4jServerUtil.prepareContainer(container); // Prepare the CDO server
> CDONet4jUtil.prepareContainer(container); // Register CDO factories
The above one is not needed because you're not fetching the CDOSession from the container but create it actively through the createSessionConfiguration() method. It does not harm, though.

> container.activate();
>
> final IJVMAcceptor acceptor = JVMUtil.getAcceptor(container, repoName);
> final IConnector connector = JVMUtil.getConnector(container, repoName);
You can use the repository name as the acceptor name, but that's not necessary. Important is only that a JVMConnector identifies its JVMAcceptor by the acceptor name.

>
> // Create configuration
> sessionConfiguration = CDONet4jUtil.createSessionConfiguration();
> sessionConfiguration.setConnector(connector);
> sessionConfiguration.setRepositoryName(repoName);
In all the above code I can not see that you're actually creating/starting a repository. Have you just forgotten to show us that code or is it really missing?

Note that CDONet4jServerUtil has two prepareContainer() methods and you've chosen the simpler one that expects to find repositories in the container. So don't forget to put your repository into the container. If you have a more specific repository setup you can also pass your own IRepositoryProvider (but this is rarely necessary).

The exceptions below seem to have different reasons. The main is probably that you've not started a repository or have not registered it with the container that's used by the JVMAcceptor. The following ClassNotFoundException probably occur because you're trying to open the JVMConnector based session from the server's Activator. The bundle could not be activated because of the first exception.

Cheers
/Eike

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


>
> But I get this exception when opening a session:
> [ERROR] Factory not found: org.eclipse.emf.cdo.server.repositories[default]
> org.eclipse.net4j.util.container.FactoryNotFoundException: Factory not found: org.eclipse.emf.cdo.server.repositories[default]
> at org.eclipse.net4j.util.container.ManagedContainer.getFactory(ManagedContainer.java:193)
> at org.eclipse.net4j.util.container.ManagedContainer.createElement(ManagedContainer.java:490)
> at org.eclipse.net4j.util.container.ManagedContainer.getElement(ManagedContainer.java:281)
> at org.eclipse.net4j.util.container.ManagedContainer.getElement(ManagedContainer.java:265)
> at org.eclipse.emf.cdo.spi.server.RepositoryFactory.get(RepositoryFactory.java:43)
> at org.eclipse.emf.cdo.spi.server.ContainerRepositoryProvider.getRepository(ContainerRepositoryProvider.java:41)
> at org.eclipse.emf.cdo.server.internal.net4j.protocol.OpenSessionIndication.responding(OpenSessionIndication.java:98)
> at org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndicationWithMonitoring.responding(CDOServerIndicationWithMonitoring.java:170)
> at org.eclipse.net4j.signal.IndicationWithMonitoring.responding(IndicationWithMonitoring.java:90)
> at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedOutput(IndicationWithResponse.java:96)
> at org.eclipse.net4j.signal.Signal.doOutput(Signal.java:296)
> at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:65)
> at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:63)
> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
> at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
> at java.lang.Thread.run(Thread.java:679)
> [ERROR] Repository not found: repo1
> org.eclipse.emf.cdo.server.RepositoryNotFoundException: Repository not found: repo1
> at org.eclipse.emf.cdo.server.internal.net4j.protocol.OpenSessionIndication.responding(OpenSessionIndication.java:101)
> at org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndicationWithMonitoring.responding(CDOServerIndicationWithMonitoring.java:170)
> at org.eclipse.net4j.signal.IndicationWithMonitoring.responding(IndicationWithMonitoring.java:90)
> at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedOutput(IndicationWithResponse.java:96)
> at org.eclipse.net4j.signal.Signal.doOutput(Signal.java:296)
> at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:65)
> at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:63)
> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
> at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
> at java.lang.Thread.run(Thread.java:679)
> [ERROR] org.eclipse.emf.cdo.server.RepositoryNotFoundException
> java.lang.ClassNotFoundException: org.eclipse.emf.cdo.server.RepositoryNotFoundException
> at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
> at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
> at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
> at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
> at org.eclipse.net4j.util.io.ExtendedIOUtil$ClassLoaderClassResolver.resolveClass(ExtendedIOUtil.java:278)
> at org.eclipse.net4j.util.io.ExtendedIOUtil$3.resolveClass(ExtendedIOUtil.java:143)
> at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1592)
> at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1513)
> at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1749)
> at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)
> at java.io.ObjectInputStream.readObject(ObjectInputStream.java:368)
> at org.eclipse.net4j.util.io.ExtendedIOUtil.readObject(ExtendedIOUtil.java:157)
> at org.eclipse.net4j.util.io.ExtendedIOUtil.readObject(ExtendedIOUtil.java:111)
> at org.eclipse.net4j.signal.RemoteExceptionIndication.deserializeThrowable(RemoteExceptionIndication.java:72)
> at org.eclipse.net4j.signal.RemoteExceptionIndication.indicating(RemoteExceptionIndication.java:51)
> at org.eclipse.net4j.signal.Indication.doExtendedInput(Indication.java:55)
> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:326)
> at org.eclipse.net4j.signal.Indication.execute(Indication.java:49)
> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
> at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
> at java.lang.Thread.run(Thread.java:679)
> [ERROR] org.eclipse.emf.cdo.common.util.CDOException
> java.lang.ClassNotFoundException: org.eclipse.emf.cdo.common.util.CDOException
> at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
> at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
> at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
> at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
> at org.eclipse.net4j.util.io.ExtendedIOUtil$ClassLoaderClassResolver.resolveClass(ExtendedIOUtil.java:278)
> at org.eclipse.net4j.util.io.ExtendedIOUtil$3.resolveClass(ExtendedIOUtil.java:143)
> at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1592)
> at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1513)
> at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1600)
> at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1513)
> at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1749)
> at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)
> at java.io.ObjectInputStream.readObject(ObjectInputStream.java:368)
> at org.eclipse.net4j.util.io.ExtendedIOUtil.readObject(ExtendedIOUtil.java:157)
> at org.eclipse.net4j.util.io.ExtendedIOUtil.readObject(ExtendedIOUtil.java:111)
> at org.eclipse.net4j.signal.RemoteExceptionIndication.deserializeThrowable(RemoteExceptionIndication.java:72)
> at org.eclipse.net4j.signal.RemoteExceptionIndication.indicating(RemoteExceptionIndication.java:51)
> at org.eclipse.net4j.signal.Indication.doExtendedInput(Indication.java:55)
> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:326)
> at org.eclipse.net4j.signal.Indication.execute(Indication.java:49)
> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
> at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
> at java.lang.Thread.run(Thread.java:679)
> [ERROR] org.eclipse.emf.cdo.server.RepositoryNotFoundException
> java.lang.ClassNotFoundException: org.eclipse.emf.cdo.server.RepositoryNotFoundException
> at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
> at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
> at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
> at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:264)
> at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:621)
> at org.eclipse.net4j.util.io.ExtendedIOUtil$3.resolveClass(ExtendedIOUtil.java:150)
> at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1592)
> at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1513)
> at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1749)
> at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)
> at java.io.ObjectInputStream.readObject(ObjectInputStream.java:368)
> at org.eclipse.net4j.util.io.ExtendedIOUtil.readObject(ExtendedIOUtil.java:157)
> at org.eclipse.net4j.util.io.ExtendedIOUtil.readObject(ExtendedIOUtil.java:111)
> at org.eclipse.net4j.signal.RemoteExceptionIndication.deserializeThrowable(RemoteExceptionIndication.java:72)
> at org.eclipse.net4j.signal.RemoteExceptionIndication.indicating(RemoteExceptionIndication.java:51)
> at org.eclipse.net4j.signal.Indication.doExtendedInput(Indication.java:55)
> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:326)
> at org.eclipse.net4j.signal.Indication.execute(Indication.java:49)
> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
> at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
> at java.lang.Thread.run(Thread.java:679)
>
>
>
>
>


Re: [CDO] How to do jvm connection to the same repo as the tcp acceptor/connection [message #687025 is a reply to message #687022] Mon, 23 May 2011 08:05 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Eike,
Thanks for the extra info, the solution is to use the IPluginContainer.INSTANCE, this works:
final IManagedContainer container = IPluginContainer.INSTANCE;
acceptor = JVMUtil.getAcceptor(container, "default");
connector = JVMUtil.getConnector(container, "default");

// Create configuration
sessionConfiguration = CDONet4jUtil.createSessionConfiguration();
sessionConfiguration.setConnector(connector);
sessionConfiguration.setRepositoryName(repoName);

Thanks!

gr. Martin

On 05/23/2011 09:24 AM, Eike Stepper wrote:
> Am 23.05.2011 00:11, schrieb Martin Taal:
>> Hi,
>> I want to accomplish the following:
>> 1- have a cdo server running, rcp clients connect to is using the tcp connections
>> 2- on the server have business logic running which connects to the same cdo server/repository through the jvm connector.
>>
>> The first works fine. For the second I have problems, I use this code snippet with the same repo name as used for the rcp
>> final IManagedContainer container = ContainerUtil.createContainer();
>> Net4jUtil.prepareContainer(container); // Register Net4j factories
>> JVMUtil.prepareContainer(container);
>> CDONet4jServerUtil.prepareContainer(container); // Prepare the CDO server
>> CDONet4jUtil.prepareContainer(container); // Register CDO factories
> The above one is not needed because you're not fetching the CDOSession from the container but create it actively through
> the createSessionConfiguration() method. It does not harm, though.
>
>> container.activate();
>>
>> final IJVMAcceptor acceptor = JVMUtil.getAcceptor(container, repoName);
>> final IConnector connector = JVMUtil.getConnector(container, repoName);
> You can use the repository name as the acceptor name, but that's not necessary. Important is only that a JVMConnector
> identifies its JVMAcceptor by the acceptor name.
>
>>
>> // Create configuration
>> sessionConfiguration = CDONet4jUtil.createSessionConfiguration();
>> sessionConfiguration.setConnector(connector);
>> sessionConfiguration.setRepositoryName(repoName);
> In all the above code I can not see that you're actually creating/starting a repository. Have you just forgotten to show
> us that code or is it really missing?
>
> Note that CDONet4jServerUtil has two prepareContainer() methods and you've chosen the simpler one that expects to find
> repositories in the container. So don't forget to put your repository into the container. If you have a more specific
> repository setup you can also pass your own IRepositoryProvider (but this is rarely necessary).
>
> The exceptions below seem to have different reasons. The main is probably that you've not started a repository or have
> not registered it with the container that's used by the JVMAcceptor. The following ClassNotFoundException probably occur
> because you're trying to open the JVMConnector based session from the server's Activator. The bundle could not be
> activated because of the first exception.
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>>
>> But I get this exception when opening a session:
>> [ERROR] Factory not found: org.eclipse.emf.cdo.server.repositories[default]
>> org.eclipse.net4j.util.container.FactoryNotFoundException: Factory not found:
>> org.eclipse.emf.cdo.server.repositories[default]
>> at org.eclipse.net4j.util.container.ManagedContainer.getFactory(ManagedContainer.java:193)
>> at org.eclipse.net4j.util.container.ManagedContainer.createElement(ManagedContainer.java:490)
>> at org.eclipse.net4j.util.container.ManagedContainer.getElement(ManagedContainer.java:281)
>> at org.eclipse.net4j.util.container.ManagedContainer.getElement(ManagedContainer.java:265)
>> at org.eclipse.emf.cdo.spi.server.RepositoryFactory.get(RepositoryFactory.java:43)
>> at org.eclipse.emf.cdo.spi.server.ContainerRepositoryProvider.getRepository(ContainerRepositoryProvider.java:41)
>> at org.eclipse.emf.cdo.server.internal.net4j.protocol.OpenSessionIndication.responding(OpenSessionIndication.java:98)
>> at
>> org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndicationWithMonitoring.responding(CDOServerIndicationWithMonitoring.java:170)
>>
>> at org.eclipse.net4j.signal.IndicationWithMonitoring.responding(IndicationWithMonitoring.java:90)
>> at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedOutput(IndicationWithResponse.java:96)
>> at org.eclipse.net4j.signal.Signal.doOutput(Signal.java:296)
>> at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:65)
>> at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:63)
>> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
>> at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
>> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>> at java.lang.Thread.run(Thread.java:679)
>> [ERROR] Repository not found: repo1
>> org.eclipse.emf.cdo.server.RepositoryNotFoundException: Repository not found: repo1
>> at org.eclipse.emf.cdo.server.internal.net4j.protocol.OpenSessionIndication.responding(OpenSessionIndication.java:101)
>> at
>> org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndicationWithMonitoring.responding(CDOServerIndicationWithMonitoring.java:170)
>>
>> at org.eclipse.net4j.signal.IndicationWithMonitoring.responding(IndicationWithMonitoring.java:90)
>> at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedOutput(IndicationWithResponse.java:96)
>> at org.eclipse.net4j.signal.Signal.doOutput(Signal.java:296)
>> at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:65)
>> at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:63)
>> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
>> at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
>> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>> at java.lang.Thread.run(Thread.java:679)
>> [ERROR] org.eclipse.emf.cdo.server.RepositoryNotFoundException
>> java.lang.ClassNotFoundException: org.eclipse.emf.cdo.server.RepositoryNotFoundException
>> at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
>> at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
>> at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
>> at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
>> at org.eclipse.net4j.util.io.ExtendedIOUtil$ClassLoaderClassResolver.resolveClass(ExtendedIOUtil.java:278)
>> at org.eclipse.net4j.util.io.ExtendedIOUtil$3.resolveClass(ExtendedIOUtil.java:143)
>> at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1592)
>> at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1513)
>> at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1749)
>> at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)
>> at java.io.ObjectInputStream.readObject(ObjectInputStream.java:368)
>> at org.eclipse.net4j.util.io.ExtendedIOUtil.readObject(ExtendedIOUtil.java:157)
>> at org.eclipse.net4j.util.io.ExtendedIOUtil.readObject(ExtendedIOUtil.java:111)
>> at org.eclipse.net4j.signal.RemoteExceptionIndication.deserializeThrowable(RemoteExceptionIndication.java:72)
>> at org.eclipse.net4j.signal.RemoteExceptionIndication.indicating(RemoteExceptionIndication.java:51)
>> at org.eclipse.net4j.signal.Indication.doExtendedInput(Indication.java:55)
>> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:326)
>> at org.eclipse.net4j.signal.Indication.execute(Indication.java:49)
>> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
>> at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
>> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>> at java.lang.Thread.run(Thread.java:679)
>> [ERROR] org.eclipse.emf.cdo.common.util.CDOException
>> java.lang.ClassNotFoundException: org.eclipse.emf.cdo.common.util.CDOException
>> at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
>> at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
>> at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
>> at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
>> at org.eclipse.net4j.util.io.ExtendedIOUtil$ClassLoaderClassResolver.resolveClass(ExtendedIOUtil.java:278)
>> at org.eclipse.net4j.util.io.ExtendedIOUtil$3.resolveClass(ExtendedIOUtil.java:143)
>> at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1592)
>> at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1513)
>> at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1600)
>> at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1513)
>> at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1749)
>> at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)
>> at java.io.ObjectInputStream.readObject(ObjectInputStream.java:368)
>> at org.eclipse.net4j.util.io.ExtendedIOUtil.readObject(ExtendedIOUtil.java:157)
>> at org.eclipse.net4j.util.io.ExtendedIOUtil.readObject(ExtendedIOUtil.java:111)
>> at org.eclipse.net4j.signal.RemoteExceptionIndication.deserializeThrowable(RemoteExceptionIndication.java:72)
>> at org.eclipse.net4j.signal.RemoteExceptionIndication.indicating(RemoteExceptionIndication.java:51)
>> at org.eclipse.net4j.signal.Indication.doExtendedInput(Indication.java:55)
>> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:326)
>> at org.eclipse.net4j.signal.Indication.execute(Indication.java:49)
>> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
>> at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
>> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>> at java.lang.Thread.run(Thread.java:679)
>> [ERROR] org.eclipse.emf.cdo.server.RepositoryNotFoundException
>> java.lang.ClassNotFoundException: org.eclipse.emf.cdo.server.RepositoryNotFoundException
>> at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
>> at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
>> at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
>> at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
>> at java.lang.Class.forName0(Native Method)
>> at java.lang.Class.forName(Class.java:264)
>> at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:621)
>> at org.eclipse.net4j.util.io.ExtendedIOUtil$3.resolveClass(ExtendedIOUtil.java:150)
>> at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1592)
>> at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1513)
>> at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1749)
>> at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)
>> at java.io.ObjectInputStream.readObject(ObjectInputStream.java:368)
>> at org.eclipse.net4j.util.io.ExtendedIOUtil.readObject(ExtendedIOUtil.java:157)
>> at org.eclipse.net4j.util.io.ExtendedIOUtil.readObject(ExtendedIOUtil.java:111)
>> at org.eclipse.net4j.signal.RemoteExceptionIndication.deserializeThrowable(RemoteExceptionIndication.java:72)
>> at org.eclipse.net4j.signal.RemoteExceptionIndication.indicating(RemoteExceptionIndication.java:51)
>> at org.eclipse.net4j.signal.Indication.doExtendedInput(Indication.java:55)
>> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:326)
>> at org.eclipse.net4j.signal.Indication.execute(Indication.java:49)
>> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
>> at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
>> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>> at java.lang.Thread.run(Thread.java:679)
>>
>>
>>
>>
>>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Previous Topic:Using the RepositoryUserManager, querying through the StoreAccessor
Next Topic:ClassCastException in changing the input of TreeViewer
Goto Forum:
  


Current Time: Thu Apr 25 08:23:40 GMT 2024

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

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

Back to the top