Document attachments in a form or process

Latest response

Hi,

I was trying to add document attachments based on https://access.redhat.com/documentation/en-us/red_hat_process_automation_manager/7.5/html/designing_business_processes_in_business_central/business-process-forms

The form specified a full directory in front of file name

I can attach a document in a form but the document was failed to be created in RHPAM:
15:03:41,462 ERROR [org.jbpm.document.service.impl.DocumentStorageServiceImpl] (default task-2) Error writing file D:\test\a.pdf: {}: java.io.IOException: Directory '.docs\388f4d34-b732-48d6-b898-d00fd8bb1cf3\D:\test' could not be created
at org.apache.commons.io.FileUtils.openOutputStream(FileUtils.java:361)
at org.apache.commons.io.FileUtils.writeByteArrayToFile(FileUtils.java:2222)
at org.apache.commons.io.FileUtils.writeByteArrayToFile(FileUtils.java:2186)
at org.apache.commons.io.FileUtils.writeByteArrayToFile(FileUtils.java:2171)
at org.jbpm.document.service.impl.DocumentStorageServiceImpl.saveDocument(DocumentStorageServiceImpl.java:87)
at org.jbpm.document.marshalling.DocumentMarshallingStrategy.marshal(DocumentMarshallingStrategy.java:73)
at org.jbpm.marshalling.impl.ProtobufProcessMarshaller.marshallVariable(ProtobufProcessMarshaller.java:269)
at org.jbpm.marshalling.impl.AbstractProtobufProcessInstanceMarshaller.writeProcessInstance(AbstractProtobufProcessInstanceMarshaller.java:164)
at org.jbpm.marshalling.impl.AbstractProtobufProcessInstanceMarshaller.writeProcessInstance(AbstractProtobufProcessInstanceMarshaller.java:75)
at org.jbpm.persistence.processinstance.ProcessInstanceInfo.transform(ProcessInstanceInfo.java:244)
at org.drools.persistence.TriggerUpdateTransactionSynchronization.beforeCompletion(TriggerUpdateTransactionSynchronization.java:61)
at org.drools.persistence.jta.JtaTransactionSynchronizationAdapter.beforeCompletion(JtaTransactionSynchronizationAdapter.java:54)
at org.jboss.as.txn.service.internal.tsr.JCAOrderedLastSynchronizationList.beforeCompletion(JCAOrderedLastSynchronizationList.java:113)
at org.wildfly.transaction.client.AbstractTransaction.performConsumer(AbstractTransaction.java:236)
at org.wildfly.transaction.client.AbstractTransaction.performConsumer(AbstractTransaction.java:247)
at org.wildfly.transaction.client.AbstractTransaction$AssociatingSynchronization.beforeCompletion(AbstractTransaction.java:292)
at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:360)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:91)
at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:162)
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1287)
at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:126)

Responses

Hi Rudyanto,

by looking at the path '.docs\388f4d34-b732-48d6-b898-d00fd8bb1cf3\D:\test' which is constructed from document storage path + document identifier + document name it seems that for some reason you specified the document name to be 'D:\test\a.pdf'. Can you specify the document name to be just a.pdf? Then the directory to save a document would look like '.docs\388f4d34-b732-48d6-b898-d00fd8bb1cf3' which is a valid path.

Marian

Hi Marian,

I have edited my post to show the form that I used to create the process instance.

This form is generated by RHPAM from a business process that was defined in BPMN. Do you know how to fix it so I can specify the document name to be just a.pdf?

Best Regards, Rudy

I have just tried the same scenario on Linux (Fedora) and the issue is not present there. So it seems it's an issue specific to Windows environment. I have created a JIRA to track this issue: https://issues.redhat.com/browse/RHPAM-3117.

Feel free to add any comments you have there. Thanks for letting us know!

Marian

Hi Marian,

Thank you so much. You have identified it as a bug.

One more thing. Maciej said that we can call Kie Server Rest API to upload document : http://mswiderski.blogspot.com/2016/08/kie-server-jbpm-extension-brings.html

But I did not find this address : http://localhost:8080/kie-server/services/rest/server/containers/translations/processes/translations/instances

I have tried to look at this url also : http://localhost:8080/kie-server/docs/ but I still can't find Maciej's URL.

Do you think it is another bug? Or now RHPAM has a new URL for it?

Best Regards, Rudy

Hi Rudy,

the URL is definitely there, but it changes according to your project name, so in general it looks like this:

http://localhost:8080/kie-server/services/rest/server/containers/{nameOfContainer}/processes/{nameOfProcessDefinition}/instances

Maciej's container and process definition were called translations in his example. You should alter the URL to your use case.

Marian

Hi Marian,

I bet you have an eagle eye. Others won't see what you means because your url is different with the one that was sent to my email adress. I think you should report it as a bug also :)

I will try my best to describe the link : http://localhost:8080/kie-server/services/rest/server/containers/ {nameOfContainer}/processes/{nameOfProcessDefinition}/instances

Best Regards, Rudy

Hi Rudy,

I tried to reproduce the issue by following the steps in the documentation you mentioned, but I'm unable to reproduce it in my Windows 10 instance. Can you please send us a video recording and details of your environment you are using.

Thanks, Abhishek

Thanks for the reminder, I didn't check the rendered response after I posted the message, corrected now.

Hi Rudy,

I tried to reproduce the issue by following the steps in the documentation you mentioned, but I'm unable to reproduce it in my Windows 10 instance. Can you please send us a video recording and details of your environment you are using.

Thanks, Abhishek

I will post the video recording later.

My environment is : 1) Windows 10 Pro 2) JBossEAP version 7.3 3) RHPAM version 7.8

Hope you will find that error also.

Thanks, Rudy

Hi Rudy,

Can you please send us the video, it will be helpful for us to debug this issue quickly :)

Thanks, Abhishek

Hi Abhishek,

I think you had found the problem and fixed it. Suddenly this problem is solved in my computer.

I guess RedHat had made patches for this problem. Well done :)

Thanks, Rudy