Announcement Announcement Module
Collapse
No announcement yet.
Spring 3 - Jenkins build- ambiguous constructor argument types exception Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring 3 - Jenkins build- ambiguous constructor argument types exception

    I use Spring 3.1.4 and having a bit of a problem with a project when is built with Jenkins with prod profile (-Pprod-build). Everything works fine when the project is built with dev profile and also if I run it locally with prod profile.

    The prod jenkins build ends successfully but when I try to deploy the war on tomcat I get the following exceptions:
    Code:
    Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void fr.isiom.bpms
    .prestataire.services.administration.TeamAdministrationService.setTeamAdministrationDAO(fr.isiom.bpms.prestataire.dao.IT
    eamDAO); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tea
    mDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationExc
    eption: Could not autowire method: public void fr.isiom.bpms.prestataire.dao.impl.TeamDAO.setQueryLoader(fr.isiom.bpms.p
    restataire.dao.util.loaders.QueryLoaderTeam); nested exception is org.springframework.beans.factory.UnsatisfiedDependenc
    yException: Error creating bean with name 'queryLoaderTeam' defined in ServletContext resource [/WEB-INF/queries/appCont
    ext-queries-team.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [java.util.Map
    ]: Ambiguous constructor argument types - did you specify the correct bean references as constructor arguments?
            at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inje
    ct(AutowiredAnnotationBeanPostProcessor.java:600)
            at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:92)
            at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(A
    utowiredAnnotationBeanPostProcessor.java:284)
            ... 50 more
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'teamDAO': Injection o
    f autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not
    autowire method: public void fr.isiom.bpms.prestataire.dao.impl.TeamDAO.setQueryLoader(fr.isiom.bpms.prestataire.dao.uti
    l.loaders.QueryLoaderTeam); nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error
    creating bean with name 'queryLoaderTeam' defined in ServletContext resource [/WEB-INF/queries/appContext-queries-team.x
    ml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [java.util.Map]: Ambiguous const
    ructor argument types - did you specify the correct bean references as constructor arguments?
            at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(A
    utowiredAnnotationBeanPostProcessor.java:287)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCap
    ableBeanFactory.java:1106)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCap
    ableBeanFactory.java:517)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapab
    leBeanFactory.java:456)
            at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
            at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegis
    try.java:225)
            at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBe
    anFactory.java:871)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanF
    actory.java:813)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFac
    tory.java:730)
            at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inje
    ct(AutowiredAnnotationBeanPostProcessor.java:558)
            ... 52 more
    Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void fr.isiom.bpms
    .prestataire.dao.impl.TeamDAO.setQueryLoader(fr.isiom.bpms.prestataire.dao.util.loaders.QueryLoaderTeam); nested excepti
    on is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'queryLoaderTeam'
    defined in ServletContext resource [/WEB-INF/queries/appContext-queries-team.xml]: Unsatisfied dependency expressed thro
    ugh constructor argument with index 0 of type [java.util.Map]: Ambiguous constructor argument types - did you specify th
    e correct bean references as constructor arguments?
            at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inje
    ct(AutowiredAnnotationBeanPostProcessor.java:600)
            at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:92)
            at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(A
    utowiredAnnotationBeanPostProcessor.java:284)
            ... 63 more
    Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'queryLoaderT
    eam' defined in ServletContext resource [/WEB-INF/queries/appContext-queries-team.xml]: Unsatisfied dependency expressed
     through constructor argument with index 0 of type [java.util.Map]: Ambiguous constructor argument types - did you speci
    fy the correct bean references as constructor arguments?
            at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:71
    6)
            at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:19
    6)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAuto
    wireCapableBeanFactory.java:1035)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutow
    ireCapableBeanFactory.java:939)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCap
    ableBeanFactory.java:485)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapab
    leBeanFactory.java:456)
            at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
            at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegis
    try.java:225)
            at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBe
    anFactory.java:871)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanF
    actory.java:813)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFac
    tory.java:730)
            at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inje
    ct(AutowiredAnnotationBeanPostProcessor.java:558)
            ... 65 more
    My QueryLoaderTeam:
    Code:
    public class QueryLoaderTeam {
    
        private Map<String, String> queryMap;
    
        /**
         * @param queryMap
         */
        public QueryLoaderTeam(Map<String, String> queryMap) {
            this.queryMap = queryMap;
        }
    
        /**
         * Returns the query map - read-only
         * @return
         */
        public Map<String, String> getQueryMap() {
            return Collections.unmodifiableMap(this.queryMap);
        }
    }
    And my appContext-queries-team :
    Code:
    <?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:context="http://www.springframework.org/schema/context"
        xsi:schemaLocation="http://www.springframework.org/schema/beans 
                http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
                http://www.springframework.org/schema/context
                http://www.springframework.org/schema/context/spring-context-3.1.xsd">
    
        <bean id="queryLoaderTeam" class="fr.isiom.bpms.prestataire.dao.util.loaders.QueryLoaderTeam" scope="singleton">
            <constructor-arg name="queryMap" index="0" type="java.util.Map">
                <map>
    
                    <entry key="list_company_teams">
                        <value>
                            <![CDATA[
                                SELECT * FROM DUAL
                            ]]>
                        </value>
                    </entry>
    </map>
            </constructor-arg>
        </bean>
    
    </beans>
Working...
X