Travel Request process in the getting start sample version 7.0.0

1
+3
-1

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.

5 answers

1
+1
-1
This one is the BEST answer!

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)

Comments

Submitted by peterp_va on Mon, 07/27/2015 - 16:54

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:

import com.company.model.TravelRequest;

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)

Submitted by vilcholo on Mon, 07/27/2015 - 20:05

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:

return BonitaUsers.getProcessInstanceInitiator(apiAccessor,processInstanceId).getUserName();

This update de travelRequest.UserId value to the initiator username.

I hope you find it useful. I'm sorry for my English. Regards,

Submitted by antoine.mottier on Tue, 07/28/2015 - 11:44

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.

Submitted by nasser on Tue, 07/28/2015 - 12:52

Thank you all for your support, all the best.

Submitted by peterp_va on Tue, 07/28/2015 - 13:22

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?

Submitted by antoine.mottier on Tue, 07/28/2015 - 14:19

Simply replace getUserName() by getId().

You can refer to the javadoc for all methods available on Bonita User Java class.

Submitted by peterp_va on Tue, 07/28/2015 - 14:34

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:

newTravelRequest.setUserId(String.valueOf(BonitaUsers.getProcessInstanceInitiator(apiAccessor,processInstanceId).getId()));

Now, it works like a charm for me :-)

Thank you all for your ideas, great to have this community support!

Submitted by etchegaray on Wed, 07/29/2015 - 17:41

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

Submitted by antoine.mottier on Wed, 07/29/2015 - 18:05

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.

Submitted by Sean McP on Mon, 08/03/2015 - 10:52

Hi Antoine,

Is the update available yet, and when will the release notes for 7.1.0 be available? :)

thanks and regards Seán

Submitted by antoine.mottier on Mon, 08/03/2015 - 11:14

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

Submitted by Sean McP on Mon, 08/03/2015 - 11:33

Thanks and,

No I really meant 7.1.0... :)

regards

1
+1
-1

Hello, suddenly the script to catch the userName stopped working. I have this service task:

service task with this script:

return BonitaUsers.getProcessInstanceInitiator(apiAccessor,processInstanceId).getUserName();

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".

2015-07-30 19:57:24.392 +0200 org.bonitasoft.engine.execution.work.FailureHandlingBonitaWork org.bonitasoft.engine.log.technical.TechnicalLoggerSLF4JImpl log
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

Submitted by antoine.mottier on Fri, 07/31/2015 - 07:53

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.

Submitted by vilcholo on Fri, 07/31/2015 - 18:53

Hello Antoine, providedscripts.jar don't exist in .bar file. bar bos bonitalog How can I do to fix it? Thank you

Submitted by antoine.mottier on Mon, 08/03/2015 - 11:45

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

Submitted by vilcholo on Mon, 08/03/2015 - 14:38

Hello Antoine, I have found that these files exist... then I have reinstalled BonitaBPM but still not working.

Then I exported my processes to .bos file. I have uninstalled BonitaBPM and I've deleted all references to Bonita to perform a clean installation. I've installed the aplication again. Then I've imported my processes and everything works fine.

Thank you for your help. Regards,

1
0
-1

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)

1
0
-1

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

1
0
-1

I have this error when click Start

USERNAME=helen.kelly | javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute statement

Comments

Submitted by antoine.mottier on Tue, 07/28/2015 - 11:37

Hi,

Can you share your process .bos file so I can try to reproduce the issue?

Thanks

Submitted by rodrigojcortes on Tue, 07/28/2015 - 18:42

I could solve, but now have other issue, when click in create a new travel request It appears error 404.

Where send or share? the file .bos? thank for you help

Submitted by antoine.mottier on Tue, 07/28/2015 - 18:45

You can send the .bos file using some sharing file solution such as dropbox or Google Drive.

Submitted by rodrigojcortes on Tue, 07/28/2015 - 21:30
Submitted by antoine.mottier on Wed, 07/29/2015 - 16:19

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.

Submitted by rodrigojcortes on Wed, 07/29/2015 - 16:35
https://www.dropbox.com/s/2x08301sz1xqq2w/issue.pdf?dl=0

download the file and look at the screenshots. that is mi issue. Try to build the application buy i dont can.

thank you

Submitted by antoine.mottier on Wed, 07/29/2015 - 17:08

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.

Submitted by rodrigojcortes on Wed, 07/29/2015 - 19:19

the REST API call in studio is OK, and the link generated is: http://localhost:8080/bonita/portal/resource/process/Travel%20Request/1....

Submitted by antoine.mottier on Wed, 07/29/2015 - 19:45

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.

Submitted by maguromy on Fri, 07/31/2015 - 10:47

Actually how to resolve the issue with; USERNAME=helen.kelly | javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute statement ?

Submitted by antoine.mottier on Fri, 07/31/2015 - 10:53

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.

Submitted by maguromy on Fri, 07/31/2015 - 12:14
Submitted by maguromy on Fri, 07/31/2015 - 12:29

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.

Submitted by antoine.mottier on Fri, 07/31/2015 - 14:01

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.

Notifications