jira-notification
jira-notification copied to clipboard
401 Unauthorized
Hey,
I've tried to setup this plugin on my Rundeck 2.5.0-1 installation to post comments to our JIRA instance. Unfortunately I encounter some problems with the authentication.
After my job finished - I get a 401 Unauthorized from our JIRA. So my first assumption was, that the API of JIRA is secured in another way. But I was able to post a comment using the REST API without any problems when using following command:
pweber@mySystem ~ $ curl -D- -u user:pass -H "Content-Type: application/json" -X POST -d '{ "body": "Test comment" }' https://issue.tool.myCompany.com/rest/api/2/issue/BSPS-4903/comment
HTTP/1.1 201 Created
Date: Mon, 04 May 2015 14:38:50 GMT
So my next assumption is, that the plugin may not work correctly with JIRA 5.0.6.
My configuration in project.properties:
project.plugin.Notification.JIRA.login=username
project.plugin.Notification.JIRA.password=password
project.plugin.Notification.JIRA.url=https://issue.tool.myCompany.com
Exception:
INFO ExecutionUtilService: Execution successful: 3809
net.rcarz.jiraclient.JiraException: Failed to retrieve issue BSPS-4903
at net.rcarz.jiraclient.Issue.realGet(Issue.java:586)
at net.rcarz.jiraclient.Issue.get(Issue.java:608)
at net.rcarz.jiraclient.JiraClient.getIssue(JiraClient.java:85)
at org.rundeck.plugins.notification.JiraNotification.postNotification(JiraNotification.java:60)
at com.dtolabs.rundeck.plugins.notification.NotificationPlugin$postNotification.call(Unknown Source)
at rundeck.services.NotificationService.triggerPlugin(NotificationService.groovy:471)
at rundeck.services.NotificationService.this$2$triggerPlugin(NotificationService.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:497)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1152)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:153)
at rundeck.services.NotificationService$_triggerJobNotification_closure5.doCall(NotificationService.groovy:333)
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:497)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
at groovy.lang.Closure.call(Closure.java:423)
at groovy.lang.Closure.call(Closure.java:439)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1379)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1372)
at org.codehaus.groovy.runtime.dgm$149.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at rundeck.services.NotificationService.triggerJobNotification(NotificationService.groovy:142)
at sun.reflect.GeneratedMethodAccessor1610.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1152)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149)
at rundeck.services.NotificationService$_triggerJobNotification_closure1.doCall(NotificationService.groovy:84)
at sun.reflect.GeneratedMethodAccessor1609.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:207)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:68)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:73)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.codehaus.groovy.grails.orm.hibernate.HibernateGormStaticApi$6.doInHibernate(HibernateGormStaticApi.groovy:513)
at org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateTemplate.doExecute(GrailsHibernateTemplate.java:179)
at org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateTemplate.execute(GrailsHibernateTemplate.java:123)
at org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateTemplate$execute$0.call(Unknown Source)
at org.codehaus.groovy.grails.orm.hibernate.HibernateGormStaticApi.withNewSession(HibernateGormStaticApi.groovy:511)
at rundeck.ScheduledExecution.withNewSession(ScheduledExecution.groovy)
at rundeck.ScheduledExecution$withNewSession$15.call(Unknown Source)
at rundeck.services.NotificationService.triggerJobNotification(NotificationService.groovy:81)
at rundeck.services.NotificationService$triggerJobNotification$0.call(Unknown Source)
at rundeck.services.ExecutionService$_saveExecutionState_closure54.doCall(ExecutionService.groovy:1904)
at sun.reflect.GeneratedMethodAccessor1907.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:207)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:68)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:73)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.codehaus.groovy.grails.orm.hibernate.HibernateGormStaticApi$6.doInHibernate(HibernateGormStaticApi.groovy:513)
at org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateTemplate.doExecute(GrailsHibernateTemplate.java:179)
at org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateTemplate.execute(GrailsHibernateTemplate.java:123)
at org.codehaus.groovy.grails.orm.hibernate.GrailsHibernateTemplate$execute$0.call(Unknown Source)
at org.codehaus.groovy.grails.orm.hibernate.HibernateGormStaticApi.withNewSession(HibernateGormStaticApi.groovy:511)
at rundeck.Execution.withNewSession(Execution.groovy)
at rundeck.Execution$withNewSession$5.call(Unknown Source)
at rundeck.services.ExecutionService.saveExecutionState(ExecutionService.groovy:1809)
at rundeck.services.ExecutionService$$FastClassBySpringCGLIB$$ffb73873.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:708)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:644)
at rundeck.services.ExecutionService$$EnhancerBySpringCGLIB$$d0256a0c.saveExecutionState(<generated>)
at rundeck.services.ExecutionService$saveExecutionState$27.call(Unknown Source)
at rundeck.quartzjobs.ExecutionJob$_saveState_closure3.doCall(ExecutionJob.groovy:449)
at rundeck.quartzjobs.ExecutionJob$_saveState_closure3.doCall(ExecutionJob.groovy)
at sun.reflect.GeneratedMethodAccessor1906.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:207)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:68)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:73)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
at rundeck.quartzjobs.ExecutionJob.withRetry(ExecutionJob.groovy:392)
at sun.reflect.GeneratedMethodAccessor1453.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrap.invoke(PogoMetaMethodSite.java:187)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:56)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:153)
at rundeck.quartzjobs.ExecutionJob.saveState(ExecutionJob.groovy:458)
at rundeck.quartzjobs.ExecutionJob$saveState$5.callCurrent(Unknown Source)
at rundeck.quartzjobs.ExecutionJob.execute_internal(ExecutionJob.groovy:143)
at sun.reflect.GeneratedMethodAccessor1873.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1152)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
at rundeck.quartzjobs.ExecutionJob$_execute_closure1.doCall(ExecutionJob.groovy:71)
at rundeck.quartzjobs.ExecutionJob$_execute_closure1.doCall(ExecutionJob.groovy)
at sun.reflect.GeneratedMethodAccessor1872.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
at groovy.lang.Closure.call(Closure.java:423)
at groovy.lang.Closure.call(Closure.java:417)
at com.codahale.metrics.Timer.time(Timer.java:99)
at com.codahale.metrics.Timer$time$0.call(Unknown Source)
at rundeck.quartzjobs.ExecutionJob.execute(ExecutionJob.groovy:70)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Caused by: net.rcarz.jiraclient.RestException: 401 Unauthorized: <!DOCTYPE html><html><head> <title>Unauthorized (401)</title> <!--[if IE]><![endif]--><script type="text/javascript">var contextPath = '';</script><link type="text/css" rel="stylesheet" href="https://issue.tool.myCompany.com/s/en_US-6hip6c/733/52/1/_/download/superbatch/css/batch.css" media="all"><!--[if lt IE 9]><link type="text/css" rel="stylesheet" href="https://issue.tool.myCompany.com/s/en_US-6hip6c/733/52/1/_/download/superbatch/css/batch.css?conditionalComment=lt+IE+9" media="all"><![endif]--><!--[if IE 9]><link type="text/css" rel="stylesheet" href="https://issue.tool.myCompany.com/s/en_US-6hip6c/733/52/1/_/download/superbatch/css/batch.css?conditionalComment=IE+9" media="all"><![endif]--><!--[if lte IE 9]><link type="text/css" rel="stylesheet" href="https://issue.tool.myCompany.com/s/en_US-6hip6c/733/52/1/_/download/superbatch/css/batch.css?conditionalComment=lte+IE+9" media="all"><![endif]--><link type="text/css" rel="stylesheet" href="https://issue.tool.myCompany.com/s/en_US-6hip6c/733/52/0876dbce8a9225e197ec4112607aabf0/_/download/contextbatch/css/atl.general/batch.css" media="all"><script type="text/javascript" src="https://issue.tool.myCompany.com/s/en_US-6hip6c/733/52/1/_/download/superbatch/js/batch.js" ></script><!--[if lte IE 8]><script type="text/javascript" src="https://issue.tool.myCompany.com/s/en_US-6hip6c/733/52/1/_/download/superbatch/js/batch.js?conditionalComment=lte+IE+8" ></script><![endif]--><script type="text/javascript" src="https://issue.tool.myCompany.com/s/en_US-6hip6c/733/52/1/_/download/superbatch/js/batch.js?cache=false" ></script><script type="text/javascript" src="https://issue.tool.myCompany.com/s/en_US-6hip6c/733/52/0876dbce8a9225e197ec4112607aabf0/_/download/contextbatch/js/atl.general/batch.js" ></script> <script type="text/javascript" src="/rest/api/1.0/shortcuts/733/aff2de869b8d27e7a867ee812bdbb757/shortcuts.js"></script></head><body id="jira" class="aui-layout aui-style-default page-type-message"><div id="page"> <header id="header" role="banner"> <nav class="global" role="navigation"> <div class="primary"> <h1 id="logo"><a href="/secure/MyJiraHome.jspa"><img src="/images/issuetracker_logo.png" width="273" height="24" alt="Issue System" /></a></h1> </div> </nav> </header> <section id="content" role="main"> <header><h1>Unauthorized (401)</h1></header> <div class="content-container"> <div class="content-body"> <p>Encountered a <code>401 - Unauthorized</code> error while loading this page.</p> <p><a href="/secure/MyJiraHome.jspa">JIRA home</a></p> </div> </div> </section></div></body></html>
at net.rcarz.jiraclient.RestClient.request(RestClient.java:136)
at net.rcarz.jiraclient.RestClient.get(RestClient.java:207)
at net.rcarz.jiraclient.RestClient.get(RestClient.java:222)
at net.rcarz.jiraclient.Issue.realGet(Issue.java:584)
... 148 more
ERROR NotificationService: Notification Failed: JIRA
You may got any idea what I could try else to make the plugin working? Any assumption about the cause of the problem?
the jira-client lib used in the plugin is using an older version, perhaps it should be updated.
did you try using curl to "get" an issue, which seems to be where it is causing the 401 error?
Hey,
yes - it's possible to GET an issue
curl -i -u user:pass https://issue.tool.myCompany.com/rest/api/2/issue/BSPS-4903
HTTP/1.1 200 OK
Date: Tue, 05 May 2015 07:37:56 GMT
[.....]
Meanwhile our JIRA instance was updated to v6.3.15 but it still does not work. But I get a 403 - Forbidden error now instead of 401.
Manual POST-requests via curl working fine.
@pfweberp same problem for me. I also updated gradle build to use last jira-client version and that doesn't fix the problem
@nerzhul can confirm that. Tried to update as well - without success :(
@ahonor can you provide as any feedback about this issue please?