Travel Request process in the getting start sample version 7.0.0
Hi, I am trying to do the travel request in the getting started, but when I submit the initiation form I got the following error:
**USERNAME=helen.kelly | org.bonitasoft.engine.core.process.instance.api.exceptions.SProcessInstanceCreationException: PROCESS_DEFINITION_ID=4777866935891891811 | PROCESS_NAME=Travel Request | PROCESS_VERSION=1.0 | org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: groovy.lang.MissingMethodException: No signature of method: com.company.model.TravelRequest.setDepartureDate() is applicable for argument types: (null) values: [null] Possible solutions: setDepatureDate(java.util.Date), getDepatureDate() ** can someone help? whet is wrong
Thanks in advance.
Hi nasser,
I had the same problem. The reason is the documentation which is wrong in some parts. Search for "departure" and "depature" and make sure you just use one of those variants, ideally the one without the typo :-)
After fixing this, I could run the process without problems. (but there seem to be more problems with the documentation, because the application page does'nt show any data for me in the "my pending requests" and "my approved requests" tables)
Hello, suddenly the script to catch the userName stopped working. I have this service task:
with this script:
It works correctly, but suddenly I get this error in bonita.log. In other process the same has occurred. I have checke "resolve dependencies automatically".
GRAVE: THREAD_ID=145 | HOSTNAME=Usuario-PC | TENANT_ID=1 | org.bonitasoft.engine.core.process.instance.api.exceptions.SActivityStateExecutionException : "PROCESS_DEFINITION_ID=8916244329602994221 | PROCESS_NAME=Travel Request | PROCESS_VERSION=1.0 | PROCESS_INSTANCE_ID=7 | ROOT_PROCESS_INSTANCE_ID=7 | FLOW_NODE_DEFINITION_ID=4712334614962966914 | FLOW_NODE_INSTANCE_ID=19 | FLOW_NODE_NAME=Obtener UserId | org.bonitasoft.engine.core.operation.exception.SOperationExecutionException: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: Expression getUserId with content = <return BonitaUsers.getProcessInstanceInitiator(apiAccessor,processInstanceId).getUserName();> depends on BonitaUsers is neither defined in the script nor in dependencies."
org.bonitasoft.engine.core.process.instance.api.exceptions.SActivityStateExecutionException: PROCESS_DEFINITION_ID=8916244329602994221 | PROCESS_NAME=Travel Request | PROCESS_VERSION=1.0 | PROCESS_INSTANCE_ID=7 | ROOT_PROCESS_INSTANCE_ID=7 | FLOW_NODE_DEFINITION_ID=4712334614962966914 | FLOW_NODE_INSTANCE_ID=19 | FLOW_NODE_NAME=Obtener UserId | org.bonitasoft.engine.core.operation.exception.SOperationExecutionException: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: Expression getUserId with content = <return BonitaUsers.getProcessInstanceInitiator(apiAccessor,processInstanceId).getUserName();> depends on BonitaUsers is neither defined in the script nor in dependencies.
at org.bonitasoft.engine.execution.StateBehaviors.executeOperations(StateBehaviors.java:660)
at org.bonitasoft.engine.execution.state.ExecutingAutomaticActivityStateImpl.onEnterToOnFinish(ExecutingAutomaticActivityStateImpl.java:48)
at org.bonitasoft.engine.execution.state.FlowNodeStateWithConnectors.execute(FlowNodeStateWithConnectors.java:73)
at org.bonitasoft.engine.execution.state.FlowNodeStateWithConnectors.execute(FlowNodeStateWithConnectors.java:35)
at org.bonitasoft.engine.execution.FlowNodeExecutorImpl.executeState(FlowNodeExecutorImpl.java:128)
at org.bonitasoft.engine.execution.FlowNodeExecutorImpl.updateState(FlowNodeExecutorImpl.java:182)
at org.bonitasoft.engine.execution.FlowNodeExecutorImpl.stepForward(FlowNodeExecutorImpl.java:164)
at org.bonitasoft.engine.execution.FlowNodeExecutorImpl.executeFlowNode(FlowNodeExecutorImpl.java:317)
at org.bonitasoft.engine.execution.work.ExecuteFlowNodeWork.work(ExecuteFlowNodeWork.java:72)
at org.bonitasoft.engine.execution.work.TxBonitaWork$1.call(TxBonitaWork.java:48)
at org.bonitasoft.engine.execution.work.TxBonitaWork$1.call(TxBonitaWork.java:44)
at org.bonitasoft.engine.transaction.JTATransactionServiceImpl.executeInTransaction(JTATransactionServiceImpl.java:312)
at org.bonitasoft.engine.execution.work.TxBonitaWork.work(TxBonitaWork.java:53)
at org.bonitasoft.engine.execution.work.LockProcessInstanceWork.work(LockProcessInstanceWork.java:79)
at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)
at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)
at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)
at org.bonitasoft.engine.execution.work.FailureHandlingBonitaWork.work(FailureHandlingBonitaWork.java:66)
at org.bonitasoft.engine.work.BonitaWork.run(BonitaWork.java:56)
at org.bonitasoft.engine.work.SequenceRunnableExecutor.innerRun(SequenceRunnableExecutor.java:47)
at org.bonitasoft.engine.work.BonitaRunnable.run(BonitaRunnable.java:35)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.bonitasoft.engine.core.operation.exception.SOperationExecutionException: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: Expression getUserId with content = <return BonitaUsers.getProcessInstanceInitiator(apiAccessor,processInstanceId).getUserName();> depends on BonitaUsers is neither defined in the script nor in dependencies.
at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.evaluateRightOperandExpression(OperationServiceImpl.java:198)
at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.calculateRightOperandValue(OperationServiceImpl.java:120)
at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.executeOperators(OperationServiceImpl.java:105)
at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.execute(OperationServiceImpl.java:94)
at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.execute(OperationServiceImpl.java:81)
at org.bonitasoft.engine.execution.StateBehaviors.executeOperations(StateBehaviors.java:657)
... 23 more
Caused by: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: Expression getUserId with content = <return BonitaUsers.getProcessInstanceInitiator(apiAccessor,processInstanceId).getUserName();> depends on BonitaUsers is neither defined in the script nor in dependencies.
at org.bonitasoft.engine.expression.impl.GroovyScriptExpressionExecutorCacheStrategy.evaluate(GroovyScriptExpressionExecutorCacheStrategy.java:137)
at org.bonitasoft.engine.expression.impl.ExpressionServiceImpl.evaluate(ExpressionServiceImpl.java:86)
at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionWithResolvedDependencies(ExpressionResolverServiceImpl.java:213)
at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionsFlatten(ExpressionResolverServiceImpl.java:120)
at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluate(ExpressionResolverServiceImpl.java:83)
at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.evaluateRightOperandExpression(OperationServiceImpl.java:193)
... 28 more
Caused by: groovy.lang.MissingPropertyException: No such property: BonitaUsers for class: BScript25
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
at BScript25.run(BScript25.groovy:1)
at org.bonitasoft.engine.expression.impl.GroovyScriptExpressionExecutorCacheStrategy.evaluate(GroovyScriptExpressionExecutorCacheStrategy.java:134)
Comments
Hi, can you try to verify that the class BonitaUsers (the one that includes getProcessInstanceInitiator method) is correctly embedded in the process .bar file? To do that:
- Build the process .bar file by going to "Server" -> "Build..." menu
- Select the "Travel Request" pool
- Click on Finish button
- Open the bar file with a tool such as 7-zip or winzip
- Go to "classpath" folder and check if "providedscripts.jar" exist
- Open "providedscripts.jar" and verify that it includes "BonitaUsers.class"
Also if you can share the .bos file that include all process files that might help to reproduce the issue.
Thanks.
I import the .bos file in my Studio and when I build the .bar file it includes correctly the providedscripts.jar file.
Can you check that you have BonitaUsers.groovy
file in BonitaBPMCommunity-7.0.1/workspace/default/src-providedGroovy/
folder?
Also verified that you have BonitaUsers.class
file in BonitaBPMCommunity-7.0.1/workspace/default/bin/
folder.
If you cannot find those file the solution is probably to install again the Studio. If you have them I would recommend to open a bug and attached a zip of BonitaBPMCommunity-7.0.1/workspace/default
folder.
Thanks
I wrote the line as per the video : http://www.bonitasoft.com/resources/videos/getting-started-tutorial
travelRequestVar.userId = BonitaUsers.getProcessInstanceInitiator(APIAccessor, (long) processInstanceId).id
It worked (no error) after I re-wrote it as per the article: http://documentation.bonitasoft.com/6.x-7.2/getting-started-tutorial-2
travelRequestVar.userId = BonitaUsers.getProcessInstanceInitiator(apiAccessor, processInstanceId).id
(note the APIAccessor vs apiAccessor in both lines)
Hi,
I am using bonitasoft 7.4.1 version i following the Getting started videos and documentation from official website.
while creating travel req getting error
( USERNAME=helen.kelly | org.bonitasoft.engine.persistence.SRetryableException: javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.company.model.TravelRequest.reason)
please help me anyone.
In Pool variables, i edit the business data variables here i have attached the code.
def travelRequestVar = new com.company.model.TravelRequest()
travelRequestVar.departureDate = travelRequestInput.departureDate
travelRequestVar.numberOfNights = travelRequestInput.numberOfNights
travelRequestVar.hotelNeeded = travelRequestInput.hotelNeeded
travelRequestVar.destination = travelRequestInput.destination
travelRequestVar.reason = travelRequestInput.reason3
travelRequestVar.status = "pending"
travelRequestVar.userId = BonitaUsers.getProcessInstanceInitiator(apiAccessor, processInstanceId).getUserName();
return travelRequestVar
I have this error when click Start
USERNAME=helen.kelly | javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute statement
Comments
Hi,
Can you share your process .bos file so I can try to reproduce the issue?
Thanks
You can send the .bos file using some sharing file solution such as dropbox or Google Drive.
I import your process and in order to make it work I did the following:
- Open the process
- Click on "Configure" button
- Go to "Authentication"
- Type again the Username: "walter.bates" (without the quotes, or use the one suggest in the tutorial instruction: "helen.kelly").
Then simply run the process.
In the preview of the Travel tool page, can you make a right click on the "Create new travel request button" and select the "Copy link address" in order to share here the link that was generated?
Also you need to make sure that first you deploy the process definition (e.g. by clicking on "Run" button in the Studio) so that the REST API call to get process definition id and generation of the link can actually work.
id value is empty in the link you provide.
Did you defined the processDef
form variable?
Did you initialize the variable with the correct URL: ../API/bpm/process?p=0&c=1&f=name=Travel Request
Important: make sure that "Travel Request" match exactly your process (pool) name.
You might want to use the web browser console (enable it with F12 key) to check the API request response.
Actually how to resolve the issue with; USERNAME=helen.kelly | javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute statement ?
In order to help can you please share full Engine log content available in the Studio "Help" menu? Also if you can export the diagram as a .bos file and share it that can help.
Thanks.
Hi Antoine, Here are the files. Thank you Hashim https://www.dropbox.com/s/42dzv14hrf12f00/bonita.2015-07-31.log?dl=0
https://www.dropbox.com/s/cfpeblmqqm1d2ts/Simple%20Travel%20Request-1.0....Hi Antoine, I think the issue is due to this error;
ERROR: NULL not allowed for column "NUMBEROFNIGHT"; SQL statement: insert into TRAVELREQUEST (persistenceId, DEPARTUREDATE, DESTINATION, HOTELNEEDED, NUMBEROFNIGHTS, persistenceVersion, REASON, REFUSALREASON, STATUS, USERID) values (null, ?, ?, ?, ?, ?, ?, ?, ?, ?) [23502-170]
I think I need to change the db column name from NUMBEROFNIGHT to NUMBEROFNIGHTS.
In your BDM definition you need to have the attribute name: numberOfNights
When you change the name of an attribute make sure that you check the "Reset Business Data Model" in order for the column in database to be renamed.
You might want to do a simple modification in the description of an object to trigger a new publication of the BDM.
Comments
After going deeper into the getting started tutorial I think I found the reason why the application page does'nt show any pending or approved requests: The example never instantiates the userId variable with a value... The only variable we instantiate with a value ist status:
TravelRequest newTravelRequest = new TravelRequest();
newTravelRequest.setUserId(travelRequestTravelRequest.userId);
newTravelRequest.setDepartureDate(travelRequestTravelRequest.departureDate);
newTravelRequest.setNumberOfNights(travelRequestTravelRequest.numberOfNights);
newTravelRequest.setHotelNeeded(travelRequestTravelRequest.hotelNeeded);
newTravelRequest.setDestination(travelRequestTravelRequest.destination);
newTravelRequest.setReason(travelRequestTravelRequest.reason);
newTravelRequest.setStatus("pending");
return newTravelRequest;
Does anyone know how to set the value for the userId? I made the TravelTool Overview page working fine with just filtering by status, so I am sure this is the reason (of course problem then is that any request is shown)
Hello peterp_va, to do it I add a service task between start event and Manager review task. In this service task, go to operations tab and add a new operation: Select BDM "travelRequest", select java method and select "setUserId". Insert a script named "getUserId" with this code:
This update de travelRequest.UserId value to the initiator username.
I hope you find it useful. I'm sorry for my English. Regards,
Actually you can replace directly in the script:
travelRequestTravelRequest.userId
with
BonitaUsers.getProcessInstanceInitiator(apiAccessor,processInstanceId).getUserName()
.It's simpler than creating an additional task with an operation.
Thank you all for your support, all the best.
Thanks antoine, this works for me so far. But for the getting started tutorial to work we need the Userid of the ProcessInstanceInitiator instead of the user name. How to retrieve the id?
Simply replace
getUserName()
bygetId()
.You can refer to the javadoc for all methods available on Bonita User Java class.
I already tried this, but I can't submit the form then.
I realized that the attribute TravelRequest.userId was created with data type string but the returned userId is of type long so type conversion was the way to go:
Now, it works like a charm for me :-)
Thank you all for your ideas, great to have this community support!
There are a couple of errors in the documentation "Getting_started_tutorial" in addition to documented by peterp_va. "Update the application page" fourth point says: An External API valled Variable With the value myPendingRequests ../API/bdm/businessData/com.company.model.TravelRequest?q=findByUserAndStatus&p=0&c=10&f=userId={{myUserId}}&f=status=pending I should say: An External API valled Variable With the value myPendingRequests ../API/bdm/businessData/com.company.model.TravelRequest?q=findByUserIdAndStatus&p=0&c=10&f=userId={{myUserId}}&f=status=pending
fifth point says: An External API valled Variable With the value myApprovedRequests ../API/bdm/businessData/com.company.model.TravelRequest?q=findByUserAndStatus&p=0&c=10&f=userId={{myUserId}}&f=status=Approved
I should say: An External API valled Variable With the value myApprovedRequests ../API/bdm/businessData/com.company.model.TravelRequest?q=findByUserIdAndStatus&p=0&c=10&f=userId={{myUserId}}&f=status=Approved
Hay un par de errores en la documentación del "Getting_started_tutorial" además de lo documentado por peterp_va. En "Update the application page", cuarto punto dice: An External API variable valled myPendingRequests with the value ../API/bdm/businessData/com.company.model.TravelRequest?q=findByUserAndStatus&p=0&c=10&f=userId={{myUserId}}&f=status=pending debería decir: An External API variable valled myPendingRequests with the value ../API/bdm/businessData/com.company.model.TravelRequest?q=findByUserIdAndStatus&p=0&c=10&f=userId={{myUserId}}&f=status=pending
quinto punto dice: An External API variable valled myApprovedRequests with the value ../API/bdm/businessData/com.company.model.TravelRequest?q=findByUserAndStatus&p=0&c=10&f=userId={{myUserId}}&f=status=Approved
debería decir: An External API variable valled myApprovedRequests with the value ../API/bdm/businessData/com.company.model.TravelRequest?q=findByUserIdAndStatus&p=0&c=10&f=userId={{myUserId}}&f=status=Approved
Thanks for the feedback! I'm actually updating the documentation and just found the same issue. Update should be available soon on official documentation page.
Hi Antoine,
Is the update available yet, and when will the release notes for 7.1.0 be available? :)
thanks and regards Seán
Hi Sean
Updated version of the tutorial is available in documentation .
I assume you speak about the release note of version 7.0.1. It is available here: http://www.bonitasoft.com/products/download/bonita-bpm-701-release-notes
Regards,
Antoine
Thanks and,
No I really meant 7.1.0... :)
regards