Plugin load error starting with version 2.0.0 (TeamCity 2019.1.5)
Closed this issue · 13 comments
Hello.
After updating to the most recent version of the plugin (2.1.0) I'm getting a Failed to initialize Spring Context
error.
I've tried installing some previous versions and it seems, that this problem appear in v2.0.0 release.
Unfortunately, I'm unable to upgrade TC due to expired agents licenses.
Is there a minimal required version for TC that the plugin supports?
Here is the full error log from TC plugins page:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.fpd.teamcity.slack.controllers.ConfigController#0' defined in Byte array resource [plugin: Slack Integration#slackIntegration-server-1.0.0.jar!/META-INF/build-server-plugin-slackIntegration.xml]: Unsatisfied dependency expressed through constructor parameter 3; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.fpd.teamcity.slack.SlackGateway#0' defined in Byte array resource [plugin: Slack Integration#slackIntegration-server-1.0.0.jar!/META-INF/build-server-plugin-slackIntegration.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.fpd.teamcity.slack.SlackGateway]: Constructor threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:189)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1193)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1095)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
at jetbrains.buildServer.plugins.spring.SpringPluginLoader.pluginClassesLoaded(SpringPluginLoader.java:114)
at sun.reflect.GeneratedMethodAccessor60.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$3.run(EventDispatcher.java:131)
at jetbrains.buildServer.util.NamedThreadFactory.executeWithNewThreadName(NamedThreadFactory.java:76)
at jetbrains.buildServer.util.EventDispatcher.dispatch(EventDispatcher.java:125)
at jetbrains.buildServer.util.EventDispatcher$2.invoke(EventDispatcher.java:75)
at com.sun.proxy.$Proxy25.pluginClassesLoaded(Unknown Source)
at jetbrains.buildServer.plugins.PluginManagerImpl$5.visitPlugin(PluginManagerImpl.java:417)
at jetbrains.buildServer.plugins.PluginsCollection$1.run(PluginsCollection.java:97)
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:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.fpd.teamcity.slack.SlackGateway#0' defined in Byte array resource [plugin: Slack Integration#slackIntegration-server-1.0.0.jar!/META-INF/build-server-plugin-slackIntegration.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.fpd.teamcity.slack.SlackGateway]: Constructor threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:279)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1193)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1095)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
... 28 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.fpd.teamcity.slack.SlackGateway]: Constructor threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:154)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:122)
at jetbrains.buildServer.spring.InstantiationStrategySelector$1.instantiate(InstantiationStrategySelector.java:77)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:271)
... 41 more
Caused by: java.lang.NullPointerException
at com.slack.api.util.http.SlackHttpClient.buildOkHttpClient(SlackHttpClient.java:59)
at com.slack.api.util.http.SlackHttpClient.buildSlackHttpClient(SlackHttpClient.java:35)
at com.slack.api.util.http.SlackHttpClient.buildSlackHttpClient(SlackHttpClient.java:31)
at com.slack.api.Slack.<init>(Slack.java:75)
at com.slack.api.Slack.getInstance(Slack.java:89)
at com.fpd.teamcity.slack.SlackGateway.<init>(SlackGateway.scala:137)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142)
... 44 more
It seems that this issue related to proxy settings. Have you any?
Just pushed update slack-api-client with proxy port issue fix slackapi/java-slack-sdk#751
My plugin has such problem solution on it's side but maybe you have another one corner case.
Could you try 2.1.1?
It seems that this issue related to proxy settings. Have you any?
Yes, we are indeed using a proxy (sorry I didn't mention it). TC has some internal properties set for authentication (teamcity.https.proxyHost
, teamcity.https.proxyLogin
, etc).
I've tried the latest version (2.1.1) and it is working!
Спасибо!
Ok, I was a bit too fast. The plugin now loads successfully, but is unable to connect to my slack account.
It gives me this message on the configuration page:
Unable to create session by config: auth error
And and error, when I use Try it
link in the build settings:
Error: Unable to connect your Slack account. Please check auth credentials
I guess, this may also be due to my proxy? Should I file another issue?
Is there any error in teamcity-server.log?
Yes. Kind of.
Everytime i push Try it
there is a new line added to teamcity-server.log
:
[2021-07-15 14:18:37,365] INFO - jetbrains.buildServer.SERVER - Slack Integration - http
Does your proxy need login without password?
No, it needs both.
I've asked our admins to temporary allow TC direct internet access. Now, after removing all system proxy-related variables (teamcity.http.proxy*
and teamcity.https.proxy*
) plugin successfully connects and messages are working.
Could you share the list of proxy variables was set?
Sure. Here they are:
teamcity.http.proxyHost=****
teamcity.http.proxyPort=3128
teamcity.http.nonProxyHosts=localhost|*....
teamcity.http.proxyAuthenticationType=basic
teamcity.http.proxyLogin=****
teamcity.http.proxyPassword=****
teamcity.https.proxyHost=****
teamcity.https.proxyPort=3128
teamcity.https.nonProxyHosts=localhost|*...
teamcity.https.proxyAuthenticationType=basic
teamcity.https.proxyLogin=****
teamcity.https.proxyPassword=****
HTTP and HTTPS share the same settings.
Here is the official documentation, that was used for these settings.
I guess I found the bug. Could you try v2.1.2?
Yes, of course. But I'll only be able to check it tomorrow, when our admins will be available to re-enable proxy for the TC server.
Yes, everything is now working great! Thank you, Alex!