Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slack build failed template nullpointerexception #44

Open
aaronjensen opened this issue Aug 18, 2016 · 12 comments
Open

slack build failed template nullpointerexception #44

aaronjensen opened this issue Aug 18, 2016 · 12 comments
Labels
Milestone

Comments

@aaronjensen
Copy link

[2016-08-18 13:14:32,218]   WARN - ildServer.util.EventDispatcher - Error in event handler: java.lang.NullPointerException 
java.lang.NullPointerException
    at webhook.teamcity.payload.format.WebHookPayloadJsonTemplate.getStatusAsString(WebHookPayloadJsonTemplate.java:43)
    at webhook.teamcity.payload.format.WebHookPayloadGeneric.buildFinished(WebHookPayloadGeneric.java:64)
    at webhook.teamcity.WebHookContentBuilder.buildWebHookContent(WebHookContentBuilder.java:78)
    at webhook.teamcity.WebHookListener.processBuildEvent(WebHookListener.java:78)
    at webhook.teamcity.WebHookListener.buildFinished(WebHookListener.java:138)
    at sun.reflect.GeneratedMethodAccessor337.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at jetbrains.buildServer.util.EventDispatcher.dispatch(EventDispatcher.java:121)
    at jetbrains.buildServer.serverSide.ServerSideEventDispatcher.superDispatch(ServerSideEventDispatcher.java:6)
    at jetbrains.buildServer.serverSide.ServerSideEventDispatcher$1.run(ServerSideEventDispatcher.java:1)
    at jetbrains.buildServer.serverSide.impl.auth.SecurityContextImpl.runAs(SecurityContextImpl.java:3)
    at jetbrains.buildServer.serverSide.impl.auth.SecurityContextImpl.runAsSystem(SecurityContextImpl.java:11)
    at jetbrains.buildServer.serverSide.ServerSideEventDispatcher.dispatch(ServerSideEventDispatcher.java:12)
    at jetbrains.buildServer.util.EventDispatcher$2.invoke(EventDispatcher.java:68)
    at com.sun.proxy.$Proxy19.buildFinished(Unknown Source)
    at jetbrains.buildServer.serverSide.impl.RunningBuildsManagerImpl.finishBuild(RunningBuildsManagerImpl.java:24)
    at jetbrains.buildServer.serverSide.impl.RunningBuildsManagerImpl.access$600(RunningBuildsManagerImpl.java:198)
    at jetbrains.buildServer.serverSide.impl.RunningBuildsManagerImpl$5.run(RunningBuildsManagerImpl.java:2)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
@netwolfuk
Copy link
Member

Can I get some more detail on this? Like example config files.

@aaronjensen
Copy link
Author

Here is this:

# cat pluginData/plugin-settings.xml

<?xml version="1.0" encoding="UTF-8"?>
<settings>
  <webhooks enabled="true">
    <webhook url="https://hooks.slack.com/services/xxxxxxx" enabled="true" format="jsontemplate" template="slack.com">
      <states>
        <state type="buildBroken" enabled="false" />
        <state type="changesLoaded" enabled="false" />
        <state type="buildInterrupted" enabled="false" />
        <state type="buildFixed" enabled="false" />
        <state type="buildFinished" enabled="true" />
        <state type="buildStarted" enabled="false" />
        <state type="responsibilityChanged" enabled="false" />
        <state type="buildSuccessful" enabled="true" />
        <state type="buildFailed" enabled="true" />
        <state type="beforeBuildFinish" enabled="false" />
      </states>
      <build-types enabled-for-all="true" enabled-for-subprojects="true" />
    </webhook>
  </webhooks>
</settings>

Are there any other config files that would be helpful? If it helps I'm on TC 10.0.1

@aaronjensen
Copy link
Author

So I was able to fix it by fixing another thing that was bothering me. By VCS config had an unnecessary branch spec. When I cleared the branch spec (it was just to make the long branch name shorter) then it all works.

the-link-merge vcs root settings diff teamcity 2016-08-18 13-57-10

@netwolfuk
Copy link
Member

Hmm, interesting. I've not played with branchSpec before. I'll leave this issue open, but low priority.

@netwolfuk netwolfuk added this to the 1.2 milestone Aug 30, 2016
@mmalvik
Copy link

mmalvik commented Sep 18, 2018

I seem to have the same issue
This is on TeamCity Enterprise 2018.1 (build 58245).
The weird thing is how flaky it is, the webhook fires most of the time, just not always when it should.

Error calling method BuildServerListener.buildFinished for listener webhook.teamcity.WebHookListener: java.lang.NullPointerException
    at jetbrains.buildServer.util.EventDispatcher$3.run(EventDispatcher.java:146)
    at jetbrains.buildServer.util.NamedThreadFactory.executeWithNewThreadName(NamedThreadFactory.java:76)
    at jetbrains.buildServer.util.EventDispatcher.dispatch(EventDispatcher.java:120)
    at jetbrains.buildServer.serverSide.ServerSideEventDispatcher.superDispatch(ServerSideEventDispatcher.java:7)
    at jetbrains.buildServer.serverSide.ServerSideEventDispatcher$1.run(ServerSideEventDispatcher.java:1)
    at jetbrains.buildServer.serverSide.impl.auth.SecurityContextImpl.runAs(SecurityContextImpl.java:43)
    at jetbrains.buildServer.serverSide.impl.auth.SecurityContextImpl.runAsSystem(SecurityContextImpl.java:41)
    at jetbrains.buildServer.serverSide.ServerSideEventDispatcher.dispatch(ServerSideEventDispatcher.java:12)
    at jetbrains.buildServer.util.EventDispatcher$2.invoke(EventDispatcher.java:70)
    at com.sun.proxy.$Proxy21.buildFinished(Unknown Source)
    at jetbrains.buildServer.serverSide.impl.RunningBuildsManagerImpl.finishBuild(RunningBuildsManagerImpl.java:154)
    at jetbrains.buildServer.serverSide.impl.RunningBuildsManagerImpl.lambda$scheduleBuildFinishing$1(RunningBuildsManagerImpl.java:205)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException

@netwolfuk
Copy link
Member

Hi which version of the tcWebHooks plugin are you using?

@netwolfuk
Copy link
Member

Also, @mmalvik, are you using branchSpec too?

@mmalvik
Copy link

mmalvik commented Sep 18, 2018

We are using 1.1.-alpha7.122.138

tcwebhooks

Looks like we are 2 years behind... 😅
You think an update might fix it?

Yes, we have branch spec set to +:refs/heads/*

@netwolfuk
Copy link
Member

netwolfuk commented Sep 18, 2018

Oh, that branchSpec should be fine. I use that one all the time too. I probably should have asked if you have variables in the branch spec.

I haven't done anything specific to fix this issue, but I would recommend updating as there are many many bug fixes and improvements.

@netwolfuk
Copy link
Member

Btw. Looking at the stack trace, I'm not convinced you're seeing the same issue as Aaron was. Please do update, let me know if you see the issue again.

@mmalvik
Copy link

mmalvik commented Sep 25, 2018

I will keep an eye out for this and update if I see it again ✔️

@netwolfuk
Copy link
Member

Sorry, bumping this to 1.3

@netwolfuk netwolfuk modified the milestones: v1.2, v1.3 Jun 22, 2020
@netwolfuk netwolfuk removed this from To Do in Release Milestone 1.2 Jun 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants