Jira 6 groovy error - groovy

Use the Jira 6. sometimes groovy script error.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.crowd.embedded.api.User;
import com.atlassian.jira.user.ApplicationUser;
passesCondition = true
String currentUser = ComponentAccessor.getJiraAuthenticationContext().getUser().getUsername()
if (currentUser != issue.getProjectObject().getLeadUserName())
passesCondition = false
Log Error:
2015-04-16 17:30:28,842 http-bio-8080-exec-13076 ERROR zeynep 1050x1610767x2 gf80de 10.130.12.70 /secure/CommentAssignIssue.jspa [scriptrunner.jira.workflow.ScriptWorkflowFunction] Script function failed on issue: KUR-3666, actionId: 811, file: null
java.lang.Exception: Class C:\Program Files\Atlassian\JIRA 4.0.1\groovy_scripts\is_project_lead.gy could not be found, or could not be compiled
at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.ensureScriptCompiled(ScriptRunnerImpl.groovy:554)
at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.validateAndRunCannedInternal(ScriptRunnerImpl.groovy:365)
at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.this$2$validateAndRunCannedInternal(ScriptRunnerImpl.groovy)
at com.onresolve.scriptrunner.runner.ScriptRunnerImpl$this$2$validateAndRunCannedInternal.callCurrent(Unknown Source)
at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.runCanned(ScriptRunnerImpl.groovy:342)
at com.onresolve.scriptrunner.runner.ScriptRunner$runCanned$5.call(Unknown Source)
at com.onresolve.scriptrunner.jira.workflow.ScriptWorkflowFunction.run(ScriptWorkflowFunction.groovy:80)
at com.onresolve.scriptrunner.jira.workflow.ScriptWorkflowFunction$run$0.callCurrent(Unknown Source)
at com.onresolve.scriptrunner.jira.workflow.ScriptWorkflowFunction.passesCondition(ScriptWorkflowFunction.groovy:28)

Related

Back-end (JVM) Internal error: Failed to generate expression: KtCallExpression

Decompiler tool of my IDE is not working.
Here is my code which I want to decompile:
data class FetchOrdersState(
val orders: List<Order> = listOf(),
val isLoading: Boolean = false,
val error: String = ""
) : OrderState {
companion object {
val Empty = FetchOrdersState()
}
}
This is the error I am getting in the IDE when I visit Tools > Kotlin > Show Kotlin Bytecode
org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error:
Failed to generate expression: KtCallExpression
File being compiled: (20,31) in /Users/.../src/commonMain/kotlin/.../OrderState.kt
The root cause java.lang.IllegalStateException was thrown at: org.jetbrains.kotlin.codegen.state.KotlinTypeMapper$Companion.getPackageMemberContainingClassesInfo(KotlinTypeMapper.kt:1386)
at org.jetbrains.kotlin.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:356)
at org.jetbrains.kotlin.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:314)
at org.jetbrains.kotlin.codegen.ExpressionCodegen.gen(ExpressionCodegen.java:430)
at org.jetbrains.kotlin.codegen.DefaultParameterValueLoader.lambda$static$0(DefaultParameterValueLoader.java:30)
at org.jetbrains.kotlin.codegen.FunctionCodegen.lambda$generateDefaultImplBody$5(FunctionCodegen.java:1278)
at org.jetbrains.kotlin.codegen.ExpressionCodegen.runWithShouldMarkLineNumbers(ExpressionCodegen.java:1559)
at org.jetbrains.kotlin.codegen.FunctionCodegen.generateDefaultImplBody(FunctionCodegen.java:1274)
at org.jetbrains.kotlin.codegen.FunctionCodegen.generateDefaultIfNeeded(FunctionCodegen.java:1203)
at org.jetbrains.kotlin.codegen.ConstructorCodegen.generatePrimaryConstructor(ConstructorCodegen.java:112)
at org.jetbrains.kotlin.codegen.ImplementationBodyCodegen.generateConstructors(ImplementationBodyCodegen.java:457)
at org.jetbrains.kotlin.codegen.ClassBodyCodegen.generateBody(ClassBodyCodegen.java:96)
at org.jetbrains.kotlin.codegen.MemberCodegen.generate(MemberCodegen.java:132)
at org.jetbrains.kotlin.codegen.MemberCodegen.genClassOrObject(MemberCodegen.java:305)
at org.jetbrains.kotlin.codegen.MemberCodegen.genClassOrObject(MemberCodegen.java:289)
at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generateClassesAndObjectsInFile(PackageCodegenImpl.java:119)
at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generateFile(PackageCodegenImpl.java:138)
at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generate(PackageCodegenImpl.java:70)
at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.generatePackage(CodegenFactory.kt:77)
at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.generateModule(CodegenFactory.kt:62)
at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:35)
at org.jetbrains.kotlin.idea.core.KotlinCompilerIde.compile(KotlinCompilerIde.kt:144)
at org.jetbrains.kotlin.idea.internal.KotlinBytecodeToolWindow$Companion.compileSingleFile(KotlinBytecodeToolWindow.kt:272)
at org.jetbrains.kotlin.idea.internal.KotlinBytecodeToolWindow$Companion.getBytecodeForFile(KotlinBytecodeToolWindow.kt:235)
at org.jetbrains.kotlin.idea.internal.KotlinBytecodeToolWindow$UpdateBytecodeToolWindowTask.processRequest(KotlinBytecodeToolWindow.kt:111)
at org.jetbrains.kotlin.idea.internal.KotlinBytecodeToolWindow$UpdateBytecodeToolWindowTask.processRequest(KotlinBytecodeToolWindow.kt:60)
at org.jetbrains.kotlin.idea.util.LongRunningReadTask$1$1.run(LongRunningReadTask.java:115)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:866)
at org.jetbrains.kotlin.idea.util.LongRunningReadTask.lambda$runWithWriteActionPriority$0(LongRunningReadTask.java:235)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:178)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:658)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:610)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:65)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:165)
at org.jetbrains.kotlin.idea.util.LongRunningReadTask.runWithWriteActionPriority(LongRunningReadTask.java:235)
at org.jetbrains.kotlin.idea.util.LongRunningReadTask$1.run(LongRunningReadTask.java:110)
at com.intellij.util.RunnableCallable.call(RunnableCallable.java:20)
at com.intellij.util.RunnableCallable.call(RunnableCallable.java:11)
at com.intellij.openapi.application.impl.ApplicationImpl$1.call(ApplicationImpl.java:276)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalStateException: No implClassName for #kotlin.internal.InlineOnly public inline fun <T> listOf(): kotlin.collections.List<T> defined in kotlin.collections[DeserializedSimpleFunctionDescriptor#43dad151]
at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper$Companion.getPackageMemberContainingClassesInfo(KotlinTypeMapper.kt:1386)
at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper$Companion.getPackageMemberOwnerInternalName(KotlinTypeMapper.kt:1369)
at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper$Companion.internalNameForPackageMemberOwner(KotlinTypeMapper.kt:1315)
at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper$Companion.access$internalNameForPackageMemberOwner(KotlinTypeMapper.kt:1283)
at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.mapOwner(KotlinTypeMapper.kt:163)
at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.mapOwner(KotlinTypeMapper.kt:142)
at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.mapToCallableMethod(KotlinTypeMapper.kt:544)
at org.jetbrains.kotlin.codegen.ExpressionCodegen.resolveToCallable(ExpressionCodegen.java:2727)
at org.jetbrains.kotlin.codegen.ExpressionCodegen.invokeFunction(ExpressionCodegen.java:2602)
at org.jetbrains.kotlin.codegen.ExpressionCodegen.invokeFunction(ExpressionCodegen.java:2576)
at org.jetbrains.kotlin.codegen.ExpressionCodegen.visitCallExpression(ExpressionCodegen.java:2470)
at org.jetbrains.kotlin.codegen.ExpressionCodegen.visitCallExpression(ExpressionCodegen.java:125)
at org.jetbrains.kotlin.psi.KtCallExpression.accept(KtCallExpression.java:35)
at org.jetbrains.kotlin.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:332)
... 45 more
This works absolutely fine if I comment out the listOf() line from my data class.

UrbanCode udeploy NullPointerException in Run Groovy Script step

The same step was running fine for a couple of days and now getting this error. I've seen same error with UCD 6.1.1 too, then the code was able to run in UCD 6.2.1, but now fails again. What could be the issue?
plugin: Groovy, id: com.urbancode.air.plugin.Groovy, version: 6
plugin command: 'cmd' '/C' '"f:\apps\yyyy\agent\opt\groovy-1.8.8\bin\groovy -cp "f:\apps\yyyy\agent\var\plugins\com.urbancode.air.plugin.Groovy_6_c852a5128a51660ebc6986784c1163eb465daf6abf99d541d16108d08b14ab7e\classes;f:\apps\yyyy\agent\var\plugins\com.urbancode.air.plugin.Groovy_6_c852a5128a51660ebc6986784c1163eb465daf6abf99d541d16108d08b14ab7e\lib\plugins-util.jar" f:\apps\yyyy\agent\var\plugins\com.urbancode.air.plugin.Groovy_6_c852a5128a51660ebc6986784c1163eb465daf6abf99d541d16108d08b14ab7e\run_groovy_script.groovy F:\apps\yyyy\agent\var\temp\logs4673273741404342602\input.props F:\apps\yyyy\agent\var\temp\logs4673273741404342602\output.props"'
working directory: F:\apps\yyyy\agent\var\work\XH70_Javascripts
properties:
PLUGIN_INPUT_PROPS=F:\apps\yyyy\agent\var\temp\logs4673273741404342602\input.props
PLUGIN_OUTPUT_PROPS=F:\apps\yyyy\agent\var\temp\logs4673273741404342602\output.props
groovyHome=f:\apps\yyyy\agent\opt\groovy-1.8.8
scriptBody=import groovy.io.FileType
def currentDir = new File('.')
def files = []
currentDir.eachFile(FileType.FILES) {
if (it.name.endsWith(".zip")) {
files << it.name - "-bin.zip"
}
}
println files[0]
outProps.put("zipfilename", files[0])
environment:
AGENT_HOME=f:\apps\yyyy\agent
AH_AUTH_TOKEN=****
AH_WEB_URL=https://ucd.com:8443
AUTH_TOKEN=****
CODESTATION_URL=https://ucd.com:20081
CODESTATION_USE_PROXY=false
DS_AUTH_TOKEN=****
DS_SYSTEM_ENCODING=Cp437
JAVA_OPTS=-Dfile.encoding=Cp437 -Dconsole.encoding=Cp437
PLUGIN_HOME=f:\apps\yyyy\agent\var\plugins\com.urbancode.air.plugin.Groovy_6_c852a5128a51660ebc6986784c1163eb465daf6abf99d541d16108d08b14ab7e
PROXY_HOST=ucd.com
PROXY_PORT=20080
UD_DIALOGUE_ID=b9521caf-6399-4455-a8e4-7e79bc3c95b2
WE_ACTIVITY_ID=f819fba0-4800-4c87-9e29-5efa3698fe76
================================================================================
Running Groovy Script
command: f:\apps\yyyy\agent\opt\groovy-1.8.8\bin\groovy.bat C:\Windows\TEMP\groovy_script_8111838756530262064.groovy F:\apps\yyyy\agent\var\temp\logs4673273741404342602\input.props F:\apps\yyyy\agent\var\temp\logs4673273741404342602\output.props
null
Caught: java.lang.NullPointerException
java.lang.NullPointerException
at java_util_Map$put.call(Unknown Source)
at groovy_script_8111838756530262064.run(groovy_script_8111838756530262064.groovy:26)
Caught: com.urbancode.air.ExitCodeException: Command failed with exit code: 1
com.urbancode.air.ExitCodeException: Command failed with exit code: 1
at com.urbancode.air.CommandHelper.runCommand(CommandHelper.groovy:195)
at com.urbancode.air.CommandHelper$runCommand$0.callCurrent(Unknown Source)
at com.urbancode.air.CommandHelper.runCommand(CommandHelper.groovy:121)
at com.urbancode.air.CommandHelper$runCommand.call(Unknown Source)
at run_groovy_script.run(run_groovy_script.groovy:64)
It could be that currentDir.eachFile() isn't returning any files, so files[0] is null.

Groovy HTMLUnit Error - Caught: java.lang.NoSuchMethodError: com.steadystate.css.parser.CSSOMParser.parseMedia

I am getting this error in a groovy script:
Caught: java.lang.NoSuchMethodError:
com.steadystate.css.parser.CSSOMParser.parseMedia(Lorg/w3c/css/sac/InputSource;)Lorg/w3c/css/sac/SACMediaList;
java.lang.NoSuchMethodError:
com.steadystate.css.parser.CSSOMParser.parseMedia(Lorg/w3c/css/sac/InputSource;)Lorg/w3c/css/sac/SACMediaList;
at com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleSheet.parseMedia(CSSStyleSheet.java:937)
My grapes are as follows:
#Grapes([
#Grab(group='commons-io', module='commons-io', version='2.4'),
#Grab(group='net.sourceforge.htmlunit', module='htmlunit', version='2.19'),
#Grab(group='org.slf4j', module='slf4j-api', version='1.7.16'),
#Grab(group='log4j', module='log4j', version='1.2.17'),
#Grab(group='javax.mail', module='mail', version='1.4'),
#Grab(group='org.apache.commons', module='commons-email', version='1.4'),
#GrabExclude('xml-apis:xml-apis')
])
Any idea why this error is happening?

Error when using SparkJob with NamedRddSupport

Goal is to create the following on a local instance of Spark JobServer:
object foo extends SparkJob with NamedRddSupport
Question: How can I fix the following error which happens on every job:
{
"status": "ERROR",
"result": {
"message": "Ask timed out on [Actor[akka://JobServer/user/context-supervisor/439b2467-spark.jobserver.genderPrediction#884262439]] after [10000 ms]",
"errorClass": "akka.pattern.AskTimeoutException",
"stack: ["akka.pattern.PromiseActorRef$$anonfun$1.apply$mcV$sp(AskSupport.scala:334)", "akka.actor.Scheduler$$anon$7.run(Scheduler.scala:117)", "scala.concurrent.Future$InternalCallbackExecutor$.scala$concurrent$Future$InternalCallbackExecutor$$unbatchedExecute(Future.scala:694)", "scala.concurrent.Future$InternalCallbackExecutor$.execute(Future.scala:691)", "akka.actor.LightArrayRevolverScheduler$TaskHolder.executeTask(Scheduler.scala:467)", "akka.actor.LightArrayRevolverScheduler$$anon$8.executeBucket$1(Scheduler.scala:419)", "akka.actor.LightArrayRevolverScheduler$$anon$8.nextTick(Scheduler.scala:423)", "akka.actor.LightArrayRevolverScheduler$$anon$8.run(Scheduler.scala:375)", "java.lang.Thread.run(Thread.java:745)"]
}
}
A more detailed error description by the Spark JobServer:
job-server[ERROR] Exception in thread "pool-100-thread-1" java.lang.AbstractMethodError: spark.jobserver.genderPrediction$.namedObjectsPrivate()Ljava/util/concurrent/atomic/AtomicReference;
job-server[ERROR] at spark.jobserver.JobManagerActor$$anonfun$spark$jobserver$JobManagerActor$$getJobFuture$4.apply(JobManagerActor.scala:248)
job-server[ERROR] at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
job-server[ERROR] at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
job-server[ERROR] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
job-server[ERROR] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
job-server[ERROR] at java.lang.Thread.run(Thread.java:745)
In case somebody wants to see the code:
package spark.jobserver
import org.apache.spark.SparkContext._
import org.apache.spark.{SparkContext}
import com.typesafe.config.{Config, ConfigFactory}
import collection.JavaConversions._
import scala.io.Source
object genderPrediction extends SparkJob with NamedRddSupport
{
// Main function
def main(args: scala.Array[String])
{
val sc = new SparkContext()
sc.hadoopConfiguration.set("fs.tachyon.impl", "tachyon.hadoop.TFS")
val config = ConfigFactory.parseString("")
val results = runJob(sc, config)
}
def validate(sc: SparkContext, config: Config): SparkJobValidation = {SparkJobValid}
def runJob(sc: SparkContext, config: Config): Any =
{
return "ok";
}
}
Version information:
Spark is 1.5.0 - SparkJobServer is latest version
Thank you all very much in advance!
Adding more explanation to #noorul 's answer
It seems like you compiled the code with an old version of SJS and you are running it with the latest.
NamedObjects were recently added. You are getting AbstractMethodError because your server expects NamedObjects support and you didn't compile the code with that.
Also: you don't need the main method there since it won't be executed by SJS.
Ensure that your.compile and run time library versions of dependent packages are same.

Simple Tmar test not running

I have a simple groovy project in which i'm trying to run a Tmar test which does not.
Here is a copy of my project's structure and the stacktrace given by Tmar.
And a stack trace of test execution:
Start test
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.701 sec <<< FAILURE! - in org.dealus.MowItTest
test(org.dealus.MowItTest) Time elapsed: 0.14 sec <<< ERROR!
java.io.FileNotFoundException: D:\Dev\EclipseMarsWorkspace\mowit\target\tmar-test-results\MowItTest.test
at org.codehaus.groovy.runtime.ResourceGroovyMethods.checkDir(ResourceGroovyMethods.java:1043)
at org.codehaus.groovy.runtime.ResourceGroovyMethods.eachFile(ResourceGroovyMethods.java:1062)
at org.codehaus.groovy.runtime.ResourceGroovyMethods.eachFile(ResourceGroovyMethods.java:1088)
at org.codehaus.groovy.runtime.dgm$936.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at org.jspresso.contrib.tmar.report.TmarReport.generateSingleReport(TmarReport.groovy:1275)
at org.jspresso.contrib.tmar.report.TmarReport$generateSingleReport.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:141)
at org.jspresso.contrib.tmar.core.TmarBaseJUnitTestNG.getData(TmarBaseJUnitTestNG.groovy:30)
at org.jspresso.contrib.tmar.core.TmarBaseJUnitTestNG$getData.callCurrent(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
at org.dealus.MowItTest.test(MowItTest.groovy:12)
Results :
Tests in error:
MowItTest.test:12->TmarBaseJUnitTestNG.getData:30 ยป FileNotFound D:\Dev\Eclips...
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
The tmar test description file:
MowItTest
/each
[ Result ? |
| Test ok |
And it's basic code:
package org.dealus
import org.jspresso.contrib.tmar.core.Tmar4JUnit;
import org.junit.Assert;
import org.junit.Test
class MowItTest extends Tmar4JUnit {
#Test
void test() {
println "Start test"
def testTmar = getData('test')
eachIteration(testTmar) { tmar ->
tmar.result = "Test ok"
}
println "Test complete"
}
}
Your Tmar project is OK,
However I made test with it and I found a problem with Tmar and the groovy version 2.4.4 you reference in your pom file.
Downgrade to 2.3.1, it should work
I think XML should be like this
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<TMAR>
<CONFIG>
<PROJECT name="Tmar sample project"/>
<LOGO name="tmar-with-name-big.png"/>
<DESCRIPTION_DIRECTORY name="src/test/resources/tmar/descriptions" type="file"/>
<WORKING_DIRECTORY name="src/test/resources/tmar/working" type="file"/>
<RESULT_DIRECTORY name="target/tmar-test-results"/>
<REPORT_DIRECTORY name="target/tmar-test-report"/>
<SRC_GOOGLE_GRAPH name="https://www.google.com/jsapi"/>
<SHORTCUT name="WIKIPEDIA" value="http://en.wikipedia.org/wiki/"/>
</CONFIG>
</TMAR>
Here is github link : https://github.com/jspresso/tmar-sample/blob/master/src/test/resources/tmar/tmar.config
You are missing WORKING_DIRECTORY.

Resources