It's all about the answers!

Ask a question

Delete Build Definition via API


Andrea Gabrielli (1111) | asked Jun 14 '11, 12:42 p.m.
edited Jul 26 '16, 12:06 p.m. by David Lafreniere (4.8k7)
Hi,

I created a postop workitem save extension (server-side) that deletes a Build Definition item.
To do this I use the internal ITeamBuildService.

ITeamBuildService buildService = getService(ITeamBuildService.class);

...
buildService.delete(buildDefinition);



And I obtain an IllegalStateException exception:

Quote:

java.lang.IllegalStateException: Illegal transaction in progress for service method call.
at com.ibm.team.repository.service.internal.TransactionService.checkValidTransaction(TransactionService.java:83)
at sun.reflect.GeneratedMethodAccessor132.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)



Any idea?

Thanks,
Andrea
_________________
Andrea Gabrielli

Nexen
Business Consultant

3 answers



permanent link
SEC Servizi (97123559) | answered Jul 01 '15, 3:22 a.m.
edited Jul 01 '15, 3:30 a.m.
We got the same exception trying to query from an event handler the build requests in queue:
	java.lang.IllegalStateException: Illegal transaction in progress for service method call.
	at com.ibm.team.repository.service.internal.PrimitiveTransactionService.checkValidTransaction(PrimitiveTransactionService.java:86)
	at sun.reflect.GeneratedMethodAccessor290.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.checkValidTransaction(Unknown Source)
	at com.ibm.team.repository.service.AbstractService.checkValidTransaction(AbstractService.java:234)
	at com.ibm.team.build.internal.service.TeamBuildService.getQueryPageForBuildResultsFromBuildQueryCriteria(TeamBuildService.java:2230)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
	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.$Proxy1040.getQueryPageForBuildResultsFromBuildQueryCriteria(Unknown Source)
	at it.secservizi.rtc.open.server.event.stateChanged.BuildLaunch.waitPendingBuilds(BuildLaunch.java:611)
	at it.secservizi.rtc.open.server.event.stateChanged.BuildLaunch.retrieveLastBuildResult(BuildLaunch.java:565)
	at it.secservizi.rtc.open.server.event.stateChanged.BuildLaunch.handleEvent(BuildLaunch.java:505)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
	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.$Proxy1258.handleEvent(Unknown Source)
	at com.ibm.team.process.internal.service.ServerProcess.handleChangeEvent(ServerProcess.java:494)
	at com.ibm.team.process.internal.service.ProcessService$13.run(ProcessService.java:4642)
	at com.ibm.team.repository.service.internal.PrimitiveTransactionService$3.run(PrimitiveTransactionService.java:163)
	at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase.runTransaction(RepositoryDatabase.java:347)
	at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase.runInTransaction(RepositoryDatabase.java:271)
	at com.ibm.team.repository.service.internal.PrimitiveTransactionService.runInTransaction(PrimitiveTransactionService.java:96)
	at com.ibm.team.repository.service.internal.PrimitiveTransactionService.runInTransaction(PrimitiveTransactionService.java:91)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
	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:37)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
	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.$Proxy823.runInTransaction(Unknown Source)
	at com.ibm.team.process.internal.service.ProcessService.runInTransaction(ProcessService.java:4786)
	at com.ibm.team.process.internal.service.ProcessService.doProcessChangeEvent(ProcessService.java:4638)
	at com.ibm.team.process.internal.service.ProcessService.doProcessChangeEvents(ProcessService.java:4574)
	at com.ibm.team.process.internal.service.ProcessService$12.run(ProcessService.java:4527)
	at com.ibm.team.repository.service.internal.PrimitiveTransactionService$3.run(PrimitiveTransactionService.java:163)
	at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase$Transaction.run(RepositoryDatabase.java:496)
	at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase$1.run(RepositoryDatabase.java:320)
	at com.ibm.team.repository.service.internal.rdb.ConnectionPoolService.withCurrentConnection(ConnectionPoolService.java:448)
	at sun.reflect.GeneratedMethodAccessor55.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.$Proxy121.withCurrentConnection(Unknown Source)
	at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase.runTransaction(RepositoryDatabase.java:316)
	at com.ibm.team.repository.service.internal.rdb.RepositoryDatabase.runInTransaction(RepositoryDatabase.java:271)
	at com.ibm.team.repository.service.internal.PrimitiveTransactionService.runInTransaction(PrimitiveTransactionService.java:96)
	at com.ibm.team.repository.service.internal.PrimitiveTransactionService.runInTransaction(PrimitiveTransactionService.java:91)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
	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:37)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
	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.$Proxy823.runInTransaction(Unknown Source)
	at com.ibm.team.process.internal.service.ProcessService.runInTransaction(ProcessService.java:4786)
	at com.ibm.team.process.internal.service.ProcessService.processChangeEvents(ProcessService.java:4525)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
	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.$Proxy1025.processChangeEvents(Unknown Source)
	at com.ibm.team.process.internal.service.ProcessChangeEventsTask.runTask(ProcessChangeEventsTask.java:36)
	at com.ibm.team.repository.service.async.AbstractAutoScheduledTask.executeTask(AbstractAutoScheduledTask.java:92)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
	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.$Proxy1028.executeTask(Unknown Source)
	at com.ibm.team.repository.service.internal.scheduler.AsynchronousTaskRunner.runTask(AsynchronousTaskRunner.java:158)
	at com.ibm.team.repository.service.internal.scheduler.AsynchronousTaskRunner.run(AsynchronousTaskRunner.java:119)
	at java.lang.Thread.run(Thread.java:761)
It's most likely due to the delete wanting to start a write transaction when an outer read transaction has already been started. 
In our case, why should it be blocked if we started a read transaction (and not a write one)?
Thanks in advance.

Comments
SEC Servizi commented Jul 01 '15, 11:38 a.m.

We resolved using a IBuildResultQueryModel instance.

Cheers.


permanent link
Scott Crouch (48532326) | answered Jul 31 '13, 6:45 p.m.
 Was anybody ever able to get this working? We're hitting the same issue doing basically the same use case that Andrea described. Could it have to do with it being done from an Event Handle? 

permanent link
Nick Edgar (6.5k711) | answered Jun 17 '11, 11:27 a.m.
JAZZ DEVELOPER
It's most likely due to the delete wanting to start a write transaction when an outer read transaction has already been started. That's puzzling, though, because as far as I know the operation participants (i.e. your extension) run in the same write transaction as the original operation (i.e. the work item save), so doing another write transaction within that should work OK.

Your answer


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.