AnsweredAssumed Answered

Read-Write transaction started within read-only transaction

Question asked by ceeliro on Aug 28, 2014
Latest reply on Aug 29, 2014 by ceeliro
Hi All, thanks for reading

Time ago I created a custom-transformer and added to the end of the chain of some fail-over transformers to make some jobs (send email, replace the content of the document with an default content, add aspect, etc) if the content cannot be transform for some reason (encrypted, corrupted, etc) It used to work like a charm for community 4.2.d but since I upgraded to the community 5.0.a it doesn't work anymore (I updated all the old configuration for transformers to the new mechanism in the The thing is that my custom transformer is still called if something is going wrong but fails to add the custom aspect, reason: Read-Write transaction started within read-only transaction. I know that the exception it is produced when applying the aspect but don't know how to sort it out. Any help?

Excuse my english

public class NotSupportedContentTransformer extends AbstractContentTransformer2 {

protected void transformInternal(ContentReader reader,
        ContentWriter writer, TransformationOptions options) throws Exception {

   // At this point we know that something went wrong so lets give a shout
   // to the Work-Group administrators to let them know…
   String fileName = this.serviceRegistry.getFileFolderService().getFileInfo(
   sendFailedThumbnailNotification(fileName, options.getSourceNodeRef());
   InputStream input = this.getClass().getClassLoader().getResourceAsStream(corruptedFileTemplate);
   OutputStream output = writer.getContentOutputStream();
        IOUtils.copy(input, output);
       // if everything is O.K. we apply the aspect "icmr:emcryptedContet". Even if it is not encrypted but corrupted
       try {
                IcmrModel.ASPECT_ENCRYPTED_CONTENT, null);
       } catch (Exception e) {
          log.error("Unexpected error", e);