I try to make user inactive via groovy scriptrunner
1.import com.atlassian.jira.bc.user.UserService
2.UserService userService = ComponentAccessor.getComponent(UserService)
3.
4.try{
5.def updatedUser = userService.newUserBuilder(listForTest.get(0)).
6.displayName("${listForTest.get(0).username}_not 7.working").active(false).build()
8.def updateUserValidationResult = 9.userService.validateUpdateUser(updatedUser)
10.log.warn("Is valid : " + updateUserValidationResult.isValid())
11.userService.updateUser(updateUserValidationResult)
12.}catch (Exception e){
13.log.warn(e)
14.}
15.log.warn("Try to deactivate first user from list. This user is 16.${listForTest.get(0).username}")
17.log.warn("End of script")
and user become inactive and name changes but I have a long list of Exceptions in script console
at Script101.run(Script101.groovy:11)
.
.
.
WARN [runner.ScriptBindingsManager]: Try to deactivate first user from list. This user is aantonov
WARN [runner.ScriptBindingsManager]: End of script Start of logs truncated as they exceeded 300 lines.
But I can't find this log in atlassian-jira.log or in catalina.out on jira server
What is wrong and why that exceptions appears but user changes and why it doesn't handle by catch block?
Hi @aas
What is your exception? In Logging and Profiling page, are there settings for 'runner.ScriptBindingsManager'? Are there any log4j properties for that category?
This is a script excerpt I use
ApplicationUserBuilder applicationUserBuilder = usrService.newUserBuilder(user);
applicationUserBuilder.active(true);
ApplicationUser userForValidation = applicationUserBuilder.build();
UserService.UpdateUserValidationResult updateUserValidationResult = usrService.validateUpdateUser(userForValidation);
if (updateUserValidationResult.isValid()) {
usrService.updateUser(updateUserValidationResult);
logit.info("internal update")
} else {
errorCollection = updateUserValidationResult.getErrorCollection();
logit.info(errorCollection)
}
Hi @Tom Lister
In Logging and Profiling page I have DEBUG
StackTrace is:
at Script101.run(Script101.groovy:96) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:317) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:155) at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233) at javax.script.ScriptEngine$eval.call(Unknown Source) at com.onresolve.scriptrunner.runner.AbstractScriptRunner.runScriptAndGetContext(AbstractScriptRunner.groovy:172) at com.onresolve.scriptrunner.runner.AbstractScriptRunner$runScriptAndGetContext$3.callCurrent(Unknown Source) at com.onresolve.scriptrunner.runner.AbstractScriptRunner.runScriptAndGetContext(AbstractScriptRunner.groovy:291) at com.onresolve.scriptrunner.runner.AbstractScriptRunner$runScriptAndGetContext$2.callCurrent(Unknown Source) at com.onresolve.scriptrunner.runner.AbstractScriptRunner.runScript(AbstractScriptRunner.groovy:303) at com.onresolve.scriptrunner.runner.rest.common.UserScriptEndpoint$_execFromJson_closure2.doCall(UserScriptEndpoint.groovy:156) at com.onresolve.scriptrunner.runner.rest.common.UserScriptEndpoint$_execFromJson_closure2.doCall(UserScriptEndpoint.groovy) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:101) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:263) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1041) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:37) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:52) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:119) at com.onresolve.scriptrunner.runner.diag.DiagnosticsManagerImpl$DiagnosticsExecutionHandlerImpl$_execute_closure1.doCall(DiagnosticsManagerImpl.groovy:345) at com.onresolve.scriptrunner.runner.diag.DiagnosticsManagerImpl$DiagnosticsExecutionHandlerImpl$_execute_closure1.doCall(DiagnosticsManagerImpl.groovy) at sun.reflect.GeneratedMethodAccessor1351.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:101) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:263) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1041) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:37) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:119) at com.onresolve.scriptrunner.runner.ScriptExecutionRecorder.withRecording(ScriptExecutionRecorder.groovy:13) at com.onresolve.scriptrunner.runner.ScriptExecutionRecorder$withRecording.call(Unknown Source) at com.onresolve.scriptrunner.runner.diag.DiagnosticsManagerImpl$DiagnosticsExecutionHandlerImpl.execute(DiagnosticsManagerImpl.groovy:343) at com.onresolve.scriptrunner.runner.rest.common.UserScriptEndpoint.execFromJson(UserScriptEndpoint.groovy:147) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$ResponseOutInvoker$1.invoke(DispatchProviderHelper.java:192) at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$1.intercept(DispatchProviderHelper.java:83) at com.atlassian.plugins.rest.common.interceptor.impl.DefaultMethodInvocation.invoke(DefaultMethodInvocation.java:53) at com.atlassian.plugins.rest.common.expand.interceptor.ExpandInterceptor.intercept(ExpandInterceptor.java:41) at com.atlassian.plugins.rest.common.interceptor.impl.DefaultMethodInvocation.invoke(DefaultMethodInvocation.java:53) at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper.invokeMethodWithInterceptors(DispatchProviderHelper.java:110) at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$ResponseOutInvoker._dispatch(DispatchProviderHelper.java:190) at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75) at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302) at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108) at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
...
2020-12-08 16:55:14,161 WARN [runner.ScriptBindingsManager]: Try to deactivate first user from list. This user is someUser
2020-12-08 16:55:14,162 WARN [runner.ScriptBindingsManager]: End of script
Start of logs truncated as they exceeded 300 lines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
But in another instance of Jira I don't have that long Stack Trace in logs in script console only that logs which I want to show:
2020-12-09 10:11:12,157 WARN [runner.ScriptBindingsManager]: Is valid : true
2020-12-09 10:11:12,371 INFO [index.MonitoringIndexWriter]: [lucene-stats] flush stats: snapshotCount=3, totalCount=14, periodSec=1852, flushIntervalMillis=617533, indexDirectory=null, indexWriterId=com.atlassian.jira.index.MonitoringIndexWriter@3b051102, indexDirectoryId=RAMDirectory@2ed11bb2 lockFactory=org.apache.lucene.store.SingleInstanceLockFactory@67ca8e7c
2020-12-09 10:11:12,472 WARN [runner.ScriptBindingsManager]: Try to deactivate first user from list. This user is someUsername
2020-12-09 10:11:12,472 WARN [runner.ScriptBindingsManager]: End of script
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Versions of Jira same 8.5.6, version of scriptrunner the same 6.5.0-p5
log4j.properties are different, but I can't find anything in log4j.properties about logging in script console
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You mean this stack trace is shown because of some log4j settings and not because of error? The goal is to bulk deactivate thousand users but I worry about that stack trace in console and that it was caused by this code
usrService.updateUser(updateUserValidationResult)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In catalina.out and in atlassian-jira.log I can find logs that I write in script. I mean that in script I write
log.warn("Is valid : " + updateUserValidationResult.isValid())
and in catalina.out I see "Is valid : true" but there no that long stack trace that appears in script console log tab
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I found out that if turn off logging for package com.atlassian.cache.stacktrace in "logging and profiling" there no more stacktrace in console but only my logs. What is the package com.atlassian.cache.stacktrace and why that stacktrace appears?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.