I am creating a workflow i.e. single-approval-definition in activiti and this workflow is added to Liferay. In this workflow I am using a script task. The script task uses LiferayJavascript to change the status of the review process from pending to approved. When I am trying to complete this task with the help of the REST API then it is showing the following error:
"errorMessage":"Can't find scripting engine for 'LiferayJavaScript'",
"statusCode":500
My script is like this:
Packages.com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil.updateStatus(
Packages.com.liferay.portal.kernel.workflow.WorkflowConstants.toStatus("approved"),
workflowContext);
When i use javascript instead of LiferayJavascript then it is showing the following error:
"errorMessage":"problem evaluating script: sun.org.mozilla.javascript.EcmaError: ReferenceError: \"workflowContext\" is not defined. (<Unknown source>#1) in <Unknown source> at line number 1",
"statusCode":500
I got answer for my question and i am here to share it with you. I use the Javascript instead of LiferayJavascript. I was getting error :
"errorMessage":"problem evaluating script: sun.org.mozilla.javascript.EcmaError: ReferenceError: \"workflowContext\" is not defined. (<Unknown source>#1) in <Unknown source> at line number 1",
"statusCode":500
To remove this error, i copy Rhino.jar in activiti-explorer's lib, rest-lib's as well as the tomcat's lib.
I changed my script from
Packages.com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil.updateStatus(
Packages.com.liferay.portal.kernel.workflow.WorkflowConstants.toStatus("approved"),
workflowContext);
to:
Packages.com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil.updateStatus(Packages.com.liferay.portal.kernel.workflow.WorkflowConstants.toStatus("approved"),execution.getVariables())
and my problem get resolved. :-)
Related
I have a situation where for reporting purpose I want to add a tag to background, so if let's say couple of tests fail while execution on background step I have clear failure in report by tag.
I have tried following but it gives me a parsing error on runtime.
#Tag
Background: Background of test
When do abc
Then assert xyz
It throws me following error:
cucumber.runtime.CucumberException: Failed to parse resource
Afaik you can put a tag on feature or scenario level, not step level. Assuming that the background is used for a particular (set of) feature(s) or scenario(s), tagging those should work.
I am pretty new to Jmeter but can handle "simple" test plans. I really do need help with the issue I am facing. Currently I run into a problem regarding how to parametrize the Loop Controller loop count Groovy function.
I did found a lot of examples but they are all with static loop count like: ${__groovy(new File('test.csv').readLines().size(),)}.
I really would like to parametrize the part 'test.csv'. Therefor I replaced that with ${csvFile}, like:
${__groovy(new File(${csvFile}).readLines().size(),)}.
In the 'User Defined Variables' section of the 'Test Plan' I created the variable 'csvFile'.
Test plan image in here
When I execute the script I retrieve an error in the log like:
2022-01-25 11:35:14,870 WARN o.a.j.f.Groovy: Error running groovy script
javax.script.ScriptException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script16.groovy: 1: Unexpected input: '\' # line 1, column 12.
new File(D:\devenv\projecten\JM_InterestDeterminationService\inputmessages.csv).readLines().size()
^
1 error
Is the error pointing to the backslash? Is that because of the Windows OS?
Must I replace the '\' with a '/'? How and where can I do that?
I started fiddling around with .replaceAll("\\", "/") and .replaceAll("\\\\", "/"), but I don't know where to put it and what the correct syntax is.
Could any of you please help me?
That's one of the reasons why it's not recommended to inline JMeter Functions or Variables into Groovy scripts.
Just use vars shorthand for JMeterVariables class instance to read your csvFile variable value like:
${__groovy(new File(vars.get('csvFile')).readLines().size(),)}
and it should resolve your issue.
More information on this and other JMeter API shorthands: Top 8 JMeter Java Classes You Should Be Using with Groovy
I am following the steps of this page:
https://learn.microsoft.com/en-us/composer/how-to-create-custom-actions
and have reached to the part where it is required to merge the two schemas: bots and your custom one. However when running the powershell script found inside the created project template (CoreAssistant template) I have the following error:
Error conflicting definitions of HelpDialog.dialog :
C:\Users\user\source\repos\AvanadeCoreAssistant\AvanadeCoreAssistant\dialogs\imported\Microsoft.Bot.Components.HelpAndCancel\HelpDialog\HelpDialog.dialog
Microsoft.Bot.Components.HelpAndCancel:
C:\Users\user.nuget\packages\microsoft.bot.components.helpandcancel\1.1.2\exported\HelpDialog\HelpDialog.dialog
Error conflicting definitions of HelpDialog.en-us.lu.dialog :
C:\Users\user\source\repos\AvanadeCoreAssistant\AvanadeCoreAssistant\dialogs\imported\Microsoft.Bot.Components.HelpAndCancel\HelpDialog\recognizers\HelpDialog.en-us.lu.dialog
Microsoft.Bot.Components.HelpAndCancel:
C:\Users\user.nuget\packages\microsoft.bot.components.helpandcancel\1.1.2\exported\HelpDialog\recognizers\HelpDialog.en-us.lu.dialog
Error conflicting definitions of HelpDialog.lu.dialog
HelpDialog is a predefined dialog that was already present. I have installed NodeJs and #botframework-cli package because it was required from the powershell script in order to run bf dialog:merge and now it seems these two sources have some kind of conflict.
To add to other answers, changes that worked for me are as follows:
update-schema.ps1, line 11, change "!**/generated" to "!../generated" and add "!../dialogs/imported"
Also, make sure that your custom action project is INSIDE of your bot directory, it should be a folder next to the "schemas" folder for the script to find it.
Note/Edit: Having the project nested inside the bot works to get the script working, though I do not recommend it due to causing other errors. Oddly, I found it was best to move the whole custom solution up a level, next to the bot project. You may have to edit the [botName].sln file in notepad to reference the location of the project, as well as editing the bot project's project reference.
I fixed it by changing the script. I noticed the script was trying to ignore the folder imported and generated but the error message indicated it was not doing so. So I changed it from !**/generated to !../generated.
I experienced the same issue.
To fix this problem you could simply delete the corresponding dialogs in the "imported" folder. Note that this will, however, delete these dialogs in your bot, which is not optimal but should be of little concern for a sample application.
I have certain errors which I set in my code, which should add corresponding error messages to the email content of the final build email.
I was thinking of printing something such as ("EMAIL CONTENT ERROR: _______") to the console, reading through it (in a pre-send groovy script?), and adding corresponding error messages for each error found.
I was thinking of using a pre-send groovy script, setting the mimeMessage object(was reading jenkins email-ext documentation). Would this be viable?
Also, I have never used groovy before, so pointers to how to approach this would be extremely helpful(or a link to where i can find an implementation of something with a similar idea of reading console). Any advice would be greatly appreciated. Thanks in advance!
Can you check attaching "Build Log" This would highlight all the process of build process.
This is a very similar concept to the question here. The technique there was to use the log parser plugin to scan the console output for you, and then use groovy to add all the errors into an email.
This is generally a pretty good idea because it also means that you can view the same set of highlighted errors from jenkins itself, rather than just the email.
There are a couple of ways this is different from your setup, the main points are:
Yes, write errors directly to the console in a known format
Set the log parser up with regular expressions that find your error format
Instead of a pre-send script, in this case you would use a groovy template for your email generation
The template reads the error list from the console parser and adds them to your email. Each one is a link that links back to the jenkins console output.
I'm using the Groovy Grails Tool Suite to practice Groovy. I want to run a Groovy Shell, but when I create a new shell and try to run it, I get this error:
Could not find $jarName on the class path. Please add it manually
What does this mean, and how do I resolve this?
I believe this is happening because JLine can't be found on your classpath. I submitted a PR to make the error message in this case actually useful.
I had a similar problem with this exact same message, but the reason was that I was attempting to run the script without specifying which script to run. Ensure you have the script open in the editing window and trying running it again - that got rid of the message for me.