jira-trigger-webhook-receiver抛出JSONException:找不到JSONObject [“ name”]

时间:2019-07-11 11:56:29

标签: jenkins-jira-trigger

我们有JIRA使用Jenkins的jira-trigger插件来触发Jenkins构建。截至昨天(2019-07-10),一切正常,但今天它没有触发任何构建。

我已经在Jenkins中启用了(全部)以下日志记录并检查了日志

*com.ceilfors.jenkins.plugins.jiratrigger.*
com.ceilfors.jenkins.plugins.jiratrigger.webhook.JiraWebhook
com.ceilfors.jenkins.plugins.jiratrigger.JiraCommentTrigger
com.ceilfors.jenkins.plugins.jiratrigger.JiraTrigger
com.ceilfors.jenkins.plugins.jiratrigger.JiraTriggerExecutor*

我可以看到Jira webhook正在发送有效的JSON,并且在Jenkins上也失败了,指出了此错误: org.codehaus.jettison.json.JSONException:找不到JSONObject [“ name”]。

Error while serving https://localhost/jira-trigger-webhook-receiver/
org.codehaus.jettison.json.JSONException: JSONObject["name"] not found.
    at org.codehaus.jettison.json.JSONObject.get(JSONObject.java:360)
    at org.codehaus.jettison.json.JSONObject.getString(JSONObject.java:487)
    at com.atlassian.jira.rest.client.internal.json.JsonParseUtil.parseBasicUser(JsonParseUtil.java:192)
    at com.atlassian.jira.rest.client.internal.json.CommentJsonParser.parse(CommentJsonParser.java:37)
    at com.atlassian.jira.rest.client.internal.json.CommentJsonParser$parse.call(Unknown Source)
    at com.ceilfors.jenkins.plugins.jiratrigger.webhook.WebhookCommentEventJsonParser.parse(WebhookCommentEventJsonParser.groovy:40)
    at com.ceilfors.jenkins.plugins.jiratrigger.webhook.WebhookCommentEventJsonParser$parse.call(Unknown Source)
    at com.ceilfors.jenkins.plugins.jiratrigger.webhook.JiraWebhook.processEvent(JiraWebhook.groovy:71)
    at com.ceilfors.jenkins.plugins.jiratrigger.webhook.JiraWebhook$processEvent.callCurrent(Unknown Source)
    at com.ceilfors.jenkins.plugins.jiratrigger.webhook.JiraWebhook.doIndex(JiraWebhook.groovy:51)
    at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
    at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:396)
Caused: java.lang.reflect.InvocationTargetException
    at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:400)
    at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:408)
    at org.kohsuke.stapler.interceptor.RequirePOST$Processor.invoke(RequirePOST.java:77)
    at org.kohsuke.stapler.PreInvokeInterceptedFunction.invoke(PreInvokeInterceptedFunction.java:26)
    at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:212)
    at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:145)
    at org.kohsuke.stapler.IndexDispatcher.dispatch(IndexDispatcher.java:27)

收到JSON:

{
    "timestamp": 1562845569917,
    "webhookEvent": "comment_created",
    "comment": {
        "self": "https://my.atlassian.net/rest/api/2/issue/12815/comment/19186",
        "id": "19186",
        "author": {
            "self": "https://my.atlassian.net/rest/api/2/user?accountId=1234567890",
            "accountId": "1234567890",
            "emailAddress": "\"?\"",
            "avatarUrls": {
                "48x48": "https://alocal.net/initials/PM-1.png?size=48&s=48",
                "24x24": "https://alocal.net/initials/PM-1.png?size=24&s=24",
                "16x16": "https://alocal.net/initials/PM-1.png?size=16&s=16",
                "32x32": "https://alocal.net/initials/PM-1.png?size=32&s=32"
            },
            "displayName": "admin",
            "active": true,
            "timeZone": "Asia/Calcutta",
            "accountType": "atlassian"
        },
        "body": "deploy_staging",
        "updateAuthor": {
            "self": "https://my.atlassian.net/rest/api/2/user?accountId=1234567890",
            "accountId": "1234567890",
            "emailAddress": "\"?\"",
            "avatarUrls": {
                "48x48": "https://alocal.net/initials/PM-1.png?size=48&s=48",
                "24x24": "https://alocal.net/initials/PM-1.png?size=24&s=24",
                "16x16": "https://alocal.net/initials/PM-1.png?size=16&s=16",
                "32x32": "https://alocal.net/initials/PM-1.png?size=32&s=32"
            },
            "displayName": "admin",
            "active": true,
            "timeZone": "Asia/Calcutta",
            "accountType": "atlassian"
        },
        "created": "2019-07-11T17:16:09.917+0530",
        "updated": "2019-07-11T17:16:09.917+0530",
        "jsdPublic": true
    },
    "issue": {
        "id": "12815",
        "self": "https://my.atlassian.net/rest/api/2/issue/12815",
        "key": "DEVOPS-160",
        "fields": {
            "summary": "Deploy - Test",
            "issuetype": {
                "self": "https://my.atlassian.net/rest/api/2/issuetype/10081",
                "id": "10081",
                "description": "",
                "iconUrl": "https://my.atlassian.net/secure/viewavatar?size=medium&avatarId=10304&avatarType=issuetype",
                "name": "Deployment",
                "subtask": false,
                "avatarId": 10304
            },
            "project": {
                "self": "https://my.atlassian.net/rest/api/2/project/10032",
                "id": "10032",
                "key": "DEVOPS",
                "name": "Test Ops",
                "projectTypeKey": "software",
                "simplified": false,
                "avatarUrls": {
                    "48x48": "https://my.atlassian.net/secure/projectavatar?pid=10032&avatarId=10517",
                    "24x24": "https://my.atlassian.net/secure/projectavatar?size=small&s=small&pid=10032&avatarId=10517",
                    "16x16": "https://my.atlassian.net/secure/projectavatar?size=xsmall&s=xsmall&pid=10032&avatarId=10517",
                    "32x32": "https://my.atlassian.net/secure/projectavatar?size=medium&s=medium&pid=10032&avatarId=10517"
                },
                "projectCategory": {
                    "self": "https://my.atlassian.net/rest/api/2/projectCategory/10006",
                    "id": "10006",
                    "description": "Operations",
                    "name": "Operations"
                }
            },
            "assignee": {
                "self": "https://my.atlassian.net/rest/api/2/user?accountId=1234567890",
                "name": "phani.k",
                "key": "phani.k",
                "accountId": "1234567890",
                "emailAddress": "phani.k@synup.com",
                "avatarUrls": {
                    "48x48": "https://alocal.net/1234567890/dfe77db8-e320-4c3e-a074-3d79892a5c6d/128?size=48&s=48",
                    "24x24": "https://alocal.net/1234567890/dfe77db8-e320-4c3e-a074-3d79892a5c6d/128?size=24&s=24",
                    "16x16": "https://alocal.net/1234567890/dfe77db8-e320-4c3e-a074-3d79892a5c6d/128?size=16&s=16",
                    "32x32": "https://alocal.net/1234567890/dfe77db8-e320-4c3e-a074-3d79892a5c6d/128?size=32&s=32"
                },
                "displayName": "admin",
                "active": true,
                "timeZone": "Asia/Kolkata",
                "accountType": "atlassian"
            },
            "priority": {
                "self": "https://my.atlassian.net/rest/api/2/priority/3",
                "iconUrl": "https://my.atlassian.net/images/icons/priorities/medium.svg",
                "name": "Medium",
                "id": "3"
            },
            "status": {
                "self": "https://my.atlassian.net/rest/api/2/status/10118",
                "description": "Run all feasibility checks",
                "iconUrl": "https://my.atlassian.net/",
                "name": "In Progress",
                "id": "10118",
                "statusCategory": {
                    "self": "https://my.atlassian.net/rest/api/2/statuscategory/4",
                    "id": 4,
                    "key": "indeterminate",
                    "colorName": "yellow",
                    "name": "In Progress"
                }
            }
        }
    }
}

0 个答案:

没有答案