Hi,
I’m using Bonita Community 2021.1 with openjdk-11.0.2 and I’m trying to integrate it with Alfresco Community - 7.1.0. I’ve updated cmis connectors to the last version, 3.0.5.
I’m able to create a folder and upload files, but I cannot list files from an existing folder. I get the following error message:
Caused by: org.bonitasoft.engine.core.operation.exception.SOperationExecutionException: Document operation only accepts an expression returning a list of DocumentValue
at org.bonitasoft.engine.core.document.api.impl.DocumentHelper.toCheckedList(DocumentHelper.java:329)
at org.bonitasoft.engine.operation.DocumentListLeftOperandHandler.update(DocumentListLeftOperandHandler.java:53)
at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.updateLeftOperands(OperationServiceImpl.java:159)
at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.execute(OperationServiceImpl.java:101)
at org.bonitasoft.engine.core.connector.impl.ConnectorServiceImpl.executeOutputOperation(ConnectorServiceImpl.java:208)
In my pool, I've created a document variable and enabled the multiple type. I used the variable to save the output of the List Documents cmis connector, function “set document list”.
Finally, testing the connector I get this exception:
java.lang.reflect.InvocationTargetException
java.lang.reflect.UndeclaredThrowableException
java.io.IOException: Error while executing POST request (http code: 500) <POST http://localhost:2323/bonita/serverAPI/org.bonitasoft.engine.api.ProcessAPI/executeConnectorOnProcessDefinition HTTP/1.1>
org.apache.http.client.HttpResponseException: status code: 500
Thanks for your help,
JFC
Hi,
The List documents
connector returns a List of org.apache.chemistry.opencmis.client.api.CmisObject
Looking the javadoc for this object, it doesn’t seem that it returns the document content. It is just to list them (with their properties).
You may want to use it in combination of Download document
connector.
HTH
Romain
hello this is what i try to do but don't know how to access content
and transform the result to List<DocumentValue>
def listDocs = folder_documents.collect {
[
new DocumentValue("example".getBytes(), "application/pdf", it.name)//Internal
]
}
return listDocs;
Hi Romain,
Thank you for you answer.
Following your directions, I've created a process variable (multiple) of type Java Object, selecting the class org.apache.chemistry.opencmis.api.CmisObject. And I stored the result of the connector with "Takes value of", but still it's not working.
I've also tried with the class org.bonitasoft.engine.bpm.document.DocumentValue as the firs error was, Document operation only accepts an expression returning a list of DocumentValue, but not working either.
I will fully appreciate if you could give me some more guidelines. I'm not sure if this is the way.
Many thanks,
JFC
(*) Edited to add logs:
09-Aug-2021 17:48:30.238 GRAVE [ConnectorExecutor-1] org.bonitasoft.engine.log.technical.TechnicalLoggerSLF4JImpl.log THREAD_ID=151 | HOSTNAME=LAPTOP-5U | TENANT_ID=1 | The work [ExecuteConnectorOfActivity: flowNodeInstanceId = 20003, connectorDefinitionName = listFolder] failed. The failure will be handled.
09-Aug-2021 17:48:30.266 GRAVE [ConnectorExecutor-1] org.bonitasoft.engine.log.technical.TechnicalLoggerSLF4JImpl.log THREAD_ID=151 | HOSTNAME=LAPTOP-5U | TENANT_ID=1 | org.bonitasoft.engine.core.connector.exception.SConnectorException : "PROCESS_DEFINITION_ID=6073184191200664436 | PROCESS_NAME=ECM-FileList | PROCESS_VERSION=1.0 | PROCESS_INSTANCE_ID=1001 | ROOT_PROCESS_INSTANCE_ID=1001 | FLOW_NODE_DEFINITION_ID=7996447255185126912 | FLOW_NODE_INSTANCE_ID=20003 | FLOW_NODE_NAME=get files from folder | CONNECTOR_IMPLEMENTATION_CLASS_NAME=listFolder | CONNECTOR_INSTANCE_ID=20001 | org.bonitasoft.engine.core.operation.exception.SOperationExecutionException: org.bonitasoft.engine.data.instance.exception.SUpdateDataInstanceException: Impossible to update data instance 'folderFiles': org.bonitasoft.engine.services.SPersistenceException: Problem while updating entity: SXMLObjectDataInstance(value=[]) with id: 5003"
org.bonitasoft.engine.core.connector.exception.SConnectorException: PROCESS_DEFINITION_ID=6073184191200664436 | PROCESS_NAME=ECM-FileList | PROCESS_VERSION=1.0 | PROCESS_INSTANCE_ID=1001 | ROOT_PROCESS_INSTANCE_ID=1001 | FLOW_NODE_DEFINITION_ID=7996447255185126912 | FLOW_NODE_INSTANCE_ID=20003 | FLOW_NODE_NAME=get files from folder | CONNECTOR_IMPLEMENTATION_CLASS_NAME=listFolder | CONNECTOR_INSTANCE_ID=20001 | org.bonitasoft.engine.core.operation.exception.SOperationExecutionException: org.bonitasoft.engine.data.instance.exception.SUpdateDataInstanceException: Impossible to update data instance 'folderFiles': org.bonitasoft.engine.services.SPersistenceException: Problem while updating entity: SXMLObjectDataInstance(value=[]) with id: 5003
at org.bonitasoft.engine.core.connector.impl.ConnectorServiceImpl.executeOutputOperation(ConnectorServiceImpl.java:211)
at org.bonitasoft.engine.connector.ConnectorServiceDecorator.executeOutputOperation(ConnectorServiceDecorator.java:119)
at org.bonitasoft.engine.execution.work.ExecuteConnectorWork.evaluateOutput(ExecuteConnectorWork.java:127)
at org.bonitasoft.engine.execution.work.ExecuteConnectorOfActivity.evaluateOutput(ExecuteConnectorOfActivity.java:75)
at org.bonitasoft.engine.execution.work.ExecuteConnectorWork.lambda$executeOutputOperationsAndContinue$1(ExecuteConnectorWork.java:190)
at org.bonitasoft.engine.transaction.JTATransactionServiceImpl.executeInTransaction(JTATransactionServiceImpl.java:261)
at org.bonitasoft.engine.execution.work.ExecuteConnectorWork.executeOutputOperationsAndContinue(ExecuteConnectorWork.java:189)
at org.bonitasoft.engine.execution.work.ExecuteConnectorWork.lambda$work$0(ExecuteConnectorWork.java:157)
at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture.postComplete(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: org.bonitasoft.engine.core.operation.exception.SOperationExecutionException: org.bonitasoft.engine.data.instance.exception.SUpdateDataInstanceException: Impossible to update data instance 'folderFiles': org.bonitasoft.engine.services.SPersistenceException: Problem while updating entity: SXMLObjectDataInstance(value=[]) with id: 5003
at org.bonitasoft.engine.operation.DataLeftOperandHandler.updateDataInstance(DataLeftOperandHandler.java:106)
at org.bonitasoft.engine.operation.DataLeftOperandHandler.update(DataLeftOperandHandler.java:59)
at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.updateLeftOperands(OperationServiceImpl.java:159)
at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.execute(OperationServiceImpl.java:101)
at org.bonitasoft.engine.core.connector.impl.ConnectorServiceImpl.executeOutputOperation(ConnectorServiceImpl.java:208)
... 13 more
Caused by: org.bonitasoft.engine.data.instance.exception.SUpdateDataInstanceException: Impossible to update data instance 'folderFiles': org.bonitasoft.engine.services.SPersistenceException: Problem while updating entity: SXMLObjectDataInstance(value=[]) with id: 5003
at org.bonitasoft.engine.data.instance.api.impl.DataInstanceServiceImpl.updateDataInstance(DataInstanceServiceImpl.java:535)
at org.bonitasoft.engine.operation.DataLeftOperandHandler.update(DataLeftOperandHandler.java:67)
at org.bonitasoft.engine.operation.DataLeftOperandHandler.updateDataInstance(DataLeftOperandHandler.java:104)
... 17 more
Caused by: org.bonitasoft.engine.recorder.SRecorderException: org.bonitasoft.engine.services.SPersistenceException: Problem while updating entity: SXMLObjectDataInstance(value=[]) with id: 5003
at org.bonitasoft.engine.recorder.impl.RecorderImpl.recordUpdate(RecorderImpl.java:116)
at org.bonitasoft.engine.data.instance.api.impl.DataInstanceServiceImpl.updateDataInstance(DataInstanceServiceImpl.java:532)
... 19 more
Caused by: org.bonitasoft.engine.services.SPersistenceException: Problem while updating entity: SXMLObjectDataInstance(value=[]) with id: 5003
at org.bonitasoft.engine.persistence.AbstractHibernatePersistenceService.setField(AbstractHibernatePersistenceService.java:253)
at org.bonitasoft.engine.persistence.AbstractHibernatePersistenceService.update(AbstractHibernatePersistenceService.java:242)
at org.bonitasoft.engine.recorder.impl.RecorderImpl.recordUpdate(RecorderImpl.java:112)
... 20 more
Caused by: org.bonitasoft.engine.commons.exceptions.SReflectException: java.lang.reflect.InvocationTargetException
at org.bonitasoft.engine.commons.ClassReflector.invokeMethodByName(ClassReflector.java:202)
at org.bonitasoft.engine.commons.ClassReflector.setField(ClassReflector.java:353)
at org.bonitasoft.engine.persistence.AbstractHibernatePersistenceService.setField(AbstractHibernatePersistenceService.java:251)
... 22 more
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.bonitasoft.engine.commons.ClassReflector.invokeMethodByName(ClassReflector.java:200)
... 24 more
Caused by: java.lang.NoClassDefFoundError: javax/xml/ws/handler/HandlerResolver
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.base/java.lang.Class.getDeclaredMethod(Unknown Source)
at com.thoughtworks.xstream.core.util.SerializationMembers.getMethod(SerializationMembers.java:183)
at com.thoughtworks.xstream.core.util.SerializationMembers.getMethod(SerializationMembers.java:188)
at com.thoughtworks.xstream.core.util.SerializationMembers.getMethod(SerializationMembers.java:168)
at com.thoughtworks.xstream.core.util.SerializationMembers.getRRMethod(SerializationMembers.java:199)
at com.thoughtworks.xstream.core.util.SerializationMembers.callWriteReplace(SerializationMembers.java:97)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:78)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:87)
at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeBareItem(AbstractCollectionConverter.java:94)
at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:66)
at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeCompleteItem(AbstractCollectionConverter.java:81)
at com.thoughtworks.xstream.converters.collections.MapConverter.marshal(MapConverter.java:79)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:83)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:270)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:174)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:262)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:90)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:83)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:270)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:174)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:262)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:90)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:83)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:270)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:174)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:262)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:90)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:83)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:270)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:174)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:262)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:90)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:87)
at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeBareItem(AbstractCollectionConverter.java:94)
at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:66)
at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeCompleteItem(AbstractCollectionConverter.java:81)
at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:74)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
at com.thoughtworks.xstream.XStream.marshal(XStream.java:1250)
at com.thoughtworks.xstream.XStream.marshal(XStream.java:1239)
at com.thoughtworks.xstream.XStream.toXML(XStream.java:1212)
at com.thoughtworks.xstream.XStream.toXML(XStream.java:1199)
at org.bonitasoft.engine.data.instance.model.SXMLObjectDataInstance.convert(SXMLObjectDataInstance.java:61)
at org.bonitasoft.engine.data.instance.model.SXMLObjectDataInstance.setValue(SXMLObjectDataInstance.java:57)
... 29 more
Caused by: java.lang.ClassNotFoundException: javax.xml.ws.handler.HandlerResolver
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1358)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)
at org.bonitasoft.engine.classloader.VirtualClassLoader.loadClass(VirtualClassLoader.java:105)
at org.bonitasoft.engine.classloader.BonitaClassLoader.loadClass(BonitaClassLoader.java:175)
at org.bonitasoft.engine.classloader.VirtualClassLoader.loadClass(VirtualClassLoader.java:102)
at org.bonitasoft.engine.classloader.BonitaClassLoader.loadClass(BonitaClassLoader.java:175)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 93 more
What do you want to achieve ?
The document connector takes a file path on the document server as input. So if you “just” want to download files, you don’t to use the List documents
connector.
If you want to display a folder content in a UI, then you must transform the returned CmisObject
into a lighter and serializable data structure.
This transformation occurs in the connector output operation. Something like this (not tested !)
Given a process data folderFiles
of type java.util.List
and the List documents connector output folder_documents
:
folder_documents.collect {
[
id:it.id,
fileName:it.name,
description:it.description,
createdBy:it.createdBy
// You may add other fields that fit your needs and are available on a CmisObject
]
} // This returns a List<Map>
HTH
Romain
Hi Romain,
Thank you for your time and patience helping a newbie at Bonita. Many things to learn…
The scenario is a process to upload files related to an entity, and a second process with and step where I need to visually check which files are currently associated with a specific entity.
I finally got it. It works like a charm!
Thanks again,
JFC