tcWebHooks: Failed to initialize Spring Context
Expected Behavior
Successful installation
Current Behavior
Error when installing rest plugin.
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mainAutowireCandidateResolver' defined in URL [jar:file:/opt/teamcity/webapps/ROOT/WEB-INF/lib/common-impl.jar!/META-INF/teamcity-global-spring-candidate-resolver.xml]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [webhook.teamcity.server.rest.RESTControllerExtensionInitializer] for bean with name 'restControllerExtensionInitializer' defined in Byte array resource [plugin: tcWebHooks-REST-API-1.2.0-alpha.4-build.363#tcwebhooks-rest-api-1.2.0-alpha.4-build.363-jar-with-dependencies.jar!/META-INF/build-server-plugin-RESTListener.xml]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: jetbrains/buildServer/server/rest/RESTControllerExtensionAdapter 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:202) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:176) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:687) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:525) at jetbrains.buildServer.plugins.spring.SpringPluginLoader.pluginClassesLoaded(SpringPluginLoader.java:102) at sun.reflect.GeneratedMethodAccessor76.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:126) at jetbrains.buildServer.util.NamedThreadFactory.executeWithNewThreadName(NamedThreadFactory.java:76) at jetbrains.buildServer.util.EventDispatcher.dispatch(EventDispatcher.java:120) at jetbrains.buildServer.util.EventDispatcher$2.invoke(EventDispatcher.java:70) at com.sun.proxy.$Proxy25.pluginClassesLoaded(Unknown Source) at jetbrains.buildServer.plugins.PluginManagerImpl$2.visitPlugin(PluginManagerImpl.java:140) at jetbrains.buildServer.plugins.PluginsCollection$6.run(PluginsCollection.java:261) 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.CannotLoadBeanClassException: Error loading class [webhook.teamcity.server.rest.RESTControllerExtensionInitializer] for bean with name 'restControllerExtensionInitializer' defined in Byte array resource [plugin: tcWebHooks-REST-API-1.2.0-alpha.4-build.363#tcwebhooks-rest-api-1.2.0-alpha.4-build.363-jar-with-dependencies.jar!/META-INF/build-server-plugin-RESTListener.xml]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: jetbrains/buildServer/server/rest/RESTControllerExtensionAdapter at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1388) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:641) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:609) at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1484) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:425) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:395) at org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:220) at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1267) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1160) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1096) 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: java.lang.NoClassDefFoundError: jetbrains/buildServer/server/rest/RESTControllerExtensionAdapter at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:763) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:468) at java.net.URLClassLoader.access$100(URLClassLoader.java:74) at java.net.URLClassLoader$1.run(URLClassLoader.java:369) at java.net.URLClassLoader$1.run(URLClassLoader.java:363) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:362) at jetbrains.buildServer.plugins.classLoaders.TeamCityClassLoader.doLoadClass(TeamCityClassLoader.java:73) at jetbrains.buildServer.plugins.classLoaders.TeamCityClassLoader.loadClass(TeamCityClassLoader.java:40) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.springframework.util.ClassUtils.forName(ClassUtils.java:250) at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:401) at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1432) at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1377) ... 40 more Caused by: java.lang.ClassNotFoundException: Class 'jetbrains.buildServer.server.rest.RESTControllerExtensionAdapter' was not found at jetbrains.buildServer.plugins.classLoaders.TeamCityClassLoader.doLoadClass(TeamCityClassLoader.java:85) at jetbrains.buildServer.plugins.classLoaders.TeamCityClassLoader.loadClass(TeamCityClassLoader.java:40) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 56 more
Steps to Reproduce (for bugs)
- upload plugins(tcWebHooks & rest plugin) zips
- restart Teamcity Server
Your Environment
- tcWebHooks Version: 1.2.0-alpha.4-build.363
- TeamCity Version: 2018.1.5 (build 58744)
- TeamCity server Operating System: Linux
- Are you using a WebHook Template?: No
Example Configuration (xml)
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 15 (10 by maintainers)
Commits related to this issue
- Remove plugin hot-reloading as it not compatible with TC2018 and below Versions of TeamCity up to and including 2018.1.5 failed to laod the plugin correctly if the ` allow-runtime-reload="true"` opti... — committed to tcplugins/tcWebHooks by netwolfuk 7 years ago
- Remove plugin hot-reloading as it not compatible with TC2018 and below Versions of TeamCity up to and including 2018.1.5 failed to laod the plugin correctly if the ` allow-runtime-reload="true"` opti... — committed to tcplugins/tcWebHooks by netwolfuk 7 years ago
- Remove plugin hot-reloading as it not compatible with TC2018 and below Versions of TeamCity up to and including 2018.1.5 failed to laod the plugin correctly if the ` allow-runtime-reload="true"` opti... — committed to tcplugins/tcWebHooks by netwolfuk 7 years ago
After a lot of searching through code, I found the following in my log…
The
allow-runtime-reloadis a new feature since 2018.2. However, how it presents on older versions of TeamCity is quite weird. It loads the plugin, but does not add it into the index of plugins correctly. Then when thetcWebHooks-REST-APIplugin loads, it depends on thetcWebHooksplugin which it can’t find in the index.The reason it works in 1.1.x.x is that I have not tried to enable this hot-reloading feature, and obviously for TeamCity 2018.2 and newer, the file parses correctly, and loads the plugins without error.
Please download a build from the issue_154-spring_init_on_TC2018-1-5 branch (just login as Guest).
If this fixes your problem, then I will do an
1.2.0 alpha.5release ASAP.I also noticed an issue with OpenJDK 8, in that is does not patch the existing TeamCity REST_API correctly. If you’ve not seen that issue, you are probably running Oracle’s JDK 8.
I have now tested all the 1.2.0 alphas. They all present with this issue, but the 1.1.362.398 version does not. I’ll go through the branch differences over the weekend. There are a lot. :-\
Thanks for reporting. I’m not sure I’ve tested it on 2018.1.5. I’ll get back to you asap.