No matching bean of type [jetbrains.buildServer.ExtensionHolder]

Try to write a plugin to add a couple of new system parameters for the build. The class is look like

public class NewSysParams  {syspa
        public NewSysParams  (@NotNull ServerPaths serverPaths,
                               @NotNull ExtensionHolder extensionHolder,
                               @NotNull PluginDescriptor pluginDescriptor) {
        String configDirPath = serverPaths.getConfigDir();
        myVersion = "pre 6.5 EAP";
        System.out.println(
                Thread.currentThread().getStackTrace()[1].getMethodName());
        LOG.warn(
                Thread.currentThread().getStackTrace()[1].getMethodName() + "configDIRPath - " + configDirPath + "myVersion = "  + myVersion);
        if (init(configDirPath)) {
            SystemParamProvider extension = new SystemParamProvider(this);
            myExtensionsHolder = extensionHolder;
            myExtensionsHolder.registerExtension(BuildParametersProvider.class, SystemParamProvider.class.getName(), extension);

        }

}

The build-server-plugin-sysparam-plugin.xml looks like,

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:lang="http://www.springframework.org/schema/lang" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd" default-autowire="constructor">
<bean />
</beans>

when the plugin is loaded, the server reports error,

No sure how the arguement @NotNull ExtensionHolder extensionHolder get passed into the constructor NewSysParams()? Any clue on the error and the fix? Thanks


[2013-06-16 09:08:15,914] ERROR - gins.spring.SpringPluginLoader - Failed to initialize spring context for plugin sysparam-plugin
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name NewSysParams
Unsatisfied dependency expressed through constructor argument with index 1 of type [jetbrains.buildServer.ExtensionHolder]: : No matching bean of type [jetbrains.buildServer.ExtensionHolder] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [jetbrains.buildServer.ExtensionHolder] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations

2 comments
Comment actions Permalink

Are there any other exceptions in the log file, I created an example that registers an extension with an ExtensionHolder based on the following code, http://svn.jetbrains.org/teamcity/plugins/autoincrementer/trunk/src/jetbrains/buildServer/server/autoincrementer/AutoincrementValues.java, and it worked. I was using TeamCity version 7.1.4, are you using an up to date version?

Rod

0
Comment actions Permalink

Hello,

Please check you import right ExtensionHolder class any you did not put the same class in some .jar under your plugin.

Actually, you simply do not need to call ExtensionHolder explicitly. Registration is done automatically once you register your class into Spring .xml

0

Please sign in to leave a comment.