Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] query server for existing repository
[CDO] query server for existing repository [message #431515] Tue, 14 July 2009 17:30 Go to next message
steven is currently offline stevenFriend
Messages: 8
Registered: July 2009
Junior Member
hi folks,

how can I check if a cdo server already contains a repository?

my scenario is the following:

1. start server
2. create repository "repo1"
3. shutdown server
4. restart server
5. open "repo1"

I tried the following:

IRepository repository = CDOServerUtil.getRepository(container,
repositoryName);
if(repository == null){
//create repo
}else{
//use existing repo
}


but I get an exception:

org.eclipse.net4j.util.container.FactoryNotFoundException: Factory not
found: org.eclipse.emf.cdo.server.repositories[default]


cheers,

steven
Re: [CDO] query server for existing repository [message #431518 is a reply to message #431515] Wed, 15 July 2009 07:26 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Steven,

There's no single and mandatory way to create repositories or make them
available on a server. They are no operating services by themselves so
they do not automatically appear after a server restart, unless you
ensure that the repository is started again, too.

If, after starting a repository, you put it into an IManagedContainer
you can query the container, as you try it below. But a repository does
not automatically end up registered with such a container. You'd have to
register it there for example with
CDOServerUtil.addRepository(IManagedContainer, IRepository).

You could also use the OSGi service registry or a Spring application
context or your own mechanism...

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper



steven schrieb:
> hi folks,
>
> how can I check if a cdo server already contains a repository?
>
> my scenario is the following:
>
> 1. start server
> 2. create repository "repo1"
> 3. shutdown server
> 4. restart server
> 5. open "repo1"
>
> I tried the following:
>
> IRepository repository = CDOServerUtil.getRepository(container,
> repositoryName);
> if(repository == null){
> //create repo
> }else{
> //use existing repo
> }
>
>
> but I get an exception:
>
> org.eclipse.net4j.util.container.FactoryNotFoundException: Factory not
> found: org.eclipse.emf.cdo.server.repositories[default]
>
>
> cheers,
>
> steven


Re: [CDO] query server for existing repository [message #431532 is a reply to message #431518] Wed, 15 July 2009 09:19 Go to previous messageGo to next message
steven is currently offline stevenFriend
Messages: 8
Registered: July 2009
Junior Member
eike,

comments below ..

Eike Stepper wrote:
> Steven,
>
> There's no single and mandatory way to create repositories or make them
> available on a server. They are no operating services by themselves so
> they do not automatically appear after a server restart, unless you
> ensure that the repository is started again, too.

that's what I want .. how I can start a repository again; respectively,
how can I restart all previously created repositories after a server
restart?

cheers,

steven

> If, after starting a repository, you put it into an IManagedContainer
> you can query the container, as you try it below. But a repository does
> not automatically end up registered with such a container. You'd have to
> register it there for example with
> CDOServerUtil.addRepository(IManagedContainer, IRepository).
>
> You could also use the OSGi service registry or a Spring application
> context or your own mechanism...
>
> Cheers
> /Eike
>
> ----
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>
> steven schrieb:
>> hi folks,
>>
>> how can I check if a cdo server already contains a repository?
>>
>> my scenario is the following:
>>
>> 1. start server
>> 2. create repository "repo1"
>> 3. shutdown server
>> 4. restart server
>> 5. open "repo1"
>>
>> I tried the following:
>>
>> IRepository repository = CDOServerUtil.getRepository(container,
>> repositoryName);
>> if(repository == null){
>> //create repo
>> }else{
>> //use existing repo
>> }
>>
>>
>> but I get an exception:
>>
>> org.eclipse.net4j.util.container.FactoryNotFoundException: Factory not
>> found: org.eclipse.emf.cdo.server.repositories[default]
>>
>>
>> cheers,
>>
>> steven
Re: [CDO] query server for existing repository [message #431533 is a reply to message #431532] Wed, 15 July 2009 13:17 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Steven,

There is no magic in CDO that does this automatically. *You* must do
that by executing the same Java statements that you initially executed.

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper



steven schrieb:
> eike,
>
> comments below ..
>
> Eike Stepper wrote:
>> Steven,
>>
>> There's no single and mandatory way to create repositories or make them
>> available on a server. They are no operating services by themselves so
>> they do not automatically appear after a server restart, unless you
>> ensure that the repository is started again, too.
>
> that's what I want .. how I can start a repository again; respectively,
> how can I restart all previously created repositories after a server
> restart?
>
> cheers,
>
> steven
>
>> If, after starting a repository, you put it into an IManagedContainer
>> you can query the container, as you try it below. But a repository does
>> not automatically end up registered with such a container. You'd have to
>> register it there for example with
>> CDOServerUtil.addRepository(IManagedContainer, IRepository).
>>
>> You could also use the OSGi service registry or a Spring application
>> context or your own mechanism...
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>>
>> steven schrieb:
>>> hi folks,
>>>
>>> how can I check if a cdo server already contains a repository?
>>>
>>> my scenario is the following:
>>>
>>> 1. start server
>>> 2. create repository "repo1"
>>> 3. shutdown server
>>> 4. restart server
>>> 5. open "repo1"
>>>
>>> I tried the following:
>>>
>>> IRepository repository = CDOServerUtil.getRepository(container,
>>> repositoryName);
>>> if(repository == null){
>>> //create repo
>>> }else{
>>> //use existing repo
>>> }
>>>
>>>
>>> but I get an exception:
>>>
>>> org.eclipse.net4j.util.container.FactoryNotFoundException: Factory not
>>> found: org.eclipse.emf.cdo.server.repositories[default]
>>>
>>>
>>> cheers,
>>>
>>> steven


Re: [CDO] query server for existing repository [message #431545 is a reply to message #431533] Wed, 15 July 2009 10:26 Go to previous messageGo to next message
steven is currently offline stevenFriend
Messages: 8
Registered: July 2009
Junior Member
eike,

I am executing the same java statements, but if I stop the server
in the osgi console and start it again, I get the exception I appended
at the end.
the exception is thrown when I check if my repository's structure has
already been created:

protected void createRepositoryStructure() {
CDOTransaction transaction = null;
if(!view.hasResource(SOL_ARCH_FOLDER_NAME)){//exception thrown here
transaction = session.openTransaction();
CDOResourceFolder solArchfolder =
EresourceFactory.eINSTANCE.createCDOResourceFolder();
solArchfolder.setName(SOL_ARCH_FOLDER_NAME);
EList<EObject> rootContent =
transaction.getRootResource().getContents();
rootContent.add(solArchfolder);
transaction.commit();
transaction.close();
}
}

so, initially the method createRepositoryStructure() works fine,
but then it crashes with the following exception:

[ERROR] EOFException
java.io.EOFException
at java.io.DataInputStream.readBoolean(DataInputStream.java:227 )
at
org.eclipse.net4j.util.io.ExtendedDataInput$Delegating.readB oolean(ExtendedDataInput.java:55)
at
org.eclipse.emf.cdo.internal.common.io.CDODataInputImpl.read CDORevision(CDODataInputImpl.java:214)
at
org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:116)
at
org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:1)
at
org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientRequest .confirming(CDOClientRequest.java:77)
at
org.eclipse.net4j.signal.RequestWithConfirmation.doExtendedI nput(RequestWithConfirmation.java:123)
at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
at
org.eclipse.net4j.signal.RequestWithConfirmation.doExecute(R equestWithConfirmation.java:103)
at org.eclipse.net4j.signal.SignalActor.execute(SignalActor.jav a:66)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
at
org.eclipse.net4j.signal.SignalProtocol.startSignal(SignalPr otocol.java:421)
at
org.eclipse.net4j.signal.RequestWithConfirmation.doSend(Requ estWithConfirmation.java:87)
at
org.eclipse.net4j.signal.RequestWithConfirmation.send(Reques tWithConfirmation.java:73)

at
org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:286)
at
org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:319)
at
org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.loadRevisions(CDOClientProtocol.java:110)
at
org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevisions(CDORevisionManagerImpl.java:124)
at
org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevision(CDORevisionManagerImpl.java:106)
at
org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:155)
at
org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:1)
at
org.eclipse.emf.internal.cdo.view.CDOViewImpl.getRevision(CD OViewImpl.java:682)
at
org.eclipse.emf.internal.cdo.view.CDOViewImpl.getLocalRevisi on(CDOViewImpl.java:561)
at
org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:508)
at
org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eIDChecked(CDOViewImpl.java:447)
at
org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:435)
at
org.eclipse.emf.internal.cdo.view.CDOViewImpl.hasResource(CD OViewImpl.java:376)
at
de.hpi.sam.mdcm.cmdb.repository.Repository.createRepositoryS tructure(Repository.java:49)
at de.hpi.sam.mdcm.cmdb.repository.Repository.<init>(Repository.java:31)
at
de.hpi.sam.mdcm.cmdb.server.internal.CMDBServer.createReposi tory(CMDBServer.java:138)
at de.hpi.sam.mdcm.cmdb.server.internal.Activator.start(Activat or.java:38)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:1009)
at java.security.AccessController.doPrivileged(Native Method)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:1003)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:984)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:265)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:257)
at
org.eclipse.osgi.framework.internal.core.FrameworkCommandPro vider._start(FrameworkCommandProvider.java:257)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:150)
at
org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:302)
at
org.eclipse.osgi.framework.internal.core.FrameworkConsole.co nsole(FrameworkConsole.java:287)
at
org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:223)
at java.lang.Thread.run(Thread.java:619)
!ENTRY org.eclipse.net4j 4 0 2009-07-15 12:09:16.179
!MESSAGE EOFException
!STACK 0
java.io.EOFException
at java.io.DataInputStream.readBoolean(DataInputStream.java:227 )
at
org.eclipse.net4j.util.io.ExtendedDataInput$Delegating.readB oolean(ExtendedDataInput.java:55)
at
org.eclipse.emf.cdo.internal.common.io.CDODataInputImpl.read CDORevision(CDODataInputImpl.java:214)
at
org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:116)
at
org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:1)
at
org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientRequest .confirming(CDOClientRequest.java:77)
at
org.eclipse.net4j.signal.RequestWithConfirmation.doExtendedI nput(RequestWithConfirmation.java:123)
at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
at
org.eclipse.net4j.signal.RequestWithConfirmation.doExecute(R equestWithConfirmation.java:103)
at org.eclipse.net4j.signal.SignalActor.execute(SignalActor.jav a:66)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
at
org.eclipse.net4j.signal.SignalProtocol.startSignal(SignalPr otocol.java:421)
at
org.eclipse.net4j.signal.RequestWithConfirmation.doSend(Requ estWithConfirmation.java:87)
at
org.eclipse.net4j.signal.RequestWithConfirmation.send(Reques tWithConfirmation.java:73)
at
org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:286)
at
org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:319)
at
org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.loadRevisions(CDOClientProtocol.java:110)
at
org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevisions(CDORevisionManagerImpl.java:124)
at
org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevision(CDORevisionManagerImpl.java:106)
at
org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:155)
at
org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:1)
at
org.eclipse.emf.internal.cdo.view.CDOViewImpl.getRevision(CD OViewImpl.java:682)
at
org.eclipse.emf.internal.cdo.view.CDOViewImpl.getLocalRevisi on(CDOViewImpl.java:561)
at
org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:508)
at
org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eIDChecked(CDOViewImpl.java:447)
at
org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:435)
at
org.eclipse.emf.internal.cdo.view.CDOViewImpl.hasResource(CD OViewImpl.java:376)
at
de.hpi.sam.mdcm.cmdb.repository.Repository.createRepositoryS tructure(Repository.java:49)
at de.hpi.sam.mdcm.cmdb.repository.Repository.<init>(Repository.java:31)
at
de.hpi.sam.mdcm.cmdb.server.internal.CMDBServer.createReposi tory(CMDBServer.java:138)
at de.hpi.sam.mdcm.cmdb.server.internal.Activator.start(Activat or.java:38)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:1009)
at java.security.AccessController.doPrivileged(Native Method)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:1003)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:984)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:265)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:257)
at
org.eclipse.osgi.framework.internal.core.FrameworkCommandPro vider._start(FrameworkCommandProvider.java:257)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:150)
at
org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:302)
at
org.eclipse.osgi.framework.internal.core.FrameworkConsole.co nsole(FrameworkConsole.java:287)
at
org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:223)
at java.lang.Thread.run(Thread.java:619)


what am I missing?


cheers,

steven


Eike Stepper wrote:
> Steven,
>
> There is no magic in CDO that does this automatically. *You* must do
> that by executing the same Java statements that you initially executed.
>
> Cheers
> /Eike
>
> ----
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>
> steven schrieb:
>> eike,
>>
>> comments below ..
>>
>> Eike Stepper wrote:
>>> Steven,
>>>
>>> There's no single and mandatory way to create repositories or make them
>>> available on a server. They are no operating services by themselves so
>>> they do not automatically appear after a server restart, unless you
>>> ensure that the repository is started again, too.
>> that's what I want .. how I can start a repository again; respectively,
>> how can I restart all previously created repositories after a server
>> restart?
>>
>> cheers,
>>
>> steven
>>
>>> If, after starting a repository, you put it into an IManagedContainer
>>> you can query the container, as you try it below. But a repository does
>>> not automatically end up registered with such a container. You'd have to
>>> register it there for example with
>>> CDOServerUtil.addRepository(IManagedContainer, IRepository).
>>>
>>> You could also use the OSGi service registry or a Spring application
>>> context or your own mechanism...
>>>
>>> Cheers
>>> /Eike
>>>
>>> ----
>>> http://thegordian.blogspot.com
>>> http://twitter.com/eikestepper
>>>
>>>
>>>
>>> steven schrieb:
>>>> hi folks,
>>>>
>>>> how can I check if a cdo server already contains a repository?
>>>>
>>>> my scenario is the following:
>>>>
>>>> 1. start server
>>>> 2. create repository "repo1"
>>>> 3. shutdown server
>>>> 4. restart server
>>>> 5. open "repo1"
>>>>
>>>> I tried the following:
>>>>
>>>> IRepository repository = CDOServerUtil.getRepository(container,
>>>> repositoryName);
>>>> if(repository == null){
>>>> //create repo
>>>> }else{
>>>> //use existing repo
>>>> }
>>>>
>>>>
>>>> but I get an exception:
>>>>
>>>> org.eclipse.net4j.util.container.FactoryNotFoundException: Factory not
>>>> found: org.eclipse.emf.cdo.server.repositories[default]
>>>>
>>>>
>>>> cheers,
>>>>
>>>> steven
Re: [CDO] query server for existing repository [message #431550 is a reply to message #431545] Thu, 16 July 2009 04:59 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Steven,

Neither CDOResources nor CDOResourceFolders should be created manually
by you. You should never use EresourceFactory directly.

CDOResources are created automatically, either with
ResourceSet.createResource(uri), CDOTransaction.createResource(path) or
CDOTransaction.getOrCreateResource(path). CDOResourceFolders are created
implicitely when you create a CDOResource with slashes in its path.

Please try this:

protected void createRepositoryStructure() {
CDOTransaction transaction = session.openTransaction();
transaction.getOrCreateResource(SOL_ARCH_FOLDER_NAME +
"/SolArchResource");
transaction.commit();
transaction.close();
}

Or this, if you need access to the folder:

protected void createRepositoryStructure() {
CDOTransaction transaction = session.openTransaction();
CDOResource solArchResource =
transaction.getOrCreateResource(SOL_ARCH_FOLDER_NAME + "/SolArchResource");
CDOResourceFolder solArchFolder = solArchResource.getFolder();
solArchFolder.xyz();

transaction.commit();
transaction.close();
}


Does this help?

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper


steven schrieb:
>
> eike,
>
> I am executing the same java statements, but if I stop the server
> in the osgi console and start it again, I get the exception I appended
> at the end.
> the exception is thrown when I check if my repository's structure has
> already been created:
>
> protected void createRepositoryStructure() {
> CDOTransaction transaction = null;
> if(!view.hasResource(SOL_ARCH_FOLDER_NAME)){//exception thrown here
> transaction = session.openTransaction();
> CDOResourceFolder solArchfolder =
> EresourceFactory.eINSTANCE.createCDOResourceFolder();
> solArchfolder.setName(SOL_ARCH_FOLDER_NAME);
> EList<EObject> rootContent =
> transaction.getRootResource().getContents();
> rootContent.add(solArchfolder);
> transaction.commit();
> transaction.close();
> }
> }
>
> so, initially the method createRepositoryStructure() works fine,
> but then it crashes with the following exception:
>
> [ERROR] EOFException
> java.io.EOFException
> at java.io.DataInputStream.readBoolean(DataInputStream.java:227 )
> at
> org.eclipse.net4j.util.io.ExtendedDataInput$Delegating.readB oolean(ExtendedDataInput.java:55)
>
> at
> org.eclipse.emf.cdo.internal.common.io.CDODataInputImpl.read CDORevision(CDODataInputImpl.java:214)
>
> at
> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:116)
>
> at
> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:1)
>
> at
> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientRequest .confirming(CDOClientRequest.java:77)
>
> at
> org.eclipse.net4j.signal.RequestWithConfirmation.doExtendedI nput(RequestWithConfirmation.java:123)
>
> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
> at
> org.eclipse.net4j.signal.RequestWithConfirmation.doExecute(R equestWithConfirmation.java:103)
>
> at org.eclipse.net4j.signal.SignalActor.execute(SignalActor.jav a:66)
> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
> at
> org.eclipse.net4j.signal.SignalProtocol.startSignal(SignalPr otocol.java:421)
>
> at
> org.eclipse.net4j.signal.RequestWithConfirmation.doSend(Requ estWithConfirmation.java:87)
>
> at
> org.eclipse.net4j.signal.RequestWithConfirmation.send(Reques tWithConfirmation.java:73)
>
>
> at
> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:286)
>
> at
> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:319)
>
> at
> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.loadRevisions(CDOClientProtocol.java:110)
>
> at
> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevisions(CDORevisionManagerImpl.java:124)
>
> at
> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevision(CDORevisionManagerImpl.java:106)
>
> at
> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:155)
>
> at
> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:1)
>
> at
> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getRevision(CD OViewImpl.java:682)
>
> at
> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getLocalRevisi on(CDOViewImpl.java:561)
>
> at
> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:508)
>
> at
> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eIDChecked(CDOViewImpl.java:447)
>
> at
> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:435)
>
> at
> org.eclipse.emf.internal.cdo.view.CDOViewImpl.hasResource(CD OViewImpl.java:376)
>
> at
> de.hpi.sam.mdcm.cmdb.repository.Repository.createRepositoryS tructure(Repository.java:49)
>
> at
> de.hpi.sam.mdcm.cmdb.repository.Repository.<init>(Repository.java:31)
> at
> de.hpi.sam.mdcm.cmdb.server.internal.CMDBServer.createReposi tory(CMDBServer.java:138)
>
> at
> de.hpi.sam.mdcm.cmdb.server.internal.Activator.start(Activat or.java:38)
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:1009)
>
> at java.security.AccessController.doPrivileged(Native Method)
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:1003)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:984)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
>
> at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:265)
>
> at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:257)
>
> at
> org.eclipse.osgi.framework.internal.core.FrameworkCommandPro vider._start(FrameworkCommandProvider.java:257)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:150)
>
> at
> org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:302)
>
> at
> org.eclipse.osgi.framework.internal.core.FrameworkConsole.co nsole(FrameworkConsole.java:287)
>
> at
> org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:223)
>
> at java.lang.Thread.run(Thread.java:619)
> !ENTRY org.eclipse.net4j 4 0 2009-07-15 12:09:16.179
> !MESSAGE EOFException
> !STACK 0
> java.io.EOFException
> at java.io.DataInputStream.readBoolean(DataInputStream.java:227 )
> at
> org.eclipse.net4j.util.io.ExtendedDataInput$Delegating.readB oolean(ExtendedDataInput.java:55)
>
> at
> org.eclipse.emf.cdo.internal.common.io.CDODataInputImpl.read CDORevision(CDODataInputImpl.java:214)
>
> at
> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:116)
>
> at
> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:1)
>
> at
> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientRequest .confirming(CDOClientRequest.java:77)
>
> at
> org.eclipse.net4j.signal.RequestWithConfirmation.doExtendedI nput(RequestWithConfirmation.java:123)
>
> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
> at
> org.eclipse.net4j.signal.RequestWithConfirmation.doExecute(R equestWithConfirmation.java:103)
>
> at org.eclipse.net4j.signal.SignalActor.execute(SignalActor.jav a:66)
> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
> at
> org.eclipse.net4j.signal.SignalProtocol.startSignal(SignalPr otocol.java:421)
>
> at
> org.eclipse.net4j.signal.RequestWithConfirmation.doSend(Requ estWithConfirmation.java:87)
>
> at
> org.eclipse.net4j.signal.RequestWithConfirmation.send(Reques tWithConfirmation.java:73)
>
> at
> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:286)
>
> at
> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:319)
>
> at
> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.loadRevisions(CDOClientProtocol.java:110)
>
> at
> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevisions(CDORevisionManagerImpl.java:124)
>
> at
> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevision(CDORevisionManagerImpl.java:106)
>
> at
> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:155)
>
> at
> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:1)
>
> at
> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getRevision(CD OViewImpl.java:682)
>
> at
> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getLocalRevisi on(CDOViewImpl.java:561)
>
> at
> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:508)
>
> at
> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eIDChecked(CDOViewImpl.java:447)
>
> at
> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:435)
>
> at
> org.eclipse.emf.internal.cdo.view.CDOViewImpl.hasResource(CD OViewImpl.java:376)
>
> at
> de.hpi.sam.mdcm.cmdb.repository.Repository.createRepositoryS tructure(Repository.java:49)
>
> at
> de.hpi.sam.mdcm.cmdb.repository.Repository.<init>(Repository.java:31)
> at
> de.hpi.sam.mdcm.cmdb.server.internal.CMDBServer.createReposi tory(CMDBServer.java:138)
>
> at
> de.hpi.sam.mdcm.cmdb.server.internal.Activator.start(Activat or.java:38)
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:1009)
>
> at java.security.AccessController.doPrivileged(Native Method)
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:1003)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:984)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
>
> at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:265)
>
> at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:257)
>
> at
> org.eclipse.osgi.framework.internal.core.FrameworkCommandPro vider._start(FrameworkCommandProvider.java:257)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:150)
>
> at
> org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:302)
>
> at
> org.eclipse.osgi.framework.internal.core.FrameworkConsole.co nsole(FrameworkConsole.java:287)
>
> at
> org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:223)
>
> at java.lang.Thread.run(Thread.java:619)
>
>
> what am I missing?
>
>
> cheers,
>
> steven
>
>
> Eike Stepper wrote:
>> Steven,
>>
>> There is no magic in CDO that does this automatically. *You* must do
>> that by executing the same Java statements that you initially executed.
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>>
>> steven schrieb:
>>> eike,
>>>
>>> comments below ..
>>>
>>> Eike Stepper wrote:
>>>> Steven,
>>>>
>>>> There's no single and mandatory way to create repositories or make
>>>> them
>>>> available on a server. They are no operating services by themselves so
>>>> they do not automatically appear after a server restart, unless you
>>>> ensure that the repository is started again, too.
>>> that's what I want .. how I can start a repository again; respectively,
>>> how can I restart all previously created repositories after a server
>>> restart?
>>>
>>> cheers,
>>>
>>> steven
>>>
>>>> If, after starting a repository, you put it into an IManagedContainer
>>>> you can query the container, as you try it below. But a repository
>>>> does
>>>> not automatically end up registered with such a container. You'd
>>>> have to
>>>> register it there for example with
>>>> CDOServerUtil.addRepository(IManagedContainer, IRepository).
>>>>
>>>> You could also use the OSGi service registry or a Spring application
>>>> context or your own mechanism...
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>> ----
>>>> http://thegordian.blogspot.com
>>>> http://twitter.com/eikestepper
>>>>
>>>>
>>>>
>>>> steven schrieb:
>>>>> hi folks,
>>>>>
>>>>> how can I check if a cdo server already contains a repository?
>>>>>
>>>>> my scenario is the following:
>>>>>
>>>>> 1. start server
>>>>> 2. create repository "repo1"
>>>>> 3. shutdown server
>>>>> 4. restart server
>>>>> 5. open "repo1"
>>>>>
>>>>> I tried the following:
>>>>>
>>>>> IRepository repository = CDOServerUtil.getRepository(container,
>>>>> repositoryName);
>>>>> if(repository == null){
>>>>> //create repo
>>>>> }else{
>>>>> //use existing repo
>>>>> }
>>>>>
>>>>>
>>>>> but I get an exception:
>>>>>
>>>>> org.eclipse.net4j.util.container.FactoryNotFoundException: Factory
>>>>> not
>>>>> found: org.eclipse.emf.cdo.server.repositories[default]
>>>>>
>>>>>
>>>>> cheers,
>>>>>
>>>>> steven


Re: [CDO] query server for existing repository [message #431559 is a reply to message #431550] Thu, 16 July 2009 14:56 Go to previous messageGo to next message
steven is currently offline stevenFriend
Messages: 8
Registered: July 2009
Junior Member
eike,

it helped!
but .. I am having a different problem:

I can store some models on the server properly, but
after some (the concrete number is not deterministic) models
have been inserted I get the following exception:

[ERROR] Rollback in DBStore: org.eclipse.net4j.db.DBException: SQL
Exception: A lock could not be obtained within the time requested
at
org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ob jectTypeCache.putObjectType(ObjectTypeCache.java:137)
at
org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ab stractHorizontalMappingStrategy.putObjectType(AbstractHorizo ntalMappingStrategy.java:69)
at
org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ab stractHorizontalClassMapping.writeRevision(AbstractHorizonta lClassMapping.java:326)
at
org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write Revision(DBStoreAccessor.java:355)
at
org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write Revisions(DBStoreAccessor.java:337)
at
org.eclipse.emf.cdo.spi.server.StoreAccessor.write(StoreAcce ssor.java:142)
at
org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.acces s$4(DBStoreAccessor.java:1)
at
org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor$1.run Loop(DBStoreAccessor.java:80)
at
org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor$1.run Loop(DBStoreAccessor.java:1)
at
org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(Pr ogressDistributor.java:96)
at
org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write (DBStoreAccessor.java:294)
at
org.eclipse.emf.cdo.internal.server.TransactionCommitContext Impl.write(TransactionCommitContextImpl.java:269)
at
org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication$1.runLoop(CommitTransactionIndication.java:73)
at
org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication$1.runLoop(CommitTransactionIndication.java:1)
at
org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(Pr ogressDistributor.java:96)
at
org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication.indicatingCommit(CommitTransactionIndication.ja va:325)
at
org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication.indicating(CommitTransactionIndication.java:198 )
at
org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication.indicating(CommitTransactionIndication.java:140 )
at
org.eclipse.net4j.signal.IndicationWithMonitoring.indicating (IndicationWithMonitoring.java:84)
at
org.eclipse.net4j.signal.IndicationWithResponse.doExtendedIn put(IndicationWithResponse.java:90)
at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
at
org.eclipse.net4j.signal.IndicationWithResponse.execute(Indi cationWithResponse.java:63)
at
org.eclipse.net4j.signal.IndicationWithMonitoring.execute(In dicationWithMonitoring.java:63)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Threa dPoolExecutor.java:885)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo lExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: SQL Exception: A lock could not be obtained within the time
requested
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unkno wn Source)
at
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQL Exception(Unknown
Source)
at
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleExc eption(Unknown
Source)
at org.apache.derby.impl.jdbc.EmbedConnection.handleException(U nknown
Source)
at org.apache.derby.impl.jdbc.ConnectionChild.handleException(U nknown
Source)
at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(U nknown
Source)
at
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeSta tement(Unknown
Source)
at
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpd ate(Unknown
Source)
at
org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ob jectTypeCache.putObjectType(ObjectTypeCache.java:128)
... 27 more


why the lock not be obtained, although some models could be stored?


cheers,

steven

Eike Stepper wrote:
> Steven,
>
> Neither CDOResources nor CDOResourceFolders should be created manually
> by you. You should never use EresourceFactory directly.
>
> CDOResources are created automatically, either with
> ResourceSet.createResource(uri), CDOTransaction.createResource(path) or
> CDOTransaction.getOrCreateResource(path). CDOResourceFolders are created
> implicitely when you create a CDOResource with slashes in its path.
>
> Please try this:
>
> protected void createRepositoryStructure() {
> CDOTransaction transaction = session.openTransaction();
> transaction.getOrCreateResource(SOL_ARCH_FOLDER_NAME +
> "/SolArchResource");
> transaction.commit();
> transaction.close();
> }
>
> Or this, if you need access to the folder:
>
> protected void createRepositoryStructure() {
> CDOTransaction transaction = session.openTransaction();
> CDOResource solArchResource =
> transaction.getOrCreateResource(SOL_ARCH_FOLDER_NAME + "/SolArchResource");
> CDOResourceFolder solArchFolder = solArchResource.getFolder();
> solArchFolder.xyz();
>
> transaction.commit();
> transaction.close();
> }
>
>
> Does this help?
>
> Cheers
> /Eike
>
> ----
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
> steven schrieb:
>> eike,
>>
>> I am executing the same java statements, but if I stop the server
>> in the osgi console and start it again, I get the exception I appended
>> at the end.
>> the exception is thrown when I check if my repository's structure has
>> already been created:
>>
>> protected void createRepositoryStructure() {
>> CDOTransaction transaction = null;
>> if(!view.hasResource(SOL_ARCH_FOLDER_NAME)){//exception thrown here
>> transaction = session.openTransaction();
>> CDOResourceFolder solArchfolder =
>> EresourceFactory.eINSTANCE.createCDOResourceFolder();
>> solArchfolder.setName(SOL_ARCH_FOLDER_NAME);
>> EList<EObject> rootContent =
>> transaction.getRootResource().getContents();
>> rootContent.add(solArchfolder);
>> transaction.commit();
>> transaction.close();
>> }
>> }
>>
>> so, initially the method createRepositoryStructure() works fine,
>> but then it crashes with the following exception:
>>
>> [ERROR] EOFException
>> java.io.EOFException
>> at java.io.DataInputStream.readBoolean(DataInputStream.java:227 )
>> at
>> org.eclipse.net4j.util.io.ExtendedDataInput$Delegating.readB oolean(ExtendedDataInput.java:55)
>>
>> at
>> org.eclipse.emf.cdo.internal.common.io.CDODataInputImpl.read CDORevision(CDODataInputImpl.java:214)
>>
>> at
>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:116)
>>
>> at
>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:1)
>>
>> at
>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientRequest .confirming(CDOClientRequest.java:77)
>>
>> at
>> org.eclipse.net4j.signal.RequestWithConfirmation.doExtendedI nput(RequestWithConfirmation.java:123)

>>
>> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
>> at
>> org.eclipse.net4j.signal.RequestWithConfirmation.doExecute(R equestWithConfirmation.java:103)
>>
>> at org.eclipse.net4j.signal.SignalActor.execute(SignalActor.jav a:66)
>> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
>> at
>> org.eclipse.net4j.signal.SignalProtocol.startSignal(SignalPr otocol.java:421)
>>
>> at
>> org.eclipse.net4j.signal.RequestWithConfirmation.doSend(Requ estWithConfirmation.java:87)
>>
>> at
>> org.eclipse.net4j.signal.RequestWithConfirmation.send(Reques tWithConfirmation.java:73)
>>
>>
>> at
>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:286)
>>
>> at
>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:319)
>>
>> at
>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.loadRevisions(CDOClientProtocol.java:110)
>>
>> at
>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevisions(CDORevisionManagerImpl.java:124)
>>
>> at
>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevision(CDORevisionManagerImpl.java:106)
>>
>> at
>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:155)
>>
>> at
>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:1)
>>
>> at
>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getRevision(CD OViewImpl.java:682)
>>
>> at
>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getLocalRevisi on(CDOViewImpl.java:561)
>>
>> at
>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:508)
>>
>> at
>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eIDChecked(CDOViewImpl.java:447)
>>
>> at
>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:435)
>>
>> at
>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.hasResource(CD OViewImpl.java:376)
>>
>> at
>> de.hpi.sam.mdcm.cmdb.repository.Repository.createRepositoryS tructure(Repository.java:49)
>>
>> at
>> de.hpi.sam.mdcm.cmdb.repository.Repository.<init>(Repository.java:31)
>> at
>> de.hpi.sam.mdcm.cmdb.server.internal.CMDBServer.createReposi tory(CMDBServer.java:138)
>>
>> at
>> de.hpi.sam.mdcm.cmdb.server.internal.Activator.start(Activat or.java:38)
>> at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:1009)
>>
>> at java.security.AccessController.doPrivileged(Native Method)
>> at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:1003)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:984)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:265)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:257)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkCommandPro vider._start(FrameworkCommandProvider.java:257)
>>
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>>
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>>
>> at java.lang.reflect.Method.invoke(Method.java:597)
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:150)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:302)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.co nsole(FrameworkConsole.java:287)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:223)
>>
>> at java.lang.Thread.run(Thread.java:619)
>> !ENTRY org.eclipse.net4j 4 0 2009-07-15 12:09:16.179
>> !MESSAGE EOFException
>> !STACK 0
>> java.io.EOFException
>> at java.io.DataInputStream.readBoolean(DataInputStream.java:227 )
>> at
>> org.eclipse.net4j.util.io.ExtendedDataInput$Delegating.readB oolean(ExtendedDataInput.java:55)
>>
>> at
>> org.eclipse.emf.cdo.internal.common.io.CDODataInputImpl.read CDORevision(CDODataInputImpl.java:214)
>>
>> at
>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:116)
>>
>> at
>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:1)
>>
>> at
>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientRequest .confirming(CDOClientRequest.java:77)
>>
>> at
>> org.eclipse.net4j.signal.RequestWithConfirmation.doExtendedI nput(RequestWithConfirmation.java:123)
>>
>> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
>> at
>> org.eclipse.net4j.signal.RequestWithConfirmation.doExecute(R equestWithConfirmation.java:103)
>>
>> at org.eclipse.net4j.signal.SignalActor.execute(SignalActor.jav a:66)
>> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
>> at
>> org.eclipse.net4j.signal.SignalProtocol.startSignal(SignalPr otocol.java:421)
>>
>> at
>> org.eclipse.net4j.signal.RequestWithConfirmation.doSend(Requ estWithConfirmation.java:87)
>>
>> at
>> org.eclipse.net4j.signal.RequestWithConfirmation.send(Reques tWithConfirmation.java:73)
>>
>> at
>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:286)
>>
>> at
>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:319)
>>
>> at
>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.loadRevisions(CDOClientProtocol.java:110)
>>
>> at
>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevisions(CDORevisionManagerImpl.java:124)
>>
>> at
>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevision(CDORevisionManagerImpl.java:106)
>>
>> at
>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:155)
>>
>> at
>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:1)
>>
>> at
>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getRevision(CD OViewImpl.java:682)
>>
>> at
>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getLocalRevisi on(CDOViewImpl.java:561)
>>
>> at
>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:508)
>>
>> at
>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eIDChecked(CDOViewImpl.java:447)
>>
>> at
>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:435)
>>
>> at
>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.hasResource(CD OViewImpl.java:376)
>>
>> at
>> de.hpi.sam.mdcm.cmdb.repository.Repository.createRepositoryS tructure(Repository.java:49)
>>
>> at
>> de.hpi.sam.mdcm.cmdb.repository.Repository.<init>(Repository.java:31)
>> at
>> de.hpi.sam.mdcm.cmdb.server.internal.CMDBServer.createReposi tory(CMDBServer.java:138)
>>
>> at
>> de.hpi.sam.mdcm.cmdb.server.internal.Activator.start(Activat or.java:38)
>> at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:1009)
>>
>> at java.security.AccessController.doPrivileged(Native Method)
>> at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:1003)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:984)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:265)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:257)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkCommandPro vider._start(FrameworkCommandProvider.java:257)
>>
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>>
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>>
>> at java.lang.reflect.Method.invoke(Method.java:597)
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:150)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:302)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.co nsole(FrameworkConsole.java:287)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:223)
>>
>> at java.lang.Thread.run(Thread.java:619)
>>
>>
>> what am I missing?
>>
>>
>> cheers,
>>
>> steven
>>
>>
>> Eike Stepper wrote:
>>> Steven,
>>>
>>> There is no magic in CDO that does this automatically. *You* must do
>>> that by executing the same Java statements that you initially executed.
>>>
>>> Cheers
>>> /Eike
>>>
>>> ----
>>> http://thegordian.blogspot.com
>>> http://twitter.com/eikestepper
>>>
>>>
>>>
>>> steven schrieb:
>>>> eike,
>>>>
>>>> comments below ..
>>>>
>>>> Eike Stepper wrote:
>>>>> Steven,
>>>>>
>>>>> There's no single and mandatory way to create repositories or make
>>>>> them
>>>>> available on a server. They are no operating services by themselves so
>>>>> they do not automatically appear after a server restart, unless you
>>>>> ensure that the repository is started again, too.
>>>> that's what I want .. how I can start a repository again; respectively,
>>>> how can I restart all previously created repositories after a server
>>>> restart?
>>>>
>>>> cheers,
>>>>
>>>> steven
>>>>
>>>>> If, after starting a repository, you put it into an IManagedContainer
>>>>> you can query the container, as you try it below. But a repository
>>>>> does
>>>>> not automatically end up registered with such a container. You'd
>>>>> have to
>>>>> register it there for example with
>>>>> CDOServerUtil.addRepository(IManagedContainer, IRepository).
>>>>>
>>>>> You could also use the OSGi service registry or a Spring application
>>>>> context or your own mechanism...
>>>>>
>>>>> Cheers
>>>>> /Eike
>>>>>
>>>>> ----
>>>>> http://thegordian.blogspot.com
>>>>> http://twitter.com/eikestepper
>>>>>
>>>>>
>>>>>
>>>>> steven schrieb:
>>>>>> hi folks,
>>>>>>
>>>>>> how can I check if a cdo server already contains a repository?
>>>>>>
>>>>>> my scenario is the following:
>>>>>>
>>>>>> 1. start server
>>>>>> 2. create repository "repo1"
>>>>>> 3. shutdown server
>>>>>> 4. restart server
>>>>>> 5. open "repo1"
>>>>>>
>>>>>> I tried the following:
>>>>>>
>>>>>> IRepository repository = CDOServerUtil.getRepository(container,
>>>>>> repositoryName);
>>>>>> if(repository == null){
>>>>>> //create repo
>>>>>> }else{
>>>>>> //use existing repo
>>>>>> }
>>>>>>
>>>>>>
>>>>>> but I get an exception:
>>>>>>
>>>>>> org.eclipse.net4j.util.container.FactoryNotFoundException: Factory
>>>>>> not
>>>>>> found: org.eclipse.emf.cdo.server.repositories[default]
>>>>>>
>>>>>>
>>>>>> cheers,
>>>>>>
>>>>>> steven
Re: [CDO] query server for existing repository [message #431564 is a reply to message #431559] Thu, 16 July 2009 17:03 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Steven,

I avguely remember a similar problem in our Derby based tests but I
can't remember the reason anymore. Stefan?

Have you considered using H2 instead of Derby? Additional benefit would
be performance boost of factor 2 to 10:

http://markmail.org/message/7zrgefmi7gi24t7d
http://www.encorewiki.org/display/encore/Open+Source+Databas es+Comparison

steven schrieb:
>
> eike,
>
> it helped!
> but .. I am having a different problem:
>
> I can store some models on the server properly, but
> after some (the concrete number is not deterministic) models
> have been inserted I get the following exception:
>
> [ERROR] Rollback in DBStore: org.eclipse.net4j.db.DBException: SQL
> Exception: A lock could not be obtained within the time requested
> at
> org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ob jectTypeCache.putObjectType(ObjectTypeCache.java:137)
>
> at
> org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ab stractHorizontalMappingStrategy.putObjectType(AbstractHorizo ntalMappingStrategy.java:69)
>
> at
> org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ab stractHorizontalClassMapping.writeRevision(AbstractHorizonta lClassMapping.java:326)
>
> at
> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write Revision(DBStoreAccessor.java:355)
>
> at
> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write Revisions(DBStoreAccessor.java:337)
>
> at
> org.eclipse.emf.cdo.spi.server.StoreAccessor.write(StoreAcce ssor.java:142)
>
> at
> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.acces s$4(DBStoreAccessor.java:1)
>
> at
> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor$1.run Loop(DBStoreAccessor.java:80)
>
> at
> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor$1.run Loop(DBStoreAccessor.java:1)
>
> at
> org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(Pr ogressDistributor.java:96)
>
> at
> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write (DBStoreAccessor.java:294)
>
> at
> org.eclipse.emf.cdo.internal.server.TransactionCommitContext Impl.write(TransactionCommitContextImpl.java:269)
>
> at
> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication$1.runLoop(CommitTransactionIndication.java:73)
>
> at
> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication$1.runLoop(CommitTransactionIndication.java:1)
>
> at
> org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(Pr ogressDistributor.java:96)
>
> at
> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication.indicatingCommit(CommitTransactionIndication.ja va:325)
>
> at
> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication.indicating(CommitTransactionIndication.java:198 )
>
> at
> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication.indicating(CommitTransactionIndication.java:140 )
>
> at
> org.eclipse.net4j.signal.IndicationWithMonitoring.indicating (IndicationWithMonitoring.java:84)
>
> at
> org.eclipse.net4j.signal.IndicationWithResponse.doExtendedIn put(IndicationWithResponse.java:90)
>
> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
> at
> org.eclipse.net4j.signal.IndicationWithResponse.execute(Indi cationWithResponse.java:63)
>
> at
> org.eclipse.net4j.signal.IndicationWithMonitoring.execute(In dicationWithMonitoring.java:63)
>
> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
> at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Threa dPoolExecutor.java:885)
>
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo lExecutor.java:907)
>
> at java.lang.Thread.run(Thread.java:619)
> Caused by: SQL Exception: A lock could not be obtained within the time
> requested
> at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unkno wn
> Source)
> at
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQL Exception(Unknown
> Source)
> at
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleExc eption(Unknown
> Source)
> at
> org.apache.derby.impl.jdbc.EmbedConnection.handleException(U nknown
> Source)
> at
> org.apache.derby.impl.jdbc.ConnectionChild.handleException(U nknown
> Source)
> at
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(U nknown
> Source)
> at
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeSta tement(Unknown
> Source)
> at
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpd ate(Unknown
> Source)
> at
> org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ob jectTypeCache.putObjectType(ObjectTypeCache.java:128)
>
> ... 27 more
>
>
> why the lock not be obtained, although some models could be stored?
>
>
> cheers,
>
> steven
>
> Eike Stepper wrote:
>> Steven,
>>
>> Neither CDOResources nor CDOResourceFolders should be created manually
>> by you. You should never use EresourceFactory directly.
>>
>> CDOResources are created automatically, either with
>> ResourceSet.createResource(uri), CDOTransaction.createResource(path) or
>> CDOTransaction.getOrCreateResource(path). CDOResourceFolders are created
>> implicitely when you create a CDOResource with slashes in its path.
>>
>> Please try this:
>>
>> protected void createRepositoryStructure() {
>> CDOTransaction transaction = session.openTransaction();
>> transaction.getOrCreateResource(SOL_ARCH_FOLDER_NAME +
>> "/SolArchResource");
>> transaction.commit();
>> transaction.close();
>> }
>>
>> Or this, if you need access to the folder:
>>
>> protected void createRepositoryStructure() {
>> CDOTransaction transaction = session.openTransaction();
>> CDOResource solArchResource =
>> transaction.getOrCreateResource(SOL_ARCH_FOLDER_NAME +
>> "/SolArchResource");
>> CDOResourceFolder solArchFolder = solArchResource.getFolder();
>> solArchFolder.xyz();
>>
>> transaction.commit();
>> transaction.close();
>> }
>>
>>
>> Does this help?
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>> steven schrieb:
>>> eike,
>>>
>>> I am executing the same java statements, but if I stop the server
>>> in the osgi console and start it again, I get the exception I appended
>>> at the end.
>>> the exception is thrown when I check if my repository's structure has
>>> already been created:
>>>
>>> protected void createRepositoryStructure() {
>>> CDOTransaction transaction = null;
>>> if(!view.hasResource(SOL_ARCH_FOLDER_NAME)){//exception thrown here
>>> transaction = session.openTransaction();
>>> CDOResourceFolder solArchfolder =
>>> EresourceFactory.eINSTANCE.createCDOResourceFolder();
>>> solArchfolder.setName(SOL_ARCH_FOLDER_NAME);
>>> EList<EObject> rootContent =
>>> transaction.getRootResource().getContents();
>>> rootContent.add(solArchfolder);
>>> transaction.commit();
>>> transaction.close();
>>> }
>>> }
>>>
>>> so, initially the method createRepositoryStructure() works fine,
>>> but then it crashes with the following exception:
>>>
>>> [ERROR] EOFException
>>> java.io.EOFException
>>> at java.io.DataInputStream.readBoolean(DataInputStream.java:227 )
>>> at
>>> org.eclipse.net4j.util.io.ExtendedDataInput$Delegating.readB oolean(ExtendedDataInput.java:55)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.common.io.CDODataInputImpl.read CDORevision(CDODataInputImpl.java:214)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:116)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:1)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientRequest .confirming(CDOClientRequest.java:77)
>>>
>>>
>>> at
>>> org.eclipse.net4j.signal.RequestWithConfirmation.doExtendedI nput(RequestWithConfirmation.java:123)
>>>
>
>>>
>>> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
>>> at
>>> org.eclipse.net4j.signal.RequestWithConfirmation.doExecute(R equestWithConfirmation.java:103)
>>>
>>>
>>> at
>>> org.eclipse.net4j.signal.SignalActor.execute(SignalActor.jav a:66)
>>> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
>>> at
>>> org.eclipse.net4j.signal.SignalProtocol.startSignal(SignalPr otocol.java:421)
>>>
>>>
>>> at
>>> org.eclipse.net4j.signal.RequestWithConfirmation.doSend(Requ estWithConfirmation.java:87)
>>>
>>>
>>> at
>>> org.eclipse.net4j.signal.RequestWithConfirmation.send(Reques tWithConfirmation.java:73)
>>>
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:286)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:319)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.loadRevisions(CDOClientProtocol.java:110)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevisions(CDORevisionManagerImpl.java:124)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevision(CDORevisionManagerImpl.java:106)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:155)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:1)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getRevision(CD OViewImpl.java:682)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getLocalRevisi on(CDOViewImpl.java:561)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:508)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eIDChecked(CDOViewImpl.java:447)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:435)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.hasResource(CD OViewImpl.java:376)
>>>
>>>
>>> at
>>> de.hpi.sam.mdcm.cmdb.repository.Repository.createRepositoryS tructure(Repository.java:49)
>>>
>>>
>>> at
>>> de.hpi.sam.mdcm.cmdb.repository.Repository.<init>(Repository.java:31)
>>> at
>>> de.hpi.sam.mdcm.cmdb.server.internal.CMDBServer.createReposi tory(CMDBServer.java:138)
>>>
>>>
>>> at
>>> de.hpi.sam.mdcm.cmdb.server.internal.Activator.start(Activat or.java:38)
>>> at
>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:1009)
>>>
>>>
>>> at java.security.AccessController.doPrivileged(Native Method)
>>> at
>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:1003)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:984)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:265)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:257)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.FrameworkCommandPro vider._start(FrameworkCommandProvider.java:257)
>>>
>>>
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>>>
>>>
>>> at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>>>
>>>
>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>> at
>>> org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:150)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:302)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.co nsole(FrameworkConsole.java:287)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:223)
>>>
>>>
>>> at java.lang.Thread.run(Thread.java:619)
>>> !ENTRY org.eclipse.net4j 4 0 2009-07-15 12:09:16.179
>>> !MESSAGE EOFException
>>> !STACK 0
>>> java.io.EOFException
>>> at java.io.DataInputStream.readBoolean(DataInputStream.java:227 )
>>> at
>>> org.eclipse.net4j.util.io.ExtendedDataInput$Delegating.readB oolean(ExtendedDataInput.java:55)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.common.io.CDODataInputImpl.read CDORevision(CDODataInputImpl.java:214)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:116)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:1)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientRequest .confirming(CDOClientRequest.java:77)
>>>
>>>
>>> at
>>> org.eclipse.net4j.signal.RequestWithConfirmation.doExtendedI nput(RequestWithConfirmation.java:123)
>>>
>>>
>>> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
>>> at
>>> org.eclipse.net4j.signal.RequestWithConfirmation.doExecute(R equestWithConfirmation.java:103)
>>>
>>>
>>> at
>>> org.eclipse.net4j.signal.SignalActor.execute(SignalActor.jav a:66)
>>> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
>>> at
>>> org.eclipse.net4j.signal.SignalProtocol.startSignal(SignalPr otocol.java:421)
>>>
>>>
>>> at
>>> org.eclipse.net4j.signal.RequestWithConfirmation.doSend(Requ estWithConfirmation.java:87)
>>>
>>>
>>> at
>>> org.eclipse.net4j.signal.RequestWithConfirmation.send(Reques tWithConfirmation.java:73)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:286)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:319)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.loadRevisions(CDOClientProtocol.java:110)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevisions(CDORevisionManagerImpl.java:124)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevision(CDORevisionManagerImpl.java:106)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:155)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:1)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getRevision(CD OViewImpl.java:682)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getLocalRevisi on(CDOViewImpl.java:561)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:508)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eIDChecked(CDOViewImpl.java:447)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:435)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.hasResource(CD OViewImpl.java:376)
>>>
>>>
>>> at
>>> de.hpi.sam.mdcm.cmdb.repository.Repository.createRepositoryS tructure(Repository.java:49)
>>>
>>>
>>> at
>>> de.hpi.sam.mdcm.cmdb.repository.Repository.<init>(Repository.java:31)
>>> at
>>> de.hpi.sam.mdcm.cmdb.server.internal.CMDBServer.createReposi tory(CMDBServer.java:138)
>>>
>>>
>>> at
>>> de.hpi.sam.mdcm.cmdb.server.internal.Activator.start(Activat or.java:38)
>>> at
>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:1009)
>>>
>>>
>>> at java.security.AccessController.doPrivileged(Native Method)
>>> at
>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:1003)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:984)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:265)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:257)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.FrameworkCommandPro vider._start(FrameworkCommandProvider.java:257)
>>>
>>>
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>>>
>>>
>>> at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>>>
>>>
>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>> at
>>> org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:150)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:302)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.co nsole(FrameworkConsole.java:287)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:223)
>>>
>>>
>>> at java.lang.Thread.run(Thread.java:619)
>>>
>>>
>>> what am I missing?
>>>
>>>
>>> cheers,
>>>
>>> steven
>>>
>>>
>>> Eike Stepper wrote:
>>>> Steven,
>>>>
>>>> There is no magic in CDO that does this automatically. *You* must do
>>>> that by executing the same Java statements that you initially
>>>> executed.
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>> ----
>>>> http://thegordian.blogspot.com
>>>> http://twitter.com/eikestepper
>>>>
>>>>
>>>>
>>>> steven schrieb:
>>>>> eike,
>>>>>
>>>>> comments below ..
>>>>>
>>>>> Eike Stepper wrote:
>>>>>> Steven,
>>>>>>
>>>>>> There's no single and mandatory way to create repositories or make
>>>>>> them
>>>>>> available on a server. They are no operating services by
>>>>>> themselves so
>>>>>> they do not automatically appear after a server restart, unless you
>>>>>> ensure that the repository is started again, too.
>>>>> that's what I want .. how I can start a repository again;
>>>>> respectively,
>>>>> how can I restart all previously created repositories after a server
>>>>> restart?
>>>>>
>>>>> cheers,
>>>>>
>>>>> steven
>>>>>
>>>>>> If, after starting a repository, you put it into an
>>>>>> IManagedContainer
>>>>>> you can query the container, as you try it below. But a repository
>>>>>> does
>>>>>> not automatically end up registered with such a container. You'd
>>>>>> have to
>>>>>> register it there for example with
>>>>>> CDOServerUtil.addRepository(IManagedContainer, IRepository).
>>>>>>
>>>>>> You could also use the OSGi service registry or a Spring application
>>>>>> context or your own mechanism...
>>>>>>
>>>>>> Cheers
>>>>>> /Eike
>>>>>>
>>>>>> ----
>>>>>> http://thegordian.blogspot.com
>>>>>> http://twitter.com/eikestepper
>>>>>>
>>>>>>
>>>>>>
>>>>>> steven schrieb:
>>>>>>> hi folks,
>>>>>>>
>>>>>>> how can I check if a cdo server already contains a repository?
>>>>>>>
>>>>>>> my scenario is the following:
>>>>>>>
>>>>>>> 1. start server
>>>>>>> 2. create repository "repo1"
>>>>>>> 3. shutdown server
>>>>>>> 4. restart server
>>>>>>> 5. open "repo1"
>>>>>>>
>>>>>>> I tried the following:
>>>>>>>
>>>>>>> IRepository repository = CDOServerUtil.getRepository(container,
>>>>>>> repositoryName);
>>>>>>> if(repository == null){
>>>>>>> //create repo
>>>>>>> }else{
>>>>>>> //use existing repo
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>> but I get an exception:
>>>>>>>
>>>>>>> org.eclipse.net4j.util.container.FactoryNotFoundException: Factory
>>>>>>> not
>>>>>>> found: org.eclipse.emf.cdo.server.repositories[default]
>>>>>>>
>>>>>>>
>>>>>>> cheers,
>>>>>>>
>>>>>>> steven


Re: [CDO] query server for existing repository [message #431572 is a reply to message #431559] Fri, 17 July 2009 08:29 Go to previous messageGo to next message
Stefan Winkler is currently offline Stefan WinklerFriend
Messages: 307
Registered: July 2009
Location: Germany
Senior Member
Hi steven,

that SQL Exception has occurred a few months ago - see Bug 276926:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=276926
Are you using Gallileo or an earlier Version?


If you are using galileo, can you describe the context a bit more?
Do you run a single-user application or are there other concurrent users?

The line in the stack trace does a "INSERT IGNORE INTO cdo_objects VALUES
(cdoid, class_metaId).
The Derby documentation states that insert will acquire a row lock for
the new row.
I currently don't understand why acquiring such a lock could cause a
deadlock. :-(

The only thing which could be possible would be:

"Derby locks single rows for INSERT statements, holding each row until
the transaction is committed. (If there is an index associated with the
table, the previous key is also locked.)"
[ http://db.apache.org/derby/docs/10.0/manuals/develop/develop 74.html]

So the previous key (cdo_id) is also locked. If that key is not locked
as part of the current transaction, but as part of another transaction,
the current transaction waits for the other transaction to finish. If
this times out (derby standard is 10s, AFAIK), you get the said Exception.


So, do you think this case is possible? Do you do huge transactions in
parallel?


Also, in order to analyse the problem, you could set the properties
derby.locks.monitor=true and *derby.language.logStatementText=true*
*then information about acquired locks and locks causing the deadlock
are written to derby.log.*
**
**
*Cheers,*
*Stefan*
**





steven schrieb:
>
> eike,
>
> it helped!
> but .. I am having a different problem:
>
> I can store some models on the server properly, but
> after some (the concrete number is not deterministic) models
> have been inserted I get the following exception:
>
> [ERROR] Rollback in DBStore: org.eclipse.net4j.db.DBException: SQL
> Exception: A lock could not be obtained within the time requested
> at
> org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ob jectTypeCache.putObjectType(ObjectTypeCache.java:137)
>
> at
> org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ab stractHorizontalMappingStrategy.putObjectType(AbstractHorizo ntalMappingStrategy.java:69)
>
> at
> org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ab stractHorizontalClassMapping.writeRevision(AbstractHorizonta lClassMapping.java:326)
>
> at
> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write Revision(DBStoreAccessor.java:355)
>
> at
> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write Revisions(DBStoreAccessor.java:337)
>
> at
> org.eclipse.emf.cdo.spi.server.StoreAccessor.write(StoreAcce ssor.java:142)
>
> at
> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.acces s$4(DBStoreAccessor.java:1)
>
> at
> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor$1.run Loop(DBStoreAccessor.java:80)
>
> at
> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor$1.run Loop(DBStoreAccessor.java:1)
>
> at
> org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(Pr ogressDistributor.java:96)
>
> at
> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write (DBStoreAccessor.java:294)
>
> at
> org.eclipse.emf.cdo.internal.server.TransactionCommitContext Impl.write(TransactionCommitContextImpl.java:269)
>
> at
> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication$1.runLoop(CommitTransactionIndication.java:73)
>
> at
> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication$1.runLoop(CommitTransactionIndication.java:1)
>
> at
> org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(Pr ogressDistributor.java:96)
>
> at
> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication.indicatingCommit(CommitTransactionIndication.ja va:325)
>
> at
> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication.indicating(CommitTransactionIndication.java:198 )
>
> at
> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication.indicating(CommitTransactionIndication.java:140 )
>
> at
> org.eclipse.net4j.signal.IndicationWithMonitoring.indicating (IndicationWithMonitoring.java:84)
>
> at
> org.eclipse.net4j.signal.IndicationWithResponse.doExtendedIn put(IndicationWithResponse.java:90)
>
> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
> at
> org.eclipse.net4j.signal.IndicationWithResponse.execute(Indi cationWithResponse.java:63)
>
> at
> org.eclipse.net4j.signal.IndicationWithMonitoring.execute(In dicationWithMonitoring.java:63)
>
> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
> at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Threa dPoolExecutor.java:885)
>
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo lExecutor.java:907)
>
> at java.lang.Thread.run(Thread.java:619)
> Caused by: SQL Exception: A lock could not be obtained within the time
> requested
> at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unkno wn
> Source)
> at
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQL Exception(Unknown
> Source)
> at
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleExc eption(Unknown
> Source)
> at
> org.apache.derby.impl.jdbc.EmbedConnection.handleException(U nknown
> Source)
> at
> org.apache.derby.impl.jdbc.ConnectionChild.handleException(U nknown
> Source)
> at
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(U nknown
> Source)
> at
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeSta tement(Unknown
> Source)
> at
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpd ate(Unknown
> Source)
> at
> org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ob jectTypeCache.putObjectType(ObjectTypeCache.java:128)
>
> ... 27 more
>
>
> why the lock not be obtained, although some models could be stored?
>
>
> cheers,
>
> steven
>
> Eike Stepper wrote:
>> Steven,
>>
>> Neither CDOResources nor CDOResourceFolders should be created manually
>> by you. You should never use EresourceFactory directly.
>>
>> CDOResources are created automatically, either with
>> ResourceSet.createResource(uri), CDOTransaction.createResource(path) or
>> CDOTransaction.getOrCreateResource(path). CDOResourceFolders are created
>> implicitely when you create a CDOResource with slashes in its path.
>>
>> Please try this:
>>
>> protected void createRepositoryStructure() {
>> CDOTransaction transaction = session.openTransaction();
>> transaction.getOrCreateResource(SOL_ARCH_FOLDER_NAME +
>> "/SolArchResource");
>> transaction.commit();
>> transaction.close();
>> }
>>
>> Or this, if you need access to the folder:
>>
>> protected void createRepositoryStructure() {
>> CDOTransaction transaction = session.openTransaction();
>> CDOResource solArchResource =
>> transaction.getOrCreateResource(SOL_ARCH_FOLDER_NAME +
>> "/SolArchResource");
>> CDOResourceFolder solArchFolder = solArchResource.getFolder();
>> solArchFolder.xyz();
>>
>> transaction.commit();
>> transaction.close();
>> }
>>
>>
>> Does this help?
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>> steven schrieb:
>>> eike,
>>>
>>> I am executing the same java statements, but if I stop the server
>>> in the osgi console and start it again, I get the exception I appended
>>> at the end.
>>> the exception is thrown when I check if my repository's structure has
>>> already been created:
>>>
>>> protected void createRepositoryStructure() {
>>> CDOTransaction transaction = null;
>>> if(!view.hasResource(SOL_ARCH_FOLDER_NAME)){//exception thrown here
>>> transaction = session.openTransaction();
>>> CDOResourceFolder solArchfolder =
>>> EresourceFactory.eINSTANCE.createCDOResourceFolder();
>>> solArchfolder.setName(SOL_ARCH_FOLDER_NAME);
>>> EList<EObject> rootContent =
>>> transaction.getRootResource().getContents();
>>> rootContent.add(solArchfolder);
>>> transaction.commit();
>>> transaction.close();
>>> }
>>> }
>>>
>>> so, initially the method createRepositoryStructure() works fine,
>>> but then it crashes with the following exception:
>>>
>>> [ERROR] EOFException
>>> java.io.EOFException
>>> at java.io.DataInputStream.readBoolean(DataInputStream.java:227 )
>>> at
>>> org.eclipse.net4j.util.io.ExtendedDataInput$Delegating.readB oolean(ExtendedDataInput.java:55)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.common.io.CDODataInputImpl.read CDORevision(CDODataInputImpl.java:214)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:116)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:1)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientRequest .confirming(CDOClientRequest.java:77)
>>>
>>>
>>> at
>>> org.eclipse.net4j.signal.RequestWithConfirmation.doExtendedI nput(RequestWithConfirmation.java:123)
>>>
>
>>>
>>> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
>>> at
>>> org.eclipse.net4j.signal.RequestWithConfirmation.doExecute(R equestWithConfirmation.java:103)
>>>
>>>
>>> at
>>> org.eclipse.net4j.signal.SignalActor.execute(SignalActor.jav a:66)
>>> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
>>> at
>>> org.eclipse.net4j.signal.SignalProtocol.startSignal(SignalPr otocol.java:421)
>>>
>>>
>>> at
>>> org.eclipse.net4j.signal.RequestWithConfirmation.doSend(Requ estWithConfirmation.java:87)
>>>
>>>
>>> at
>>> org.eclipse.net4j.signal.RequestWithConfirmation.send(Reques tWithConfirmation.java:73)
>>>
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:286)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:319)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.loadRevisions(CDOClientProtocol.java:110)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevisions(CDORevisionManagerImpl.java:124)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevision(CDORevisionManagerImpl.java:106)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:155)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:1)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getRevision(CD OViewImpl.java:682)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getLocalRevisi on(CDOViewImpl.java:561)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:508)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eIDChecked(CDOViewImpl.java:447)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:435)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.hasResource(CD OViewImpl.java:376)
>>>
>>>
>>> at
>>> de.hpi.sam.mdcm.cmdb.repository.Repository.createRepositoryS tructure(Repository.java:49)
>>>
>>>
>>> at
>>> de.hpi.sam.mdcm.cmdb.repository.Repository.<init>(Repository.java:31)
>>> at
>>> de.hpi.sam.mdcm.cmdb.server.internal.CMDBServer.createReposi tory(CMDBServer.java:138)
>>>
>>>
>>> at
>>> de.hpi.sam.mdcm.cmdb.server.internal.Activator.start(Activat or.java:38)
>>> at
>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:1009)
>>>
>>>
>>> at java.security.AccessController.doPrivileged(Native Method)
>>> at
>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:1003)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:984)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:265)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:257)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.FrameworkCommandPro vider._start(FrameworkCommandProvider.java:257)
>>>
>>>
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>>>
>>>
>>> at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>>>
>>>
>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>> at
>>> org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:150)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:302)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.co nsole(FrameworkConsole.java:287)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:223)
>>>
>>>
>>> at java.lang.Thread.run(Thread.java:619)
>>> !ENTRY org.eclipse.net4j 4 0 2009-07-15 12:09:16.179
>>> !MESSAGE EOFException
>>> !STACK 0
>>> java.io.EOFException
>>> at java.io.DataInputStream.readBoolean(DataInputStream.java:227 )
>>> at
>>> org.eclipse.net4j.util.io.ExtendedDataInput$Delegating.readB oolean(ExtendedDataInput.java:55)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.common.io.CDODataInputImpl.read CDORevision(CDODataInputImpl.java:214)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:116)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:1)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientRequest .confirming(CDOClientRequest.java:77)
>>>
>>>
>>> at
>>> org.eclipse.net4j.signal.RequestWithConfirmation.doExtendedI nput(RequestWithConfirmation.java:123)
>>>
>>>
>>> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
>>> at
>>> org.eclipse.net4j.signal.RequestWithConfirmation.doExecute(R equestWithConfirmation.java:103)
>>>
>>>
>>> at
>>> org.eclipse.net4j.signal.SignalActor.execute(SignalActor.jav a:66)
>>> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
>>> at
>>> org.eclipse.net4j.signal.SignalProtocol.startSignal(SignalPr otocol.java:421)
>>>
>>>
>>> at
>>> org.eclipse.net4j.signal.RequestWithConfirmation.doSend(Requ estWithConfirmation.java:87)
>>>
>>>
>>> at
>>> org.eclipse.net4j.signal.RequestWithConfirmation.send(Reques tWithConfirmation.java:73)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:286)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:319)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.loadRevisions(CDOClientProtocol.java:110)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevisions(CDORevisionManagerImpl.java:124)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevision(CDORevisionManagerImpl.java:106)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:155)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:1)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getRevision(CD OViewImpl.java:682)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getLocalRevisi on(CDOViewImpl.java:561)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:508)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eIDChecked(CDOViewImpl.java:447)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:435)
>>>
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.hasResource(CD OViewImpl.java:376)
>>>
>>>
>>> at
>>> de.hpi.sam.mdcm.cmdb.repository.Repository.createRepositoryS tructure(Repository.java:49)
>>>
>>>
>>> at
>>> de.hpi.sam.mdcm.cmdb.repository.Repository.<init>(Repository.java:31)
>>> at
>>> de.hpi.sam.mdcm.cmdb.server.internal.CMDBServer.createReposi tory(CMDBServer.java:138)
>>>
>>>
>>> at
>>> de.hpi.sam.mdcm.cmdb.server.internal.Activator.start(Activat or.java:38)
>>> at
>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:1009)
>>>
>>>
>>> at java.security.AccessController.doPrivileged(Native Method)
>>> at
>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:1003)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:984)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:265)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:257)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.FrameworkCommandPro vider._start(FrameworkCommandProvider.java:257)
>>>
>>>
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>>>
>>>
>>> at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>>>
>>>
>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>> at
>>> org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:150)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:302)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.co nsole(FrameworkConsole.java:287)
>>>
>>>
>>> at
>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:223)
>>>
>>>
>>> at java.lang.Thread.run(Thread.java:619)
>>>
>>>
>>> what am I missing?
>>>
>>>
>>> cheers,
>>>
>>> steven
>>>
>>>
>>> Eike Stepper wrote:
>>>> Steven,
>>>>
>>>> There is no magic in CDO that does this automatically. *You* must do
>>>> that by executing the same Java statements that you initially
>>>> executed.
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>> ----
>>>> http://thegordian.blogspot.com
>>>> http://twitter.com/eikestepper
>>>>
>>>>
>>>>
>>>> steven schrieb:
>>>>> eike,
>>>>>
>>>>> comments below ..
>>>>>
>>>>> Eike Stepper wrote:
>>>>>> Steven,
>>>>>>
>>>>>> There's no single and mandatory way to create repositories or make
>>>>>> them
>>>>>> available on a server. They are no operating services by
>>>>>> themselves so
>>>>>> they do not automatically appear after a server restart, unless you
>>>>>> ensure that the repository is started again, too.
>>>>> that's what I want .. how I can start a repository again;
>>>>> respectively,
>>>>> how can I restart all previously created repositories after a server
>>>>> restart?
>>>>>
>>>>> cheers,
>>>>>
>>>>> steven
>>>>>
>>>>>> If, after starting a repository, you put it into an
>>>>>> IManagedContainer
>>>>>> you can query the container, as you try it below. But a repository
>>>>>> does
>>>>>> not automatically end up registered with such a container. You'd
>>>>>> have to
>>>>>> register it there for example with
>>>>>> CDOServerUtil.addRepository(IManagedContainer, IRepository).
>>>>>>
>>>>>> You could also use the OSGi service registry or a Spring application
>>>>>> context or your own mechanism...
>>>>>>
>>>>>> Cheers
>>>>>> /Eike
>>>>>>
>>>>>> ----
>>>>>> http://thegordian.blogspot.com
>>>>>> http://twitter.com/eikestepper
>>>>>>
>>>>>>
>>>>>>
>>>>>> steven schrieb:
>>>>>>> hi folks,
>>>>>>>
>>>>>>> how can I check if a cdo server already contains a repository?
>>>>>>>
>>>>>>> my scenario is the following:
>>>>>>>
>>>>>>> 1. start server
>>>>>>> 2. create repository "repo1"
>>>>>>> 3. shutdown server
>>>>>>> 4. restart server
>>>>>>> 5. open "repo1"
>>>>>>>
>>>>>>> I tried the following:
>>>>>>>
>>>>>>> IRepository repository = CDOServerUtil.getRepository(container,
>>>>>>> repositoryName);
>>>>>>> if(repository == null){
>>>>>>> //create repo
>>>>>>> }else{
>>>>>>> //use existing repo
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>> but I get an exception:
>>>>>>>
>>>>>>> org.eclipse.net4j.util.container.FactoryNotFoundException: Factory
>>>>>>> not
>>>>>>> found: org.eclipse.emf.cdo.server.repositories[default]
>>>>>>>
>>>>>>>
>>>>>>> cheers,
>>>>>>>
>>>>>>> steven
Re: [CDO] query server for existing repository [message #431573 is a reply to message #431564] Fri, 17 July 2009 08:36 Go to previous messageGo to next message
steven is currently offline stevenFriend
Messages: 8
Registered: July 2009
Junior Member
eike,

now, I am using H2 and it works!
but, I could not find the H2Adapter in the latest net4j sdk.
instead, I took it from here:
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.emf/org .eclipse.emf.net4j/plugins/org.eclipse.net4j.db.h2/src/org/e clipse/net4j/db/h2/H2Adapter.java?root=Modeling_Project& view=co

, and added it to my workspace.

Why isn't it in the release?

cheers,
steven

Eike Stepper wrote:
> Steven,
>
> I avguely remember a similar problem in our Derby based tests but I
> can't remember the reason anymore. Stefan?
>
> Have you considered using H2 instead of Derby? Additional benefit would
> be performance boost of factor 2 to 10:
>
> http://markmail.org/message/7zrgefmi7gi24t7d
> http://www.encorewiki.org/display/encore/Open+Source+Databas es+Comparison
>
> steven schrieb:
>> eike,
>>
>> it helped!
>> but .. I am having a different problem:
>>
>> I can store some models on the server properly, but
>> after some (the concrete number is not deterministic) models
>> have been inserted I get the following exception:
>>
>> [ERROR] Rollback in DBStore: org.eclipse.net4j.db.DBException: SQL
>> Exception: A lock could not be obtained within the time requested
>> at
>> org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ob jectTypeCache.putObjectType(ObjectTypeCache.java:137)
>>
>> at
>> org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ab stractHorizontalMappingStrategy.putObjectType(AbstractHorizo ntalMappingStrategy.java:69)
>>
>> at
>> org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ab stractHorizontalClassMapping.writeRevision(AbstractHorizonta lClassMapping.java:326)
>>
>> at
>> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write Revision(DBStoreAccessor.java:355)
>>
>> at
>> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write Revisions(DBStoreAccessor.java:337)
>>
>> at
>> org.eclipse.emf.cdo.spi.server.StoreAccessor.write(StoreAcce ssor.java:142)
>>
>> at
>> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.acces s$4(DBStoreAccessor.java:1)
>>
>> at
>> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor$1.run Loop(DBStoreAccessor.java:80)
>>
>> at
>> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor$1.run Loop(DBStoreAccessor.java:1)
>>
>> at
>> org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(Pr ogressDistributor.java:96)
>>
>> at
>> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write (DBStoreAccessor.java:294)
>>
>> at
>> org.eclipse.emf.cdo.internal.server.TransactionCommitContext Impl.write(TransactionCommitContextImpl.java:269)
>>
>> at
>> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication$1.runLoop(CommitTransactionIndication.java:73)
>>
>> at
>> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication$1.runLoop(CommitTransactionIndication.java:1)
>>
>> at
>> org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(Pr ogressDistributor.java:96)
>>
>> at
>> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication.indicatingCommit(CommitTransactionIndication.ja va:325)
>>
>> at
>> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication.indicating(CommitTransactionIndication.java:198 )
>>
>> at
>> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication.indicating(CommitTransactionIndication.java:140 )
>>
>> at
>> org.eclipse.net4j.signal.IndicationWithMonitoring.indicating (IndicationWithMonitoring.java:84)
>>
>> at
>> org.eclipse.net4j.signal.IndicationWithResponse.doExtendedIn put(IndicationWithResponse.java:90)
>>
>> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
>> at
>> org.eclipse.net4j.signal.IndicationWithResponse.execute(Indi cationWithResponse.java:63)
>>
>> at
>> org.eclipse.net4j.signal.IndicationWithMonitoring.execute(In dicationWithMonitoring.java:63)
>>
>> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
>> at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Threa dPoolExecutor.java:885)
>>
>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo lExecutor.java:907)
>>
>> at java.lang.Thread.run(Thread.java:619)
>> Caused by: SQL Exception: A lock could not be obtained within the time
>> requested
>> at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unkno wn
>> Source)
>> at
>> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQL Exception(Unknown
>> Source)
>> at
>> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleExc eption(Unknown
>> Source)
>> at
>> org.apache.derby.impl.jdbc.EmbedConnection.handleException(U nknown
>> Source)
>> at
>> org.apache.derby.impl.jdbc.ConnectionChild.handleException(U nknown
>> Source)
>> at
>> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(U nknown
>> Source)
>> at
>> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeSta tement(Unknown
>> Source)
>> at
>> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpd ate(Unknown
>> Source)
>> at
>> org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ob jectTypeCache.putObjectType(ObjectTypeCache.java:128)
>>
>> ... 27 more
>>
>>
>> why the lock not be obtained, although some models could be stored?
>>
>>
>> cheers,
>>
>> steven
>>
>> Eike Stepper wrote:
>>> Steven,
>>>
>>> Neither CDOResources nor CDOResourceFolders should be created manually
>>> by you. You should never use EresourceFactory directly.
>>>
>>> CDOResources are created automatically, either with
>>> ResourceSet.createResource(uri), CDOTransaction.createResource(path) or
>>> CDOTransaction.getOrCreateResource(path). CDOResourceFolders are created
>>> implicitely when you create a CDOResource with slashes in its path.
>>>
>>> Please try this:
>>>
>>> protected void createRepositoryStructure() {
>>> CDOTransaction transaction = session.openTransaction();
>>> transaction.getOrCreateResource(SOL_ARCH_FOLDER_NAME +
>>> "/SolArchResource");
>>> transaction.commit();
>>> transaction.close();
>>> }
>>>
>>> Or this, if you need access to the folder:
>>>
>>> protected void createRepositoryStructure() {
>>> CDOTransaction transaction = session.openTransaction();
>>> CDOResource solArchResource =
>>> transaction.getOrCreateResource(SOL_ARCH_FOLDER_NAME +
>>> "/SolArchResource");
>>> CDOResourceFolder solArchFolder = solArchResource.getFolder();
>>> solArchFolder.xyz();
>>>
>>> transaction.commit();
>>> transaction.close();
>>> }
>>>
>>>
>>> Does this help?
>>>
>>> Cheers
>>> /Eike
>>>
>>> ----
>>> http://thegordian.blogspot.com
>>> http://twitter.com/eikestepper
>>>
>>>
>>> steven schrieb:
>>>> eike,
>>>>
>>>> I am executing the same java statements, but if I stop the server
>>>> in the osgi console and start it again, I get the exception I appended
>>>> at the end.
>>>> the exception is thrown when I check if my repository's structure has
>>>> already been created:
>>>>
>>>> protected void createRepositoryStructure() {
>>>> CDOTransaction transaction = null;
>>>> if(!view.hasResource(SOL_ARCH_FOLDER_NAME)){//exception thrown here
>>>> transaction = session.openTransaction();
>>>> CDOResourceFolder solArchfolder =
>>>> EresourceFactory.eINSTANCE.createCDOResourceFolder();
>>>> solArchfolder.setName(SOL_ARCH_FOLDER_NAME);
>>>> EList<EObject> rootContent =
>>>> transaction.getRootResource().getContents();
>>>> rootContent.add(solArchfolder);
>>>> transaction.commit();
>>>> transaction.close();
>>>> }
>>>> }
>>>>
>>>> so, initially the method createRepositoryStructure() works fine,
>>>> but then it crashes with the following exception:
>>>>
>>>> [ERROR] EOFException
>>>> java.io.EOFException
>>>> at java.io.DataInputStream.readBoolean(DataInputStream.java:227 )
>>>> at
>>>> org.eclipse.net4j.util.io.ExtendedDataInput$Delegating.readB oolean(ExtendedDataInput.java:55)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.internal.common.io.CDODataInputImpl.read CDORevision(CDODataInputImpl.java:214)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:116)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:1)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientRequest .confirming(CDOClientRequest.java:77)
>>>>
>>>>
>>>> at
>>>> org.eclipse.net4j.signal.RequestWithConfirmation.doExtendedI nput(RequestWithConfirmation.java:123)
>>>>
>>>> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
>>>> at
>>>> org.eclipse.net4j.signal.RequestWithConfirmation.doExecute(R equestWithConfirmation.java:103)
>>>>
>>>>
>>>> at
>>>> org.eclipse.net4j.signal.SignalActor.execute(SignalActor.jav a:66)
>>>> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
>>>> at
>>>> org.eclipse.net4j.signal.SignalProtocol.startSignal(SignalPr otocol.java:421)
>>>>
>>>>
>>>> at
>>>> org.eclipse.net4j.signal.RequestWithConfirmation.doSend(Requ estWithConfirmation.java:87)
>>>>
>>>>
>>>> at
>>>> org.eclipse.net4j.signal.RequestWithConfirmation.send(Reques tWithConfirmation.java:73)
>>>>
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:286)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:319)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.loadRevisions(CDOClientProtocol.java:110)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevisions(CDORevisionManagerImpl.java:124)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevision(CDORevisionManagerImpl.java:106)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:155)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:1)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getRevision(CD OViewImpl.java:682)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getLocalRevisi on(CDOViewImpl.java:561)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:508)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eIDChecked(CDOViewImpl.java:447)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:435)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.hasResource(CD OViewImpl.java:376)
>>>>
>>>>
>>>> at
>>>> de.hpi.sam.mdcm.cmdb.repository.Repository.createRepositoryS tructure(Repository.java:49)
>>>>
>>>>
>>>> at
>>>> de.hpi.sam.mdcm.cmdb.repository.Repository.<init>(Repository.java:31)
>>>> at
>>>> de.hpi.sam.mdcm.cmdb.server.internal.CMDBServer.createReposi tory(CMDBServer.java:138)
>>>>
>>>>
>>>> at
>>>> de.hpi.sam.mdcm.cmdb.server.internal.Activator.start(Activat or.java:38)
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:1009)
>>>>
>>>>
>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:1003)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:984)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:265)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:257)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.FrameworkCommandPro vider._start(FrameworkCommandProvider.java:257)
>>>>
>>>>
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>> at
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>>>>
>>>>
>>>> at
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>>>>
>>>>
>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:150)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:302)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.co nsole(FrameworkConsole.java:287)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:223)
>>>>
>>>>
>>>> at java.lang.Thread.run(Thread.java:619)
>>>> !ENTRY org.eclipse.net4j 4 0 2009-07-15 12:09:16.179
>>>> !MESSAGE EOFException
>>>> !STACK 0
>>>> java.io.EOFException
>>>> at java.io.DataInputStream.readBoolean(DataInputStream.java:227 )
>>>> at
>>>> org.eclipse.net4j.util.io.ExtendedDataInput$Delegating.readB oolean(ExtendedDataInput.java:55)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.internal.common.io.CDODataInputImpl.read CDORevision(CDODataInputImpl.java:214)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:116)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:1)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientRequest .confirming(CDOClientRequest.java:77)
>>>>
>>>>
>>>> at
>>>> org.eclipse.net4j.signal.RequestWithConfirmation.doExtendedI nput(RequestWithConfirmation.java:123)
>>>>
>>>>
>>>> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
>>>> at
>>>> org.eclipse.net4j.signal.RequestWithConfirmation.doExecute(R equestWithConfirmation.java:103)
>>>>
>>>>
>>>> at
>>>> org.eclipse.net4j.signal.SignalActor.execute(SignalActor.jav a:66)
>>>> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
>>>> at
>>>> org.eclipse.net4j.signal.SignalProtocol.startSignal(SignalPr otocol.java:421)
>>>>
>>>>
>>>> at
>>>> org.eclipse.net4j.signal.RequestWithConfirmation.doSend(Requ estWithConfirmation.java:87)
>>>>
>>>>
>>>> at
>>>> org.eclipse.net4j.signal.RequestWithConfirmation.send(Reques tWithConfirmation.java:73)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:286)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:319)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.loadRevisions(CDOClientProtocol.java:110)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevisions(CDORevisionManagerImpl.java:124)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevision(CDORevisionManagerImpl.java:106)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:155)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:1)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getRevision(CD OViewImpl.java:682)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getLocalRevisi on(CDOViewImpl.java:561)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:508)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eIDChecked(CDOViewImpl.java:447)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:435)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.hasResource(CD OViewImpl.java:376)
>>>>
>>>>
>>>> at
>>>> de.hpi.sam.mdcm.cmdb.repository.Repository.createRepositoryS tructure(Repository.java:49)
>>>>
>>>>
>>>> at
>>>> de.hpi.sam.mdcm.cmdb.repository.Repository.<init>(Repository.java:31)
>>>> at
>>>> de.hpi.sam.mdcm.cmdb.server.internal.CMDBServer.createReposi tory(CMDBServer.java:138)
>>>>
>>>>
>>>> at
>>>> de.hpi.sam.mdcm.cmdb.server.internal.Activator.start(Activat or.java:38)
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:1009)
>>>>
>>>>
>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:1003)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:984)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:265)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:257)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.FrameworkCommandPro vider._start(FrameworkCommandProvider.java:257)
>>>>
>>>>
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>> at
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>>>>
>>>>
>>>> at
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>>>>
>>>>
>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:150)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:302)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.co nsole(FrameworkConsole.java:287)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:223)
>>>>
>>>>
>>>> at java.lang.Thread.run(Thread.java:619)
>>>>
>>>>
>>>> what am I missing?
>>>>
>>>>
>>>> cheers,
>>>>
>>>> steven
>>>>
>>>>
>>>> Eike Stepper wrote:
>>>>> Steven,
>>>>>
>>>>> There is no magic in CDO that does this automatically. *You* must do
>>>>> that by executing the same Java statements that you initially
>>>>> executed.
>>>>>
>>>>> Cheers
>>>>> /Eike
>>>>>
>>>>> ----
>>>>> http://thegordian.blogspot.com
>>>>> http://twitter.com/eikestepper
>>>>>
>>>>>
>>>>>
>>>>> steven schrieb:
>>>>>> eike,
>>>>>>
>>>>>> comments below ..
>>>>>>
>>>>>> Eike Stepper wrote:
>>>>>>> Steven,
>>>>>>>
>>>>>>> There's no single and mandatory way to create repositories or make
>>>>>>> them
>>>>>>> available on a server. They are no operating services by
>>>>>>> themselves so
>>>>>>> they do not automatically appear after a server restart, unless you
>>>>>>> ensure that the repository is started again, too.
>>>>>> that's what I want .. how I can start a repository again;
>>>>>> respectively,
>>>>>> how can I restart all previously created repositories after a server
>>>>>> restart?
>>>>>>
>>>>>> cheers,
>>>>>>
>>>>>> steven
>>>>>>
>>>>>>> If, after starting a repository, you put it into an
>>>>>>> IManagedContainer
>>>>>>> you can query the container, as you try it below. But a repository
>>>>>>> does
>>>>>>> not automatically end up registered with such a container. You'd
>>>>>>> have to
>>>>>>> register it there for example with
>>>>>>> CDOServerUtil.addRepository(IManagedContainer, IRepository).
>>>>>>>
>>>>>>> You could also use the OSGi service registry or a Spring application
>>>>>>> context or your own mechanism...
>>>>>>>
>>>>>>> Cheers
>>>>>>> /Eike
>>>>>>>
>>>>>>> ----
>>>>>>> http://thegordian.blogspot.com
>>>>>>> http://twitter.com/eikestepper
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> steven schrieb:
>>>>>>>> hi folks,
>>>>>>>>
>>>>>>>> how can I check if a cdo server already contains a repository?
>>>>>>>>
>>>>>>>> my scenario is the following:
>>>>>>>>
>>>>>>>> 1. start server
>>>>>>>> 2. create repository "repo1"
>>>>>>>> 3. shutdown server
>>>>>>>> 4. restart server
>>>>>>>> 5. open "repo1"
>>>>>>>>
>>>>>>>> I tried the following:
>>>>>>>>
>>>>>>>> IRepository repository = CDOServerUtil.getRepository(container,
>>>>>>>> repositoryName);
>>>>>>>> if(repository == null){
>>>>>>>> //create repo
>>>>>>>> }else{
>>>>>>>> //use existing repo
>>>>>>>> }
>>>>>>>>
>>>>>>>>
>>>>>>>> but I get an exception:
>>>>>>>>
>>>>>>>> org.eclipse.net4j.util.container.FactoryNotFoundException: Factory
>>>>>>>> not
>>>>>>>> found: org.eclipse.emf.cdo.server.repositories[default]
>>>>>>>>
>>>>>>>>
>>>>>>>> cheers,
>>>>>>>>
>>>>>>>> steven
Re: [CDO] query server for existing repository [message #431574 is a reply to message #431573] Fri, 17 July 2009 08:45 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
steven schrieb:
>
> eike,
>
> now, I am using H2 and it works!
Great ;-)

> but, I could not find the H2Adapter in the latest net4j sdk.
> instead, I took it from here:
> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.emf/org .eclipse.emf.net4j/plugins/org.eclipse.net4j.db.h2/src/org/e clipse/net4j/db/h2/H2Adapter.java?root=Modeling_Project& view=co
>
>
> , and added it to my workspace.
>
> Why isn't it in the release?
Because our build system currently does not support inclusion of bundles
with unsaturated (non-optional) dependencies ;-(

We're working on that. In the meantime you'll find all DBAdapter bundles
and their 3rd party deps here: http://net4j.sourceforge.net/update/ (a
p2 update site!!)

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper


>
> cheers,
> steven
>
> Eike Stepper wrote:
>> Steven,
>>
>> I avguely remember a similar problem in our Derby based tests but I
>> can't remember the reason anymore. Stefan?
>>
>> Have you considered using H2 instead of Derby? Additional benefit would
>> be performance boost of factor 2 to 10:
>>
>> http://markmail.org/message/7zrgefmi7gi24t7d
>> http://www.encorewiki.org/display/encore/Open+Source+Databas es+Comparison
>>
>>
>> steven schrieb:
>>> eike,
>>>
>>> it helped!
>>> but .. I am having a different problem:
>>>
>>> I can store some models on the server properly, but
>>> after some (the concrete number is not deterministic) models
>>> have been inserted I get the following exception:
>>>
>>> [ERROR] Rollback in DBStore: org.eclipse.net4j.db.DBException: SQL
>>> Exception: A lock could not be obtained within the time requested
>>> at
>>> org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ob jectTypeCache.putObjectType(ObjectTypeCache.java:137)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ab stractHorizontalMappingStrategy.putObjectType(AbstractHorizo ntalMappingStrategy.java:69)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ab stractHorizontalClassMapping.writeRevision(AbstractHorizonta lClassMapping.java:326)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write Revision(DBStoreAccessor.java:355)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write Revisions(DBStoreAccessor.java:337)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.spi.server.StoreAccessor.write(StoreAcce ssor.java:142)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.acces s$4(DBStoreAccessor.java:1)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor$1.run Loop(DBStoreAccessor.java:80)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor$1.run Loop(DBStoreAccessor.java:1)
>>>
>>>
>>> at
>>> org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(Pr ogressDistributor.java:96)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write (DBStoreAccessor.java:294)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.server.TransactionCommitContext Impl.write(TransactionCommitContextImpl.java:269)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication$1.runLoop(CommitTransactionIndication.java:73)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication$1.runLoop(CommitTransactionIndication.java:1)
>>>
>>>
>>> at
>>> org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(Pr ogressDistributor.java:96)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication.indicatingCommit(CommitTransactionIndication.ja va:325)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication.indicating(CommitTransactionIndication.java:198 )
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication.indicating(CommitTransactionIndication.java:140 )
>>>
>>>
>>> at
>>> org.eclipse.net4j.signal.IndicationWithMonitoring.indicating (IndicationWithMonitoring.java:84)
>>>
>>>
>>> at
>>> org.eclipse.net4j.signal.IndicationWithResponse.doExtendedIn put(IndicationWithResponse.java:90)
>>>
>>>
>>> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
>>> at
>>> org.eclipse.net4j.signal.IndicationWithResponse.execute(Indi cationWithResponse.java:63)
>>>
>>>
>>> at
>>> org.eclipse.net4j.signal.IndicationWithMonitoring.execute(In dicationWithMonitoring.java:63)
>>>
>>>
>>> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
>>> at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
>>> at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Threa dPoolExecutor.java:885)
>>>
>>>
>>> at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo lExecutor.java:907)
>>>
>>>
>>> at java.lang.Thread.run(Thread.java:619)
>>> Caused by: SQL Exception: A lock could not be obtained within the time
>>> requested
>>> at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unkno wn
>>> Source)
>>> at
>>> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQL Exception(Unknown
>>>
>>> Source)
>>> at
>>> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleExc eption(Unknown
>>>
>>> Source)
>>> at
>>> org.apache.derby.impl.jdbc.EmbedConnection.handleException(U nknown
>>> Source)
>>> at
>>> org.apache.derby.impl.jdbc.ConnectionChild.handleException(U nknown
>>> Source)
>>> at
>>> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(U nknown
>>> Source)
>>> at
>>> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeSta tement(Unknown
>>>
>>> Source)
>>> at
>>> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpd ate(Unknown
>>> Source)
>>> at
>>> org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ob jectTypeCache.putObjectType(ObjectTypeCache.java:128)
>>>
>>>
>>> ... 27 more
>>>
>>>
>>> why the lock not be obtained, although some models could be stored?
>>>
>>>
>>> cheers,
>>>
>>> steven
>>>
>>> Eike Stepper wrote:
>>>> Steven,
>>>>
>>>> Neither CDOResources nor CDOResourceFolders should be created manually
>>>> by you. You should never use EresourceFactory directly.
>>>>
>>>> CDOResources are created automatically, either with
>>>> ResourceSet.createResource(uri),
>>>> CDOTransaction.createResource(path) or
>>>> CDOTransaction.getOrCreateResource(path). CDOResourceFolders are
>>>> created
>>>> implicitely when you create a CDOResource with slashes in its path.
>>>>
>>>> Please try this:
>>>>
>>>> protected void createRepositoryStructure() {
>>>> CDOTransaction transaction = session.openTransaction();
>>>> transaction.getOrCreateResource(SOL_ARCH_FOLDER_NAME +
>>>> "/SolArchResource");
>>>> transaction.commit();
>>>> transaction.close();
>>>> }
>>>>
>>>> Or this, if you need access to the folder:
>>>>
>>>> protected void createRepositoryStructure() {
>>>> CDOTransaction transaction = session.openTransaction();
>>>> CDOResource solArchResource =
>>>> transaction.getOrCreateResource(SOL_ARCH_FOLDER_NAME +
>>>> "/SolArchResource");
>>>> CDOResourceFolder solArchFolder = solArchResource.getFolder();
>>>> solArchFolder.xyz();
>>>>
>>>> transaction.commit();
>>>> transaction.close();
>>>> }
>>>>
>>>>
>>>> Does this help?
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>> ----
>>>> http://thegordian.blogspot.com
>>>> http://twitter.com/eikestepper
>>>>
>>>>
>>>> steven schrieb:
>>>>> eike,
>>>>>
>>>>> I am executing the same java statements, but if I stop the server
>>>>> in the osgi console and start it again, I get the exception I
>>>>> appended
>>>>> at the end.
>>>>> the exception is thrown when I check if my repository's structure has
>>>>> already been created:
>>>>>
>>>>> protected void createRepositoryStructure() {
>>>>> CDOTransaction transaction = null;
>>>>> if(!view.hasResource(SOL_ARCH_FOLDER_NAME)){//exception thrown here
>>>>> transaction = session.openTransaction();
>>>>> CDOResourceFolder solArchfolder =
>>>>> EresourceFactory.eINSTANCE.createCDOResourceFolder();
>>>>> solArchfolder.setName(SOL_ARCH_FOLDER_NAME);
>>>>> EList<EObject> rootContent =
>>>>> transaction.getRootResource().getContents();
>>>>> rootContent.add(solArchfolder);
>>>>> transaction.commit();
>>>>> transaction.close();
>>>>> }
>>>>> }
>>>>>
>>>>> so, initially the method createRepositoryStructure() works fine,
>>>>> but then it crashes with the following exception:
>>>>>
>>>>> [ERROR] EOFException
>>>>> java.io.EOFException
>>>>> at java.io.DataInputStream.readBoolean(DataInputStream.java:227 )
>>>>> at
>>>>> org.eclipse.net4j.util.io.ExtendedDataInput$Delegating.readB oolean(ExtendedDataInput.java:55)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.cdo.internal.common.io.CDODataInputImpl.read CDORevision(CDODataInputImpl.java:214)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:116)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:1)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientRequest .confirming(CDOClientRequest.java:77)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.net4j.signal.RequestWithConfirmation.doExtendedI nput(RequestWithConfirmation.java:123)
>>>>>
>>>>>
>>>>> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
>>>>> at
>>>>> org.eclipse.net4j.signal.RequestWithConfirmation.doExecute(R equestWithConfirmation.java:103)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.net4j.signal.SignalActor.execute(SignalActor.jav a:66)
>>>>> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
>>>>> at
>>>>> org.eclipse.net4j.signal.SignalProtocol.startSignal(SignalPr otocol.java:421)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.net4j.signal.RequestWithConfirmation.doSend(Requ estWithConfirmation.java:87)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.net4j.signal.RequestWithConfirmation.send(Reques tWithConfirmation.java:73)
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:286)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:319)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.loadRevisions(CDOClientProtocol.java:110)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevisions(CDORevisionManagerImpl.java:124)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevision(CDORevisionManagerImpl.java:106)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:155)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:1)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getRevision(CD OViewImpl.java:682)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getLocalRevisi on(CDOViewImpl.java:561)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:508)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eIDChecked(CDOViewImpl.java:447)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:435)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.hasResource(CD OViewImpl.java:376)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> de.hpi.sam.mdcm.cmdb.repository.Repository.createRepositoryS tructure(Repository.java:49)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> de.hpi.sam.mdcm.cmdb.repository.Repository.<init>(Repository.java:31)
>>>>> at
>>>>> de.hpi.sam.mdcm.cmdb.server.internal.CMDBServer.createReposi tory(CMDBServer.java:138)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> de.hpi.sam.mdcm.cmdb.server.internal.Activator.start(Activat or.java:38)
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:1009)
>>>>>
>>>>>
>>>>>
>>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:1003)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:984)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:265)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:257)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.FrameworkCommandPro vider._start(FrameworkCommandProvider.java:257)
>>>>>
>>>>>
>>>>>
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> at
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>>>>>
>>>>>
>>>>>
>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:150)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:302)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.co nsole(FrameworkConsole.java:287)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:223)
>>>>>
>>>>>
>>>>>
>>>>> at java.lang.Thread.run(Thread.java:619)
>>>>> !ENTRY org.eclipse.net4j 4 0 2009-07-15 12:09:16.179
>>>>> !MESSAGE EOFException
>>>>> !STACK 0
>>>>> java.io.EOFException
>>>>> at java.io.DataInputStream.readBoolean(DataInputStream.java:227 )
>>>>> at
>>>>> org.eclipse.net4j.util.io.ExtendedDataInput$Delegating.readB oolean(ExtendedDataInput.java:55)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.cdo.internal.common.io.CDODataInputImpl.read CDORevision(CDODataInputImpl.java:214)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:116)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:1)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientRequest .confirming(CDOClientRequest.java:77)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.net4j.signal.RequestWithConfirmation.doExtendedI nput(RequestWithConfirmation.java:123)
>>>>>
>>>>>
>>>>>
>>>>> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
>>>>> at
>>>>> org.eclipse.net4j.signal.RequestWithConfirmation.doExecute(R equestWithConfirmation.java:103)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.net4j.signal.SignalActor.execute(SignalActor.jav a:66)
>>>>> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
>>>>> at
>>>>> org.eclipse.net4j.signal.SignalProtocol.startSignal(SignalPr otocol.java:421)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.net4j.signal.RequestWithConfirmation.doSend(Requ estWithConfirmation.java:87)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.net4j.signal.RequestWithConfirmation.send(Reques tWithConfirmation.java:73)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:286)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:319)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.loadRevisions(CDOClientProtocol.java:110)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevisions(CDORevisionManagerImpl.java:124)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevision(CDORevisionManagerImpl.java:106)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:155)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:1)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getRevision(CD OViewImpl.java:682)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getLocalRevisi on(CDOViewImpl.java:561)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:508)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eIDChecked(CDOViewImpl.java:447)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:435)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.hasResource(CD OViewImpl.java:376)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> de.hpi.sam.mdcm.cmdb.repository.Repository.createRepositoryS tructure(Repository.java:49)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> de.hpi.sam.mdcm.cmdb.repository.Repository.<init>(Repository.java:31)
>>>>> at
>>>>> de.hpi.sam.mdcm.cmdb.server.internal.CMDBServer.createReposi tory(CMDBServer.java:138)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> de.hpi.sam.mdcm.cmdb.server.internal.Activator.start(Activat or.java:38)
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:1009)
>>>>>
>>>>>
>>>>>
>>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:1003)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:984)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:265)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:257)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.FrameworkCommandPro vider._start(FrameworkCommandProvider.java:257)
>>>>>
>>>>>
>>>>>
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> at
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>>>>>
>>>>>
>>>>>
>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:150)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:302)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.co nsole(FrameworkConsole.java:287)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:223)
>>>>>
>>>>>
>>>>>
>>>>> at java.lang.Thread.run(Thread.java:619)
>>>>>
>>>>>
>>>>> what am I missing?
>>>>>
>>>>>
>>>>> cheers,
>>>>>
>>>>> steven
>>>>>
>>>>>
>>>>> Eike Stepper wrote:
>>>>>> Steven,
>>>>>>
>>>>>> There is no magic in CDO that does this automatically. *You* must do
>>>>>> that by executing the same Java statements that you initially
>>>>>> executed.
>>>>>>
>>>>>> Cheers
>>>>>> /Eike
>>>>>>
>>>>>> ----
>>>>>> http://thegordian.blogspot.com
>>>>>> http://twitter.com/eikestepper
>>>>>>
>>>>>>
>>>>>>
>>>>>> steven schrieb:
>>>>>>> eike,
>>>>>>>
>>>>>>> comments below ..
>>>>>>>
>>>>>>> Eike Stepper wrote:
>>>>>>>> Steven,
>>>>>>>>
>>>>>>>> There's no single and mandatory way to create repositories or make
>>>>>>>> them
>>>>>>>> available on a server. They are no operating services by
>>>>>>>> themselves so
>>>>>>>> they do not automatically appear after a server restart, unless
>>>>>>>> you
>>>>>>>> ensure that the repository is started again, too.
>>>>>>> that's what I want .. how I can start a repository again;
>>>>>>> respectively,
>>>>>>> how can I restart all previously created repositories after a
>>>>>>> server
>>>>>>> restart?
>>>>>>>
>>>>>>> cheers,
>>>>>>>
>>>>>>> steven
>>>>>>>
>>>>>>>> If, after starting a repository, you put it into an
>>>>>>>> IManagedContainer
>>>>>>>> you can query the container, as you try it below. But a repository
>>>>>>>> does
>>>>>>>> not automatically end up registered with such a container. You'd
>>>>>>>> have to
>>>>>>>> register it there for example with
>>>>>>>> CDOServerUtil.addRepository(IManagedContainer, IRepository).
>>>>>>>>
>>>>>>>> You could also use the OSGi service registry or a Spring
>>>>>>>> application
>>>>>>>> context or your own mechanism...
>>>>>>>>
>>>>>>>> Cheers
>>>>>>>> /Eike
>>>>>>>>
>>>>>>>> ----
>>>>>>>> http://thegordian.blogspot.com
>>>>>>>> http://twitter.com/eikestepper
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> steven schrieb:
>>>>>>>>> hi folks,
>>>>>>>>>
>>>>>>>>> how can I check if a cdo server already contains a repository?
>>>>>>>>>
>>>>>>>>> my scenario is the following:
>>>>>>>>>
>>>>>>>>> 1. start server
>>>>>>>>> 2. create repository "repo1"
>>>>>>>>> 3. shutdown server
>>>>>>>>> 4. restart server
>>>>>>>>> 5. open "repo1"
>>>>>>>>>
>>>>>>>>> I tried the following:
>>>>>>>>>
>>>>>>>>> IRepository repository = CDOServerUtil.getRepository(container,
>>>>>>>>> repositoryName);
>>>>>>>>> if(repository == null){
>>>>>>>>> //create repo
>>>>>>>>> }else{
>>>>>>>>> //use existing repo
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> but I get an exception:
>>>>>>>>>
>>>>>>>>> org.eclipse.net4j.util.container.FactoryNotFoundException:
>>>>>>>>> Factory
>>>>>>>>> not
>>>>>>>>> found: org.eclipse.emf.cdo.server.repositories[default]
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> cheers,
>>>>>>>>>
>>>>>>>>> steven


Re: [CDO] query server for existing repository [message #431575 is a reply to message #431572] Fri, 17 July 2009 09:16 Go to previous messageGo to next message
steven is currently offline stevenFriend
Messages: 8
Registered: July 2009
Junior Member
hi stefan,

comments below ..


Stefan Winkler wrote:
> Hi steven,
>
> that SQL Exception has occurred a few months ago - see Bug 276926:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=276926
> Are you using Gallileo or an earlier Version?
>

I am using ganymede.

>
> If you are using galileo, can you describe the context a bit more?
> Do you run a single-user application or are there other concurrent users?
>
> The line in the stack trace does a "INSERT IGNORE INTO cdo_objects VALUES
> (cdoid, class_metaId).
> The Derby documentation states that insert will acquire a row lock for
> the new row.
> I currently don't understand why acquiring such a lock could cause a
> deadlock. :-(
>
> The only thing which could be possible would be:
>
> "Derby locks single rows for INSERT statements, holding each row until
> the transaction is committed. (If there is an index associated with the
> table, the previous key is also locked.)"
> [ http://db.apache.org/derby/docs/10.0/manuals/develop/develop 74.html]
>
> So the previous key (cdo_id) is also locked. If that key is not locked
> as part of the current transaction, but as part of another transaction,
> the current transaction waits for the other transaction to finish. If
> this times out (derby standard is 10s, AFAIK), you get the said Exception.
>
>
> So, do you think this case is possible? Do you do huge transactions in
> parallel?
>

No huge transaction. Currently, I am only testing with a small workload:
insert around 5 models and having registered adapters listening for
notifications.
The weird thing is, that if I create a fresh derby database, everything
works fine. I can constantly insert models without a deadlock. if the
server is stopped, and then restarted using the existing database, the
lock-exception occurs (sometimes) at the insertion of the first model.
but, as I wrote in the other mail, I am using H2, now; and this is fine
for me!

thx for your support eike & stefan!!

cheers,

steven

>
> Also, in order to analyse the problem, you could set the properties
> derby.locks.monitor=true and *derby.language.logStatementText=true*
> *then information about acquired locks and locks causing the deadlock
> are written to derby.log.*
> **
> **
> *Cheers,*
> *Stefan*
> **
>
>
>
>
>
> steven schrieb:
>> eike,
>>
>> it helped!
>> but .. I am having a different problem:
>>
>> I can store some models on the server properly, but
>> after some (the concrete number is not deterministic) models
>> have been inserted I get the following exception:
>>
>> [ERROR] Rollback in DBStore: org.eclipse.net4j.db.DBException: SQL
>> Exception: A lock could not be obtained within the time requested
>> at
>> org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ob jectTypeCache.putObjectType(ObjectTypeCache.java:137)
>>
>> at
>> org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ab stractHorizontalMappingStrategy.putObjectType(AbstractHorizo ntalMappingStrategy.java:69)
>>
>> at
>> org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ab stractHorizontalClassMapping.writeRevision(AbstractHorizonta lClassMapping.java:326)
>>
>> at
>> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write Revision(DBStoreAccessor.java:355)
>>
>> at
>> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write Revisions(DBStoreAccessor.java:337)
>>
>> at
>> org.eclipse.emf.cdo.spi.server.StoreAccessor.write(StoreAcce ssor.java:142)
>>
>> at
>> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.acces s$4(DBStoreAccessor.java:1)
>>
>> at
>> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor$1.run Loop(DBStoreAccessor.java:80)
>>
>> at
>> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor$1.run Loop(DBStoreAccessor.java:1)
>>
>> at
>> org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(Pr ogressDistributor.java:96)
>>
>> at
>> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write (DBStoreAccessor.java:294)
>>
>> at
>> org.eclipse.emf.cdo.internal.server.TransactionCommitContext Impl.write(TransactionCommitContextImpl.java:269)
>>
>> at
>> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication$1.runLoop(CommitTransactionIndication.java:73)
>>
>> at
>> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication$1.runLoop(CommitTransactionIndication.java:1)
>>
>> at
>> org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(Pr ogressDistributor.java:96)
>>
>> at
>> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication.indicatingCommit(CommitTransactionIndication.ja va:325)
>>
>> at
>> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication.indicating(CommitTransactionIndication.java:198 )
>>
>> at
>> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication.indicating(CommitTransactionIndication.java:140 )
>>
>> at
>> org.eclipse.net4j.signal.IndicationWithMonitoring.indicating (IndicationWithMonitoring.java:84)
>>
>> at
>> org.eclipse.net4j.signal.IndicationWithResponse.doExtendedIn put(IndicationWithResponse.java:90)
>>
>> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
>> at
>> org.eclipse.net4j.signal.IndicationWithResponse.execute(Indi cationWithResponse.java:63)
>>
>> at
>> org.eclipse.net4j.signal.IndicationWithMonitoring.execute(In dicationWithMonitoring.java:63)
>>
>> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
>> at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Threa dPoolExecutor.java:885)
>>
>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo lExecutor.java:907)
>>
>> at java.lang.Thread.run(Thread.java:619)
>> Caused by: SQL Exception: A lock could not be obtained within the time
>> requested
>> at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unkno wn
>> Source)
>> at
>> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQL Exception(Unknown
>> Source)
>> at
>> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleExc eption(Unknown
>> Source)
>> at
>> org.apache.derby.impl.jdbc.EmbedConnection.handleException(U nknown
>> Source)
>> at
>> org.apache.derby.impl.jdbc.ConnectionChild.handleException(U nknown
>> Source)
>> at
>> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(U nknown
>> Source)
>> at
>> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeSta tement(Unknown
>> Source)
>> at
>> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpd ate(Unknown
>> Source)
>> at
>> org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ob jectTypeCache.putObjectType(ObjectTypeCache.java:128)
>>
>> ... 27 more
>>
>>
>> why the lock not be obtained, although some models could be stored?
>>
>>
>> cheers,
>>
>> steven
>>
>> Eike Stepper wrote:
>>> Steven,
>>>
>>> Neither CDOResources nor CDOResourceFolders should be created manually
>>> by you. You should never use EresourceFactory directly.
>>>
>>> CDOResources are created automatically, either with
>>> ResourceSet.createResource(uri), CDOTransaction.createResource(path) or
>>> CDOTransaction.getOrCreateResource(path). CDOResourceFolders are created
>>> implicitely when you create a CDOResource with slashes in its path.
>>>
>>> Please try this:
>>>
>>> protected void createRepositoryStructure() {
>>> CDOTransaction transaction = session.openTransaction();
>>> transaction.getOrCreateResource(SOL_ARCH_FOLDER_NAME +
>>> "/SolArchResource");
>>> transaction.commit();
>>> transaction.close();
>>> }
>>>
>>> Or this, if you need access to the folder:
>>>
>>> protected void createRepositoryStructure() {
>>> CDOTransaction transaction = session.openTransaction();
>>> CDOResource solArchResource =
>>> transaction.getOrCreateResource(SOL_ARCH_FOLDER_NAME +
>>> "/SolArchResource");
>>> CDOResourceFolder solArchFolder = solArchResource.getFolder();
>>> solArchFolder.xyz();
>>>
>>> transaction.commit();
>>> transaction.close();
>>> }
>>>
>>>
>>> Does this help?
>>>
>>> Cheers
>>> /Eike
>>>
>>> ----
>>> http://thegordian.blogspot.com
>>> http://twitter.com/eikestepper
>>>
>>>
>>> steven schrieb:
>>>> eike,
>>>>
>>>> I am executing the same java statements, but if I stop the server
>>>> in the osgi console and start it again, I get the exception I appended
>>>> at the end.
>>>> the exception is thrown when I check if my repository's structure has
>>>> already been created:
>>>>
>>>> protected void createRepositoryStructure() {
>>>> CDOTransaction transaction = null;
>>>> if(!view.hasResource(SOL_ARCH_FOLDER_NAME)){//exception thrown here
>>>> transaction = session.openTransaction();
>>>> CDOResourceFolder solArchfolder =
>>>> EresourceFactory.eINSTANCE.createCDOResourceFolder();
>>>> solArchfolder.setName(SOL_ARCH_FOLDER_NAME);
>>>> EList<EObject> rootContent =
>>>> transaction.getRootResource().getContents();
>>>> rootContent.add(solArchfolder);
>>>> transaction.commit();
>>>> transaction.close();
>>>> }
>>>> }
>>>>
>>>> so, initially the method createRepositoryStructure() works fine,
>>>> but then it crashes with the following exception:
>>>>
>>>> [ERROR] EOFException
>>>> java.io.EOFException
>>>> at java.io.DataInputStream.readBoolean(DataInputStream.java:227 )
>>>> at
>>>> org.eclipse.net4j.util.io.ExtendedDataInput$Delegating.readB oolean(ExtendedDataInput.java:55)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.internal.common.io.CDODataInputImpl.read CDORevision(CDODataInputImpl.java:214)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:116)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:1)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientRequest .confirming(CDOClientRequest.java:77)
>>>>
>>>>
>>>> at
>>>> org.eclipse.net4j.signal.RequestWithConfirmation.doExtendedI nput(RequestWithConfirmation.java:123)
>>>>
>>>> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
>>>> at
>>>> org.eclipse.net4j.signal.RequestWithConfirmation.doExecute(R equestWithConfirmation.java:103)
>>>>
>>>>
>>>> at
>>>> org.eclipse.net4j.signal.SignalActor.execute(SignalActor.jav a:66)
>>>> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
>>>> at
>>>> org.eclipse.net4j.signal.SignalProtocol.startSignal(SignalPr otocol.java:421)
>>>>
>>>>
>>>> at
>>>> org.eclipse.net4j.signal.RequestWithConfirmation.doSend(Requ estWithConfirmation.java:87)
>>>>
>>>>
>>>> at
>>>> org.eclipse.net4j.signal.RequestWithConfirmation.send(Reques tWithConfirmation.java:73)
>>>>
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:286)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:319)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.loadRevisions(CDOClientProtocol.java:110)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevisions(CDORevisionManagerImpl.java:124)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevision(CDORevisionManagerImpl.java:106)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:155)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:1)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getRevision(CD OViewImpl.java:682)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getLocalRevisi on(CDOViewImpl.java:561)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:508)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eIDChecked(CDOViewImpl.java:447)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:435)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.hasResource(CD OViewImpl.java:376)
>>>>
>>>>
>>>> at
>>>> de.hpi.sam.mdcm.cmdb.repository.Repository.createRepositoryS tructure(Repository.java:49)
>>>>
>>>>
>>>> at
>>>> de.hpi.sam.mdcm.cmdb.repository.Repository.<init>(Repository.java:31)
>>>> at
>>>> de.hpi.sam.mdcm.cmdb.server.internal.CMDBServer.createReposi tory(CMDBServer.java:138)
>>>>
>>>>
>>>> at
>>>> de.hpi.sam.mdcm.cmdb.server.internal.Activator.start(Activat or.java:38)
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:1009)
>>>>
>>>>
>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:1003)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:984)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:265)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:257)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.FrameworkCommandPro vider._start(FrameworkCommandProvider.java:257)
>>>>
>>>>
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>> at
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>>>>
>>>>
>>>> at
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>>>>
>>>>
>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:150)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:302)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.co nsole(FrameworkConsole.java:287)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:223)
>>>>
>>>>
>>>> at java.lang.Thread.run(Thread.java:619)
>>>> !ENTRY org.eclipse.net4j 4 0 2009-07-15 12:09:16.179
>>>> !MESSAGE EOFException
>>>> !STACK 0
>>>> java.io.EOFException
>>>> at java.io.DataInputStream.readBoolean(DataInputStream.java:227 )
>>>> at
>>>> org.eclipse.net4j.util.io.ExtendedDataInput$Delegating.readB oolean(ExtendedDataInput.java:55)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.internal.common.io.CDODataInputImpl.read CDORevision(CDODataInputImpl.java:214)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:116)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:1)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientRequest .confirming(CDOClientRequest.java:77)
>>>>
>>>>
>>>> at
>>>> org.eclipse.net4j.signal.RequestWithConfirmation.doExtendedI nput(RequestWithConfirmation.java:123)
>>>>
>>>>
>>>> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
>>>> at
>>>> org.eclipse.net4j.signal.RequestWithConfirmation.doExecute(R equestWithConfirmation.java:103)
>>>>
>>>>
>>>> at
>>>> org.eclipse.net4j.signal.SignalActor.execute(SignalActor.jav a:66)
>>>> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
>>>> at
>>>> org.eclipse.net4j.signal.SignalProtocol.startSignal(SignalPr otocol.java:421)
>>>>
>>>>
>>>> at
>>>> org.eclipse.net4j.signal.RequestWithConfirmation.doSend(Requ estWithConfirmation.java:87)
>>>>
>>>>
>>>> at
>>>> org.eclipse.net4j.signal.RequestWithConfirmation.send(Reques tWithConfirmation.java:73)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:286)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:319)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.loadRevisions(CDOClientProtocol.java:110)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevisions(CDORevisionManagerImpl.java:124)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevision(CDORevisionManagerImpl.java:106)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:155)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:1)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getRevision(CD OViewImpl.java:682)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getLocalRevisi on(CDOViewImpl.java:561)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:508)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eIDChecked(CDOViewImpl.java:447)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:435)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.hasResource(CD OViewImpl.java:376)
>>>>
>>>>
>>>> at
>>>> de.hpi.sam.mdcm.cmdb.repository.Repository.createRepositoryS tructure(Repository.java:49)
>>>>
>>>>
>>>> at
>>>> de.hpi.sam.mdcm.cmdb.repository.Repository.<init>(Repository.java:31)
>>>> at
>>>> de.hpi.sam.mdcm.cmdb.server.internal.CMDBServer.createReposi tory(CMDBServer.java:138)
>>>>
>>>>
>>>> at
>>>> de.hpi.sam.mdcm.cmdb.server.internal.Activator.start(Activat or.java:38)
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:1009)
>>>>
>>>>
>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:1003)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:984)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:265)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:257)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.FrameworkCommandPro vider._start(FrameworkCommandProvider.java:257)
>>>>
>>>>
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>> at
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>>>>
>>>>
>>>> at
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>>>>
>>>>
>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:150)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:302)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.co nsole(FrameworkConsole.java:287)
>>>>
>>>>
>>>> at
>>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:223)
>>>>
>>>>
>>>> at java.lang.Thread.run(Thread.java:619)
>>>>
>>>>
>>>> what am I missing?
>>>>
>>>>
>>>> cheers,
>>>>
>>>> steven
>>>>
>>>>
>>>> Eike Stepper wrote:
>>>>> Steven,
>>>>>
>>>>> There is no magic in CDO that does this automatically. *You* must do
>>>>> that by executing the same Java statements that you initially
>>>>> executed.
>>>>>
>>>>> Cheers
>>>>> /Eike
>>>>>
>>>>> ----
>>>>> http://thegordian.blogspot.com
>>>>> http://twitter.com/eikestepper
>>>>>
>>>>>
>>>>>
>>>>> steven schrieb:
>>>>>> eike,
>>>>>>
>>>>>> comments below ..
>>>>>>
>>>>>> Eike Stepper wrote:
>>>>>>> Steven,
>>>>>>>
>>>>>>> There's no single and mandatory way to create repositories or make
>>>>>>> them
>>>>>>> available on a server. They are no operating services by
>>>>>>> themselves so
>>>>>>> they do not automatically appear after a server restart, unless you
>>>>>>> ensure that the repository is started again, too.
>>>>>> that's what I want .. how I can start a repository again;
>>>>>> respectively,
>>>>>> how can I restart all previously created repositories after a server
>>>>>> restart?
>>>>>>
>>>>>> cheers,
>>>>>>
>>>>>> steven
>>>>>>
>>>>>>> If, after starting a repository, you put it into an
>>>>>>> IManagedContainer
>>>>>>> you can query the container, as you try it below. But a repository
>>>>>>> does
>>>>>>> not automatically end up registered with such a container. You'd
>>>>>>> have to
>>>>>>> register it there for example with
>>>>>>> CDOServerUtil.addRepository(IManagedContainer, IRepository).
>>>>>>>
>>>>>>> You could also use the OSGi service registry or a Spring application
>>>>>>> context or your own mechanism...
>>>>>>>
>>>>>>> Cheers
>>>>>>> /Eike
>>>>>>>
>>>>>>> ----
>>>>>>> http://thegordian.blogspot.com
>>>>>>> http://twitter.com/eikestepper
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> steven schrieb:
>>>>>>>> hi folks,
>>>>>>>>
>>>>>>>> how can I check if a cdo server already contains a repository?
>>>>>>>>
>>>>>>>> my scenario is the following:
>>>>>>>>
>>>>>>>> 1. start server
>>>>>>>> 2. create repository "repo1"
>>>>>>>> 3. shutdown server
>>>>>>>> 4. restart server
>>>>>>>> 5. open "repo1"
>>>>>>>>
>>>>>>>> I tried the following:
>>>>>>>>
>>>>>>>> IRepository repository = CDOServerUtil.getRepository(container,
>>>>>>>> repositoryName);
>>>>>>>> if(repository == null){
>>>>>>>> //create repo
>>>>>>>> }else{
>>>>>>>> //use existing repo
>>>>>>>> }
>>>>>>>>
>>>>>>>>
>>>>>>>> but I get an exception:
>>>>>>>>
>>>>>>>> org.eclipse.net4j.util.container.FactoryNotFoundException: Factory
>>>>>>>> not
>>>>>>>> found: org.eclipse.emf.cdo.server.repositories[default]
>>>>>>>>
>>>>>>>>
>>>>>>>> cheers,
>>>>>>>>
>>>>>>>> steven
Re: [CDO] query server for existing repository [message #431580 is a reply to message #431575] Fri, 17 July 2009 11:36 Go to previous message
Stefan Winkler is currently offline Stefan WinklerFriend
Messages: 307
Registered: July 2009
Location: Germany
Senior Member
Hi Steven,
> I am using ganymede.
That may be the problem as the bug you describe (lock exception after
restart) is actually exactly the one, we fixed in Bug 276926:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=276926


So, if you encounter related issues again in the future, I suggest
updating to Gallileo.

Cheers,
Stefan


>
>>
>> If you are using galileo, can you describe the context a bit more?
>> Do you run a single-user application or are there other concurrent
>> users?
>>
>> The line in the stack trace does a "INSERT IGNORE INTO cdo_objects VALUES
>> (cdoid, class_metaId).
>> The Derby documentation states that insert will acquire a row lock for
>> the new row.
>> I currently don't understand why acquiring such a lock could cause a
>> deadlock. :-(
>>
>> The only thing which could be possible would be:
>>
>> "Derby locks single rows for INSERT statements, holding each row until
>> the transaction is committed. (If there is an index associated with the
>> table, the previous key is also locked.)"
>> [ http://db.apache.org/derby/docs/10.0/manuals/develop/develop 74.html]
>>
>> So the previous key (cdo_id) is also locked. If that key is not locked
>> as part of the current transaction, but as part of another transaction,
>> the current transaction waits for the other transaction to finish. If
>> this times out (derby standard is 10s, AFAIK), you get the said
>> Exception.
>>
>>
>> So, do you think this case is possible? Do you do huge transactions in
>> parallel?
>>
>
> No huge transaction. Currently, I am only testing with a small
> workload: insert around 5 models and having registered adapters
> listening for notifications.
> The weird thing is, that if I create a fresh derby database,
> everything works fine. I can constantly insert models without a
> deadlock. if the server is stopped, and then restarted using the
> existing database, the lock-exception occurs (sometimes) at the
> insertion of the first model.
> but, as I wrote in the other mail, I am using H2, now; and this is fine
> for me!
>
> thx for your support eike & stefan!!
>
> cheers,
>
> steven
>
>>
>> Also, in order to analyse the problem, you could set the properties
>> derby.locks.monitor=true and *derby.language.logStatementText=true*
>> *then information about acquired locks and locks causing the deadlock
>> are written to derby.log.*
>> **
>> **
>> *Cheers,*
>> *Stefan*
>> **
>>
>>
>>
>>
>>
>> steven schrieb:
>>> eike,
>>>
>>> it helped!
>>> but .. I am having a different problem:
>>>
>>> I can store some models on the server properly, but
>>> after some (the concrete number is not deterministic) models
>>> have been inserted I get the following exception:
>>>
>>> [ERROR] Rollback in DBStore: org.eclipse.net4j.db.DBException: SQL
>>> Exception: A lock could not be obtained within the time requested
>>> at
>>> org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ob jectTypeCache.putObjectType(ObjectTypeCache.java:137)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ab stractHorizontalMappingStrategy.putObjectType(AbstractHorizo ntalMappingStrategy.java:69)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ab stractHorizontalClassMapping.writeRevision(AbstractHorizonta lClassMapping.java:326)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write Revision(DBStoreAccessor.java:355)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write Revisions(DBStoreAccessor.java:337)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.spi.server.StoreAccessor.write(StoreAcce ssor.java:142)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.acces s$4(DBStoreAccessor.java:1)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor$1.run Loop(DBStoreAccessor.java:80)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor$1.run Loop(DBStoreAccessor.java:1)
>>>
>>>
>>> at
>>> org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(Pr ogressDistributor.java:96)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.server.internal.db.DBStoreAccessor.write (DBStoreAccessor.java:294)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.server.TransactionCommitContext Impl.write(TransactionCommitContextImpl.java:269)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication$1.runLoop(CommitTransactionIndication.java:73)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication$1.runLoop(CommitTransactionIndication.java:1)
>>>
>>>
>>> at
>>> org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(Pr ogressDistributor.java:96)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication.indicatingCommit(CommitTransactionIndication.ja va:325)
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication.indicating(CommitTransactionIndication.java:198 )
>>>
>>>
>>> at
>>> org.eclipse.emf.cdo.internal.server.protocol.CommitTransacti onIndication.indicating(CommitTransactionIndication.java:140 )
>>>
>>>
>>> at
>>> org.eclipse.net4j.signal.IndicationWithMonitoring.indicating (IndicationWithMonitoring.java:84)
>>>
>>>
>>> at
>>> org.eclipse.net4j.signal.IndicationWithResponse.doExtendedIn put(IndicationWithResponse.java:90)
>>>
>>>
>>> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
>>> at
>>> org.eclipse.net4j.signal.IndicationWithResponse.execute(Indi cationWithResponse.java:63)
>>>
>>>
>>> at
>>> org.eclipse.net4j.signal.IndicationWithMonitoring.execute(In dicationWithMonitoring.java:63)
>>>
>>>
>>> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
>>> at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
>>> at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Threa dPoolExecutor.java:885)
>>>
>>>
>>> at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo lExecutor.java:907)
>>>
>>>
>>> at java.lang.Thread.run(Thread.java:619)
>>> Caused by: SQL Exception: A lock could not be obtained within the time
>>> requested
>>> at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unkno wn
>>> Source)
>>> at
>>> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQL Exception(Unknown
>>>
>>> Source)
>>> at
>>> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleExc eption(Unknown
>>>
>>> Source)
>>> at
>>> org.apache.derby.impl.jdbc.EmbedConnection.handleException(U nknown
>>> Source)
>>> at
>>> org.apache.derby.impl.jdbc.ConnectionChild.handleException(U nknown
>>> Source)
>>> at
>>> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(U nknown
>>> Source)
>>> at
>>> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeSta tement(Unknown
>>>
>>> Source)
>>> at
>>> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpd ate(Unknown
>>> Source)
>>> at
>>> org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.Ob jectTypeCache.putObjectType(ObjectTypeCache.java:128)
>>>
>>>
>>> ... 27 more
>>>
>>>
>>> why the lock not be obtained, although some models could be stored?
>>>
>>>
>>> cheers,
>>>
>>> steven
>>>
>>> Eike Stepper wrote:
>>>> Steven,
>>>>
>>>> Neither CDOResources nor CDOResourceFolders should be created manually
>>>> by you. You should never use EresourceFactory directly.
>>>>
>>>> CDOResources are created automatically, either with
>>>> ResourceSet.createResource(uri),
>>>> CDOTransaction.createResource(path) or
>>>> CDOTransaction.getOrCreateResource(path). CDOResourceFolders are
>>>> created
>>>> implicitely when you create a CDOResource with slashes in its path.
>>>>
>>>> Please try this:
>>>>
>>>> protected void createRepositoryStructure() {
>>>> CDOTransaction transaction = session.openTransaction();
>>>> transaction.getOrCreateResource(SOL_ARCH_FOLDER_NAME +
>>>> "/SolArchResource");
>>>> transaction.commit();
>>>> transaction.close();
>>>> }
>>>>
>>>> Or this, if you need access to the folder:
>>>>
>>>> protected void createRepositoryStructure() {
>>>> CDOTransaction transaction = session.openTransaction();
>>>> CDOResource solArchResource =
>>>> transaction.getOrCreateResource(SOL_ARCH_FOLDER_NAME +
>>>> "/SolArchResource");
>>>> CDOResourceFolder solArchFolder = solArchResource.getFolder();
>>>> solArchFolder.xyz();
>>>>
>>>> transaction.commit();
>>>> transaction.close();
>>>> }
>>>>
>>>>
>>>> Does this help?
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>> ----
>>>> http://thegordian.blogspot.com
>>>> http://twitter.com/eikestepper
>>>>
>>>>
>>>> steven schrieb:
>>>>> eike,
>>>>>
>>>>> I am executing the same java statements, but if I stop the server
>>>>> in the osgi console and start it again, I get the exception I
>>>>> appended
>>>>> at the end.
>>>>> the exception is thrown when I check if my repository's structure has
>>>>> already been created:
>>>>>
>>>>> protected void createRepositoryStructure() {
>>>>> CDOTransaction transaction = null;
>>>>> if(!view.hasResource(SOL_ARCH_FOLDER_NAME)){//exception thrown here
>>>>> transaction = session.openTransaction();
>>>>> CDOResourceFolder solArchfolder =
>>>>> EresourceFactory.eINSTANCE.createCDOResourceFolder();
>>>>> solArchfolder.setName(SOL_ARCH_FOLDER_NAME);
>>>>> EList<EObject> rootContent =
>>>>> transaction.getRootResource().getContents();
>>>>> rootContent.add(solArchfolder);
>>>>> transaction.commit();
>>>>> transaction.close();
>>>>> }
>>>>> }
>>>>>
>>>>> so, initially the method createRepositoryStructure() works fine,
>>>>> but then it crashes with the following exception:
>>>>>
>>>>> [ERROR] EOFException
>>>>> java.io.EOFException
>>>>> at java.io.DataInputStream.readBoolean(DataInputStream.java:227 )
>>>>> at
>>>>> org.eclipse.net4j.util.io.ExtendedDataInput$Delegating.readB oolean(ExtendedDataInput.java:55)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.cdo.internal.common.io.CDODataInputImpl.read CDORevision(CDODataInputImpl.java:214)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:116)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:1)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientRequest .confirming(CDOClientRequest.java:77)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.net4j.signal.RequestWithConfirmation.doExtendedI nput(RequestWithConfirmation.java:123)
>>>>>
>>>>>
>>>>> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
>>>>> at
>>>>> org.eclipse.net4j.signal.RequestWithConfirmation.doExecute(R equestWithConfirmation.java:103)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.net4j.signal.SignalActor.execute(SignalActor.jav a:66)
>>>>> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
>>>>> at
>>>>> org.eclipse.net4j.signal.SignalProtocol.startSignal(SignalPr otocol.java:421)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.net4j.signal.RequestWithConfirmation.doSend(Requ estWithConfirmation.java:87)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.net4j.signal.RequestWithConfirmation.send(Reques tWithConfirmation.java:73)
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:286)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:319)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.loadRevisions(CDOClientProtocol.java:110)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevisions(CDORevisionManagerImpl.java:124)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevision(CDORevisionManagerImpl.java:106)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:155)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:1)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getRevision(CD OViewImpl.java:682)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getLocalRevisi on(CDOViewImpl.java:561)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:508)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eIDChecked(CDOViewImpl.java:447)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:435)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.hasResource(CD OViewImpl.java:376)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> de.hpi.sam.mdcm.cmdb.repository.Repository.createRepositoryS tructure(Repository.java:49)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> de.hpi.sam.mdcm.cmdb.repository.Repository.<init>(Repository.java:31)
>>>>> at
>>>>> de.hpi.sam.mdcm.cmdb.server.internal.CMDBServer.createReposi tory(CMDBServer.java:138)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> de.hpi.sam.mdcm.cmdb.server.internal.Activator.start(Activat or.java:38)
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:1009)
>>>>>
>>>>>
>>>>>
>>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:1003)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:984)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:265)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:257)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.FrameworkCommandPro vider._start(FrameworkCommandProvider.java:257)
>>>>>
>>>>>
>>>>>
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> at
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>>>>>
>>>>>
>>>>>
>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:150)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:302)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.co nsole(FrameworkConsole.java:287)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:223)
>>>>>
>>>>>
>>>>>
>>>>> at java.lang.Thread.run(Thread.java:619)
>>>>> !ENTRY org.eclipse.net4j 4 0 2009-07-15 12:09:16.179
>>>>> !MESSAGE EOFException
>>>>> !STACK 0
>>>>> java.io.EOFException
>>>>> at java.io.DataInputStream.readBoolean(DataInputStream.java:227 )
>>>>> at
>>>>> org.eclipse.net4j.util.io.ExtendedDataInput$Delegating.readB oolean(ExtendedDataInput.java:55)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.cdo.internal.common.io.CDODataInputImpl.read CDORevision(CDODataInputImpl.java:214)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:116)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.net4j.protocol.LoadRevisionRequ est.confirming(LoadRevisionRequest.java:1)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientRequest .confirming(CDOClientRequest.java:77)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.net4j.signal.RequestWithConfirmation.doExtendedI nput(RequestWithConfirmation.java:123)
>>>>>
>>>>>
>>>>>
>>>>> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:312)
>>>>> at
>>>>> org.eclipse.net4j.signal.RequestWithConfirmation.doExecute(R equestWithConfirmation.java:103)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.net4j.signal.SignalActor.execute(SignalActor.jav a:66)
>>>>> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:239)
>>>>> at
>>>>> org.eclipse.net4j.signal.SignalProtocol.startSignal(SignalPr otocol.java:421)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.net4j.signal.RequestWithConfirmation.doSend(Requ estWithConfirmation.java:87)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.net4j.signal.RequestWithConfirmation.send(Reques tWithConfirmation.java:73)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:286)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.send(CDOClientProtocol.java:319)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtoco l.loadRevisions(CDOClientProtocol.java:110)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevisions(CDORevisionManagerImpl.java:124)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl. loadRevision(CDORevisionManagerImpl.java:106)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:155)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionReso lverImpl.getRevision(CDORevisionResolverImpl.java:1)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getRevision(CD OViewImpl.java:682)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getLocalRevisi on(CDOViewImpl.java:561)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:508)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eIDChecked(CDOViewImpl.java:447)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.getResourceNod eID(CDOViewImpl.java:435)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.view.CDOViewImpl.hasResource(CD OViewImpl.java:376)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> de.hpi.sam.mdcm.cmdb.repository.Repository.createRepositoryS tructure(Repository.java:49)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> de.hpi.sam.mdcm.cmdb.repository.Repository.<init>(Repository.java:31)
>>>>> at
>>>>> de.hpi.sam.mdcm.cmdb.server.internal.CMDBServer.createReposi tory(CMDBServer.java:138)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> de.hpi.sam.mdcm.cmdb.server.internal.Activator.start(Activat or.java:38)
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:1009)
>>>>>
>>>>>
>>>>>
>>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:1003)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:984)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:265)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:257)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.FrameworkCommandPro vider._start(FrameworkCommandProvider.java:257)
>>>>>
>>>>>
>>>>>
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> at
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>>>>>
>>>>>
>>>>>
>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:150)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:302)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.co nsole(FrameworkConsole.java:287)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:223)
>>>>>
>>>>>
>>>>>
>>>>> at java.lang.Thread.run(Thread.java:619)
>>>>>
>>>>>
>>>>> what am I missing?
>>>>>
>>>>>
>>>>> cheers,
>>>>>
>>>>> steven
>>>>>
>>>>>
>>>>> Eike Stepper wrote:
>>>>>> Steven,
>>>>>>
>>>>>> There is no magic in CDO that does this automatically. *You* must do
>>>>>> that by executing the same Java statements that you initially
>>>>>> executed.
>>>>>>
>>>>>> Cheers
>>>>>> /Eike
>>>>>>
>>>>>> ----
>>>>>> http://thegordian.blogspot.com
>>>>>> http://twitter.com/eikestepper
>>>>>>
>>>>>>
>>>>>>
>>>>>> steven schrieb:
>>>>>>> eike,
>>>>>>>
>>>>>>> comments below ..
>>>>>>>
>>>>>>> Eike Stepper wrote:
>>>>>>>> Steven,
>>>>>>>>
>>>>>>>> There's no single and mandatory way to create repositories or make
>>>>>>>> them
>>>>>>>> available on a server. They are no operating services by
>>>>>>>> themselves so
>>>>>>>> they do not automatically appear after a server restart, unless
>>>>>>>> you
>>>>>>>> ensure that the repository is started again, too.
>>>>>>> that's what I want .. how I can start a repository again;
>>>>>>> respectively,
>>>>>>> how can I restart all previously created repositories after a
>>>>>>> server
>>>>>>> restart?
>>>>>>>
>>>>>>> cheers,
>>>>>>>
>>>>>>> steven
>>>>>>>
>>>>>>>> If, after starting a repository, you put it into an
>>>>>>>> IManagedContainer
>>>>>>>> you can query the container, as you try it below. But a repository
>>>>>>>> does
>>>>>>>> not automatically end up registered with such a container. You'd
>>>>>>>> have to
>>>>>>>> register it there for example with
>>>>>>>> CDOServerUtil.addRepository(IManagedContainer, IRepository).
>>>>>>>>
>>>>>>>> You could also use the OSGi service registry or a Spring
>>>>>>>> application
>>>>>>>> context or your own mechanism...
>>>>>>>>
>>>>>>>> Cheers
>>>>>>>> /Eike
>>>>>>>>
>>>>>>>> ----
>>>>>>>> http://thegordian.blogspot.com
>>>>>>>> http://twitter.com/eikestepper
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> steven schrieb:
>>>>>>>>> hi folks,
>>>>>>>>>
>>>>>>>>> how can I check if a cdo server already contains a repository?
>>>>>>>>>
>>>>>>>>> my scenario is the following:
>>>>>>>>>
>>>>>>>>> 1. start server
>>>>>>>>> 2. create repository "repo1"
>>>>>>>>> 3. shutdown server
>>>>>>>>> 4. restart server
>>>>>>>>> 5. open "repo1"
>>>>>>>>>
>>>>>>>>> I tried the following:
>>>>>>>>>
>>>>>>>>> IRepository repository = CDOServerUtil.getRepository(container,
>>>>>>>>> repositoryName);
>>>>>>>>> if(repository == null){
>>>>>>>>> //create repo
>>>>>>>>> }else{
>>>>>>>>> //use existing repo
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> but I get an exception:
>>>>>>>>>
>>>>>>>>> org.eclipse.net4j.util.container.FactoryNotFoundException:
>>>>>>>>> Factory
>>>>>>>>> not
>>>>>>>>> found: org.eclipse.emf.cdo.server.repositories[default]
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> cheers,
>>>>>>>>>
>>>>>>>>> steven
Previous Topic:edit FeatureMap Text feature from text field in a form
Next Topic:No packages listed when importing from annotated java
Goto Forum:
  


Current Time: Thu Mar 28 13:27:21 GMT 2024

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

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

Back to the top