Problem when saving WorkItem: Modification prohibited in ReadOnly Transaction

Posts: 20
Joined: Thu Jan 18, 2018 11:02 am
Location: Frauenauracher Str. 85, 91056 Erlangen

Problem when saving WorkItem: Modification prohibited in ReadOnly Transaction

Postby PatrickClaus » Wed Mar 14, 2018 9:35 am

Hello all,

hopefully, someone can help me with a specific problem we encountered just recently, when switching to Polarion ALM 17.3.3.

First off, we have a WorkFlow Function defined in our Project, that is supposed to copy an Attachment from a relative path in the repository to the Attachment of the Workitem, when creating and thus initially saving said workitem.
The code is as follows:

Code: Select all

//Retrieve current Workitem + ID
var wi = workflowContext.getWorkItem();
var wiId = wi.getId();

//Retrieve Attachment relative Path as URL
var baseUrl = PlatformContext.getPlatform().lookupService(IConfigService.class).getPropertyValue("base.url");
var attachmentRelativePath = arguments.getAsString("attachment.relativePath");

//Getting Repository Service
var repoService = PlatformContext.getPlatform().lookupService(IRepositoryService.class);

//forming Uri from URL+String - the SVN repository Uri is needed
var uri = new URI(baseUrl + attachmentRelativePath);

//Getting location to the Uri
var loc = repoService.getLocationForAccessibleURL(uri)

//Getting the connection to get access to the file
var connection = repoService.getConnection(loc);

//Getting file Input Stream to be able to Store as attachment
var stream = connection.getContent(loc);

//Add as attachment to Uri
wi.createAttachment(wiId + ".xlsm", wiId + ".xlsm", stream).save();

Basically: Get Workitem, get URL for Attachment, retrieve location and content of Attachment as InputStream, save after calling Workitem.createAttachment Method.

This worked on Polarion ALM 16.3 and 17.2 versions.
However, since the switch, we receive the following error:

Server error:

java.lang.UnsupportedOperationException: Modifications are prohibited in read only transaction.

The StackTrace for this error in the Serverlog reports that while saving the Workitem, it seems that an implicit ReadOnly Transaction is called for the save-handling of the workitem:

at com.polarion.portal.server.TransactionalExecuter.executeImpl(
at com.polarion.portal.server.TransactionalExecuter.executeReadOnly(
at com.polarion.alm.server.api.transaction.TransactionalExecutorImpl.executeInReadOnlyTransaction(
at com.polarion.alm.shared.api.transaction.TransactionalExecutor.executeInReadOnlyTransaction(
at com.polarion.alm.tracker.web.internal.server.WorkItemDataProvider.saveWorkItem(
at com.polarion.alm.ui.server.tracker.WorkItemDataServiceImpl.saveWorkItemInternal(

Most curiosly, the workitem is still saved however, and the attachment is created for the workitem as well, when refreshing the workitem query page, as can be seen here:

So, as a summary: The function works, generally, but throws an error while saving the workitem.
I would now like to know - is this a configuration problem? Is there a setting for changing implicit transactions from Readonly to WriteTransactions, or is there a problem with the function code that needs to be updated?

If anyone has an idea on this topic, I'd be really happy to know.
Thanks in advance!
Best Regards,
Patrick Claus

External service provider at Valeo Siemens eAutomotive GmbH
Frauenauracher Str. 85
91056 Erlangen, Germany
Mail Address

Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: Google [Bot], laurennx60 and 9 guests