It's all about the answers!

Ask a question

Getting a Internal Repository Exception when trying to lock a resource from a deliver follow up action


Francisco Rodriguez (561528) | asked Oct 28 '15, 7:47 p.m.
edited Oct 29 '15, 12:42 p.m.
 Hi, 

I developed a follow up plugin for the deliver action in RTC whose main method is the following in order to lock resources:

private static void applyLock(IScmService scmService,
 IWorkspaceHandle workspaceHandle,
 IComponentHandle componentHandle, 
 IContributorHandle contrHandle,
 IVersionable versionable,
 IRepositoryProgressMonitor repositoryMonitor) throws TeamRepositoryException {
 
LockParameter lockParameter = ScmDtoFactory.eINSTANCE.createLockParameter();
WorkspaceLocks workspaceLocks = ScmDtoFactory.eINSTANCE.createWorkspaceLocks();
workspaceLocks.setWorkspace(workspaceHandle);
ComponentLocks componentLocks = ScmDtoFactory.eINSTANCE.createComponentLocks();
componentLocks.setComponent(componentHandle); 
ContributorLocks contributorLocks = ScmDtoFactory.eINSTANCE.createContributorLocks();
contributorLocks.setContributor(contrHandle);

contributorLocks.getVersionables().add(versionable);
componentLocks.getContributorLocks().add(contributorLocks);
workspaceLocks.getComponentLocks().add(componentLocks); 
lockParameter.getToAcquire().add(workspaceLocks); 
scmService.updateLocks(lockParameter, repositoryMonitor);

}//applyLock


but I am getting the following exception:

		2015-10-28 17:41:32,612 [http-bio-9443-exec-11 @@ 17:41 <unauthenticated> <Jakarta Commons-HttpClient/3.1@10.51.82.143> /ccm/service/com.ibm.team.scm.common.IScmService] ERROR al.db.metadata.config.ConfigurationMediatorService  - CRRTC5002E: Internal Repository Exception encountered
	
		com.ibm.team.repository.common.InternalRepositoryException: Updated unexpected number of rows in Configuration table
	
at com.ibm.team.scm.service.internal.db.metadata.config.ConfigurationMediatorService.jdbcUpdateConfigurationPrimary(ConfigurationMediatorService.java:1104)
at com.ibm.team.scm.service.internal.ScmDataMediator.updateConfigurationPrimary(ScmDataMediator.java:849)
at com.ibm.team.scm.service.internal.ScmTransactionContext.save(ScmTransactionContext.java:1809)
at com.ibm.team.scm.service.internal.AbstractScmService$4.run(AbstractScmService.java:636)
at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase$Transaction.run(RepositoryDatabase.java:567)
at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase$2.run(RepositoryDatabase.java:351)
at com.ibm.team.repository.service.internal.rdb.ConnectionPoolService.withCurrentConnection(ConnectionPoolService.java:470)
at sun.reflect.GeneratedMethodAccessor92.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:361)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:347)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56)
at com.sun.proxy.$Proxy116.withCurrentConnection(Unknown Source)
at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase.runTransaction(RepositoryDatabase.java:348)
at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase.runInTransaction(RepositoryDatabase.java:288)
at com.ibm.team.repository.service.internal.PrimitiveTransactionService.runInTransaction(PrimitiveTransactionService.java:96)
at sun.reflect.GeneratedMethodAccessor116.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:361)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:347)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56)
at com.sun.proxy.$Proxy159.runInTransaction(Unknown Source)
at com.ibm.team.repository.service.internal.TransactionService.runInTransaction(TransactionService.java:45)
at sun.reflect.GeneratedMethodAccessor263.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:361)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:347)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56)
at com.sun.proxy.$Proxy281.runInTransaction(Unknown Source)
at com.ibm.team.scm.service.internal.AbstractScmService.runInTransaction(AbstractScmService.java:365)

Does anybody have any idea to solve this?

Regards,
Francisco R.

Comments
Ralph Schoon commented Oct 29 '15, 3:56 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

With this few data, no code and not even the slightest idea what call is done, what do you think?


Francisco Rodriguez commented Oct 29 '15, 12:36 p.m.

 You are right, Ralph. I edited my question. 


Ralph Schoon commented Oct 29 '15, 2:40 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Which line is actually throwing the error? If you follow https://rsjazz.wordpress.com/2015/09/30/learning-to-fly-getting-started-with-the-rtc-java-apis/ you can set up your environment to step by step debug on the Jetty Server and you know which line causes this.


Francisco Rodriguez commented Oct 30 '15, 2:36 p.m.

scmService.updateLocks(lockParameter, repositoryMonitor); is the line that causes the exception. I think I am doing the lock the wrong way but I found no documentation on this topic.


Francisco Rodriguez commented Oct 30 '15, 8:40 p.m. | edited Oct 30 '15, 11:56 p.m.

I think I am missing some kind of commit action. I am really stuck into this, can any Jazz developer just give me any idea?


Ralph Schoon commented Nov 02 '15, 3:31 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

If you look at the SDK com.ibm.team.filesystem.service.internal.rest.FilesystemRestService2 you will see that the method is running in a transaction.

In com.ibm.team.filesystem.service.tests.internal.FilesystemRestService2Test it is not but there is an example how it is run. You can try to debug com.ibm.team.scm.service.internal.ScmService.updateLocks(LockParameter, IRepositoryProgressMonitorHandle).

Just some thoughts as I haven't used this.

showing 5 of 6 show 1 more comments

Be the first one to answer this question!


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.