parautenbach / TeamCity-HipChat-Notifier

TeamCity HipChat Notifier for sending build server notifications to HipChat.
Other
59 stars 31 forks source link

Upgrade from v0.3.0 to v0.4.0 doesn't play nice #10

Closed shwetashah closed 10 years ago

shwetashah commented 10 years ago

Hi, I'm using the TC 8.1.1 (latest version). I had HitChatNotifier v0.3.0 installed. Upgrading it to v0.4.0 wasn't smooth. I had to uninstall the older version and then re-install the newer version and restart TC a couple of time to get it to play nicely.

parautenbach commented 10 years ago

Hi there

Thank you for the feedback. I'm sorry to hear about the troubles you had.

I've tried the following steps to try and reproduce your problems:

Perhaps a few questions, if you could elaborate:

As a suggestion, you could enable the plugin's log like this:

For debugging, add the snippets in teamcity-server-log4j.xml in this project's root to conf/teamcity-server-log4j.xml and then monitor logs/hipchat-notifier.log.

parautenbach commented 10 years ago

Another thing: Were you connected to the internet during these issues? The plugin needs to retrieve the list of available rooms and emoticons from the HipChat API. The plugin can't function properly without that.

parautenbach commented 10 years ago

Ok, I found a bug that could be the cause of your problems: If your build server can't connect to the HipChat API (due to misconfiguration of the API URL or token, or due to internet connectivity problems), the start-up of the plugin will fail. I've made this more robust.

More details: The most important difference between v0.3.0 and v0.4.0 was the change from plain text to HTML messages. This required emoticons to be retrieved from the API in order to embed them with IMG tags in the HTML. This cache is constructed when the plugin's server extension registers. If this failed, for one the reasons mentioned above, the plugin won't be registered properly with the TeamCity server.

It would manifest like this in teamcity-server.log:

[2014-03-22 09:27:38,842]  ERROR - gins.spring.SpringPluginLoader - Failed to initialize spring context for plugin HipChat Notifier 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hipChatServerExtension' defined in plugin: HipChat Notifier#HipChatNotifier.jar!/META-INF/build-server-plugin-hipchat-notifier.xml: Invocation of init method failed; nested exception is java.lang.NullPointerException
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
    at jetbrains.buildServer.plugins.spring.SpringPluginLoader.pluginClassesLoaded(SpringPluginLoader.java:72)
    at sun.reflect.GeneratedMethodAccessor46.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at jetbrains.buildServer.util.EventDispatcher.dispatch(EventDispatcher.java:115)
    at jetbrains.buildServer.util.EventDispatcher$2.invoke(EventDispatcher.java:67)
    at com.sun.proxy.$Proxy7.pluginClassesLoaded(Unknown Source)
    at jetbrains.buildServer.plugins.PluginManagerImpl$2.visitPlugin(PluginManagerImpl.java:122)
    at jetbrains.buildServer.plugins.PluginsCollection.foreachLoadedPlugins(PluginsCollection.java:107)
    at jetbrains.buildServer.plugins.PluginManagerImpl.firePluginClassesLoaded(PluginManagerImpl.java:120)
    at jetbrains.buildServer.plugins.PluginManagerImpl.loadPlugins(PluginManagerImpl.java:80)
    at jetbrains.buildServer.web.plugins.PluginManagerConfigurator.initializePlugins(PluginManagerConfigurator.java:10)
    at jetbrains.buildServer.web.impl.BuildServerConfigurator.loadConfiguration(BuildServerConfigurator.java:19)
    at jetbrains.buildServer.maintenance.TeamCityDispatcherServlet$WebApplicationCreatorAndDestroyer.createApplication(TeamCityDispatcherServlet.java:17)
    at jetbrains.buildServer.maintenance.StartupProcessor.doApplicationStarting(StartupProcessor.java:407)
    at jetbrains.buildServer.maintenance.StartupProcessor.processConcreteStage(StartupProcessor.java:240)
    at jetbrains.buildServer.maintenance.StartupProcessor.processConcreteStageSafe(StartupProcessor.java:475)
    at jetbrains.buildServer.maintenance.StartupProcessor.processTeamCityLifecycle(StartupProcessor.java:195)
    at jetbrains.buildServer.maintenance.StartupProcessor.access$000(StartupProcessor.java:20)
    at jetbrains.buildServer.maintenance.StartupProcessor$1.run(StartupProcessor.java:2)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.NullPointerException
    at com.whatsthatlight.teamcity.hipchat.HipChatServerExtension.register(HipChatServerExtension.java:90)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1544)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1485)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
    ... 30 more

The line of interest is:

Caused by: java.lang.NullPointerException
    at com.whatsthatlight.teamcity.hipchat.HipChatServerExtension.register(HipChatServerExtension.java:90)
parautenbach commented 10 years ago

Because of the multiple restarts, I'm almost sure you had a connectivity problem and not a misconfiguration, because if this was the case, uninstalling and reinstalling likely wouldn't have resolved the issue.

I'm closing this issue, unless more details are provided.